Skip to content
spmaddmath.com.my
Tuition

Study

SyllabusFormulasMethodsExam & PapersTools
LocationsPricingBlogOur TeachersContact
EN

Worked examples · Functions

Functions, Worked Examples (medium)

These medium Functions examples push past the basics: recovering a missing function from a composite fg(x)fg(x), finding the inverse of a rational function, and solving for an unknown constant in a self-composite f2(x)f^{2}(x). Each solution shows the method line, the rearrangement, and a substitution check.

What these examples cover

These medium Functions examples move beyond direct substitution into the reasoning the exam rewards most. You will work backwards from a composite to recover a hidden function, rearrange a rational expression to find an inverse, and use the self-composite f2(x)=ff(x)f^{2}(x)=ff(x) to pin down an unknown constant.

None of these needs heavy algebra, each needs a clear plan and a tidy rearrangement. Cover each solution, set the problem up yourself, and only compare once you have a final answer.

When you check, focus on the step that turns the question around, because that reversal is where most of the marks are won or lost. Every answer here is confirmed by an independent substitution.

Worked examples

Attempt all three fully before reading the solutions. Watch for the moment each question asks you to reverse a step you already know how to do forwards.

Q1[4 marks]

The function ff is defined by f(x)=2x1f(x)=2x-1. Given that the composite function fg(x)=6x+5fg(x)=6x+5, find g(x)g(x).

Show worked solution

fg(x)fg(x) means f(g(x))f(g(x)), so gg is the inner function. Apply the rule of ff to the whole of g(x)g(x): wherever ff takes its input, put g(x)g(x).

fg(x)=2g(x)1fg(x)=2\,g(x)-1

Set this equal to the given composite and solve for g(x)g(x):

2g(x)1=6x+52\,g(x)-1=6x+5
2g(x)=6x+62\,g(x)=6x+6
g(x)=3x+3g(x)=3x+3

Answer

g(x)=3x+3g(x)=3x+3. Check by rebuilding the composite: fg(x)=2(3x+3)1=6x+61=6x+5fg(x)=2(3x+3)-1=6x+6-1=6x+5, which matches the given expression exactly.

Q2[4 marks]

A function is defined by f(x)=2x+1x3f(x)=\dfrac{2x+1}{x-3}, x3x\neq 3. Find f1(x)f^{-1}(x) and state the value of xx it excludes.

Show worked solution

Let y=f(x)y=f(x), then make xx the subject. Begin by clearing the denominator:

y=2x+1x3    y(x3)=2x+1y=\frac{2x+1}{x-3} \;\Rightarrow\; y(x-3)=2x+1

Expand, gather every xx term on one side, and factorise out xx:

yx3y=2x+1yx-3y=2x+1
yx2x=3y+1yx-2x=3y+1
x(y2)=3y+1x(y-2)=3y+1

Divide to isolate xx, then rewrite in terms of xx to state the inverse:

x=3y+1y2    f1(x)=3x+1x2x=\frac{3y+1}{y-2} \;\Rightarrow\; f^{-1}(x)=\frac{3x+1}{x-2}

Answer

f1(x)=3x+1x2f^{-1}(x)=\dfrac{3x+1}{x-2}, which excludes x=2x=2 (its denominator is zero there). Check with one value: f(4)=91=9f(4)=\dfrac{9}{1}=9, and f1(9)=287=4f^{-1}(9)=\dfrac{28}{7}=4, returning the original input.

Q3[4 marks]

The function ff is defined by f(x)=3x+kf(x)=3x+k, where kk is a constant. Given that f2(x)=9x+20f^{2}(x)=9x+20, find the value of kk.

Show worked solution

Here f2(x)f^{2}(x) means ff(x)=f(f(x))ff(x)=f(f(x)), the function composed with itself, not [f(x)]2[f(x)]^{2}. Substitute f(x)=3x+kf(x)=3x+k into ff once more:

f2(x)=f(3x+k)=3(3x+k)+kf^{2}(x)=f(3x+k)=3(3x+k)+k

Expand the bracket and collect like terms:

f2(x)=9x+3k+k=9x+4kf^{2}(x)=9x+3k+k=9x+4k

Match this with the given 9x+209x+20. The xx-terms already agree, so compare the constant terms:

4k=20    k=54k=20 \;\Rightarrow\; k=5

Answer

k=5k=5. Check: with f(x)=3x+5f(x)=3x+5, f2(x)=3(3x+5)+5=9x+15+5=9x+20f^{2}(x)=3(3x+5)+5=9x+15+5=9x+20, as required.

Q4[4 marks]

The functions ff and gg are defined by f(x)=x+1f(x)=x+1 and g(x)=2x23g(x)=2x^{2}-3. Find gf(x)gf(x) in its simplest form, then find the values of xx that satisfy gf(x)=15gf(x)=15.

Show worked solution

gf(x)gf(x) means g(f(x))g(f(x)), so substitute the whole of f(x)f(x) into gg wherever xx appears, then expand:

gf(x)=2(x+1)23=2x2+4x1gf(x)=2(x+1)^{2}-3=2x^{2}+4x-1

Set this equal to 15 and rearrange into ax2+bx+c=0ax^{2}+bx+c=0, then factorise:

2x2+4x1=15    x2+2x8=0    (x+4)(x2)=02x^{2}+4x-1=15 \;\Rightarrow\; x^{2}+2x-8=0 \;\Rightarrow\; (x+4)(x-2)=0
x+4=0    x=4orx2=0    x=2x+4=0 \;\Rightarrow\; x=-4 \qquad \text{or} \qquad x-2=0 \;\Rightarrow\; x=2

Answer

x=4x=-4 or x=2x=2. Check: f(4)=3f(-4)=-3 and g(3)=2(9)3=15g(-3)=2(9)-3=15; f(2)=3f(2)=3 and g(3)=2(9)3=15g(3)=2(9)-3=15, so both roots satisfy the equation.

Q5[3 marks]

The function ff is defined by f(x)=3x12f(x)=\dfrac{3x-1}{2}. Find the value of xx for which f1(x)=5f^{-1}(x)=5.

Show worked solution

You do not need the general formula for f1f^{-1} here. Since f1(x)=5f^{-1}(x)=5 means xx is the image of 5 under ff, apply ff directly to 5:

x=f(5)=3(5)12x=f(5)=\dfrac{3(5)-1}{2}
x=142=7x=\dfrac{14}{2}=7

Answer

x=7x=7. Check with the general inverse: rearranging y=3x12y=\dfrac{3x-1}{2} gives f1(x)=2x+13f^{-1}(x)=\dfrac{2x+1}{3}, and f1(7)=153=5f^{-1}(7)=\dfrac{15}{3}=5, confirming the shortcut.

Q6[4 marks]

The function ff is defined by f(x)=x24x+6f(x)=x^{2}-4x+6 for the domain 1x4-1\le x\le 4. Find the range of ff.

Show worked solution

Complete the square to locate the turning point, since that gives the smallest value the function can take:

f(x)=(x2)2+2f(x)=(x-2)^{2}+2

The minimum value is 2, occurring at x=2x=2, which lies inside the given domain. Because the graph opens upward, the largest value comes from whichever endpoint is farther from x=2x=2; check both:

f(1)=1+4+6=11f(4)=1616+6=6f(-1)=1+4+6=11 \qquad f(4)=16-16+6=6

Answer

Since x=1x=-1 is 3 units from the turning point and x=4x=4 is only 2 units away, the maximum is f(1)=11f(-1)=11. The range is 2f(x)112\le f(x)\le 11.

Q7[4 marks]

The function ff is defined by f(x)=ax+bf(x)=ax+b, where aa and bb are constants. Given that f(1)=4f(1)=4 and f(4)=13f(4)=13, find the value of aa and of bb.

Show worked solution

Substitute each given input into f(x)=ax+bf(x)=ax+b to form a pair of simultaneous equations:

a+b=44a+b=13a+b=4 \qquad 4a+b=13

Subtract the first equation from the second to eliminate bb, then back-substitute:

3a=9    a=3    b=43=13a=9 \;\Rightarrow\; a=3 \;\Rightarrow\; b=4-3=1

Answer

a=3a=3 and b=1b=1. Check: f(4)=3(4)+1=13f(4)=3(4)+1=13, matching the given value.

Q8[3 marks]

The functions ff and gg are defined by f(x)=2x5f(x)=2x-5 and g(x)=x+p2g(x)=\dfrac{x+p}{2}, where pp is a constant. Given that fg(x)=xfg(x)=x for all values of xx, find the value of pp.

Show worked solution

fg(x)=xfg(x)=x for every xx is exactly the condition that gg undoes ff, so gg must be f1f^{-1}. Build fg(x)fg(x) by substituting g(x)g(x) into ff:

fg(x)=2(x+p2)5=x+p5fg(x)=2\left(\dfrac{x+p}{2}\right)-5=x+p-5

For this to equal xx for every value of xx, the constant term must vanish:

p5=0    p=5p-5=0 \;\Rightarrow\; p=5

Answer

p=5p=5, so g(x)=x+52g(x)=\dfrac{x+5}{2} is exactly f1(x)f^{-1}(x). Check with one value: f(3)=1f(3)=1 and g(1)=1+52=3g(1)=\dfrac{1+5}{2}=3, returning the original input.

The thread running through all three is reversal. In the first you undo a composite to expose an inner function; in the second you undo a function to build its inverse; in the third you read a self-composite backwards to a single unknown.

Once you recognise that a question is really asking you to run a familiar step in reverse, the plan almost writes itself.

Key method points

These three examples share one habit: turn the question around and rearrange cleanly. Keep these points to hand as you practise.

  • To recover a hidden function from fg(x)fg(x), apply the outer rule to g(x)g(x), set the result equal to the given composite, then solve.
  • For an inverse, write y=f(x)y=f(x), make xx the subject, then swap to xx; the value the inverse excludes is where its denominator is zero.
  • Read f2(x)f^{2}(x) as ff(x)ff(x), the function applied twice, never as [f(x)]2[f(x)]^{2}.
  • When two expressions in xx must be equal for all xx, compare the xx-coefficients and the constants separately.
  • Confirm every answer with one clean substitution, it is the quickest guard against a slipped sign or a dropped bracket.

How a teacher helps

Medium Functions questions reward a clear plan more than clever algebra, and that is exactly what a lesson builds. Our teacher watches how you set the problem up, which function is inner, how you make xx the subject, and steps in the moment the plan goes astray, so you are not left rearranging in circles.

Because our teachers are experienced, you get someone who can show a second route when the first one feels stuck. Lessons are taught in English, while SPM papers are set in both Malay and English, so the notation stays familiar whichever version you sit.

Get 1-to-1 help.

Book a Trial Class

Frequently asked questions

How do I find a function hidden inside a composite?

Apply the known outer function to g(x)g(x) as if g(x)g(x) were its input, set that equal to the given composite, and solve for g(x)g(x). Always rebuild the composite at the end to check.

What value does an inverse function exclude?

The inverse is undefined where its own denominator is zero. For f1(x)=3x+1x2f^{-1}(x)=\dfrac{3x+1}{x-2}, that is x=2x=2.

This excluded value corresponds to a boundary of the original function's range.

Does f2(x)f^{2}(x) mean I square f(x)f(x)?

No. In this chapter f2(x)=ff(x)=f(f(x))f^{2}(x)=ff(x)=f(f(x)), the function applied twice.

So for f(x)=3x+5f(x)=3x+5, f2(x)=9x+20f^{2}(x)=9x+20, not (3x+5)2(3x+5)^{2}.

How do I compare two expressions that must be equal?

If px+q=9x+20px+q=9x+20 holds for all xx, then p=9p=9 and q=20q=20. Match the xx-coefficients and the constant terms separately; each comparison gives you one equation.

Source:SRC-DSKP-EN

Written by the spmaddmath.com.my editorial team.· Last updated 5 September 2026

Ready to get started?

Book a Trial Classfrom RM50/hr · One-hour paid trial · Same-day reply
Book a Trial ClassOne-hour paid trial · Same-day reply