Skip to content
spmaddmath.com.my
Tuition

Study

SyllabusFormulasMethodsExam & PapersTools
LocationsPricingBlogOur TeachersContact
EN

Worked examples · Functions

Functions, Worked Examples (KBAT)

These hard Functions examples combine ideas: inverting a composite and confirming the order-reversal rule (fg)1=g1f1(fg)^{-1}=g^{-1}f^{-1}, finding the inverse of a quadratic on a restricted domain, and solving for two constants from a self-composite ff(x)ff(x). Each is fully worked and checked.

What these examples cover

These hard Functions examples ask you to hold two ideas at once. You will invert a composite and confirm the order-reversal rule (fg)1=g1f1(fg)^{-1}=g^{-1}f^{-1}, complete the square to invert a quadratic on a restricted domain while tracking its range, and solve a pair of constants from a self-composite ff(x)ff(x).

The algebra stays clean, but the thinking is layered: a small slip early on travels all the way to the final line. Attempt each one in full, keep your brackets, and write the domain or excluded value as part of the answer, not as an afterthought.

We check every result by an independent route so you can trust the working before you rely on it.

Worked examples

Give each problem a genuine attempt before reading on. These reward a clear plan and careful bookkeeping of signs, domains and ranges.

Q1[6 marks]

Two functions are defined by f(x)=3x2f(x)=3x-2 and g(x)=x+12g(x)=\dfrac{x+1}{2}. (a) Find fg(x)fg(x) and hence (fg)1(x)(fg)^{-1}(x).

(b) Find f1(x)f^{-1}(x) and g1(x)g^{-1}(x), and verify that (fg)1(x)=g1f1(x)(fg)^{-1}(x)=g^{-1}f^{-1}(x).

Show worked solution

(a) fg(x)=f(g(x))fg(x)=f(g(x)), so substitute g(x)=x+12g(x)=\dfrac{x+1}{2} into ff:

fg(x)=3 ⁣(x+12)2=3x+322=3x+342=3x12fg(x)=3\!\left(\frac{x+1}{2}\right)-2=\frac{3x+3}{2}-2=\frac{3x+3-4}{2}=\frac{3x-1}{2}

To invert, let y=3x12y=\dfrac{3x-1}{2} and make xx the subject:

2y=3x1    3x=2y+1    x=2y+132y=3x-1 \;\Rightarrow\; 3x=2y+1 \;\Rightarrow\; x=\frac{2y+1}{3}
(fg)1(x)=2x+13(fg)^{-1}(x)=\frac{2x+1}{3}

(b) Invert each function separately. For ff, let y=3x2y=3x-2:

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

For gg, let y=x+12y=\dfrac{x+1}{2}:

2y=x+1    g1(x)=2x12y=x+1 \;\Rightarrow\; g^{-1}(x)=2x-1

Now build g1f1(x)=g1 ⁣(f1(x))g^{-1}f^{-1}(x)=g^{-1}\!\left(f^{-1}(x)\right) by feeding f1(x)=x+23f^{-1}(x)=\dfrac{x+2}{3} into g1g^{-1}:

g1f1(x)=2 ⁣(x+23)1=2x+431=2x+433=2x+13g^{-1}f^{-1}(x)=2\!\left(\frac{x+2}{3}\right)-1=\frac{2x+4}{3}-1=\frac{2x+4-3}{3}=\frac{2x+1}{3}

Answer

(fg)1(x)=2x+13(fg)^{-1}(x)=\dfrac{2x+1}{3} and g1f1(x)=2x+13g^{-1}f^{-1}(x)=\dfrac{2x+1}{3} are identical, confirming (fg)1=g1f1(fg)^{-1}=g^{-1}f^{-1}. The order reverses: to undo "do gg, then ff", undo ff first, then gg.

Check a value: fg(3)=82=4fg(3)=\dfrac{8}{2}=4 and (fg)1(4)=93=3(fg)^{-1}(4)=\dfrac{9}{3}=3.

Q2[7 marks]

The function ff is defined by f(x)=x26x+5f(x)=x^{2}-6x+5 for the domain x3x\geq 3. (a) Express f(x)f(x) in the form (xa)2+b(x-a)^{2}+b.

(b) State the range of ff. (c) Find f1(x)f^{-1}(x) and state its domain.

Show worked solution

(a) Complete the square. Half of 6-6 is 3-3, and (3)2=9(-3)^{2}=9:

f(x)=x26x+5=(x3)29+5=(x3)24f(x)=x^{2}-6x+5=(x-3)^{2}-9+5=(x-3)^{2}-4

(b) On the domain x3x\geq 3, the bracket x30x-3\geq 0, so (x3)20(x-3)^{2}\geq 0 and takes every value from 00 upward. Therefore f(x)4f(x)\geq -4, with the minimum 4-4 reached at x=3x=3.

Range: f(x)4\text{Range: } f(x)\geq -4

(c) To invert, set y=(x3)24y=(x-3)^{2}-4 and make xx the subject:

(x3)2=y+4    x3=±y+4(x-3)^{2}=y+4 \;\Rightarrow\; x-3=\pm\sqrt{y+4}

Because the domain is x3x\geq 3, we have x30x-3\geq 0, so take the positive square root only:

x=3+y+4    f1(x)=3+x+4x=3+\sqrt{y+4} \;\Rightarrow\; f^{-1}(x)=3+\sqrt{x+4}

Answer

f(x)=(x3)24f(x)=(x-3)^{2}-4; range f(x)4f(x)\geq -4; f1(x)=3+x+4f^{-1}(x)=3+\sqrt{x+4} with domain x4x\geq -4, because the domain of the inverse is the range of ff. Check: f(7)=4942+5=12f(7)=49-42+5=12 and f1(12)=3+16=3+4=7f^{-1}(12)=3+\sqrt{16}=3+4=7.

Q3[6 marks]

The function ff is defined by f(x)=ax+bf(x)=ax+b, where a>0a>0 and bb are constants. Given that f2(x)=4x+9f^{2}(x)=4x+9, find the values of aa and bb, and hence find f1(x)f^{-1}(x).

Show worked solution

f2(x)=ff(x)=f(ax+b)f^{2}(x)=ff(x)=f(ax+b). Substitute the whole of ax+bax+b into ff:

f2(x)=a(ax+b)+b=a2x+ab+bf^{2}(x)=a(ax+b)+b=a^{2}x+ab+b

Compare with 4x+94x+9. The coefficients of xx give a2=4a^{2}=4, and since a>0a>0 we take the positive root:

a2=4    a=2(a>0)a^{2}=4 \;\Rightarrow\; a=2 \quad (a>0)

Compare the constant terms, ab+b=9ab+b=9, factorise, and substitute a=2a=2:

b(a+1)=9    3b=9    b=3b(a+1)=9 \;\Rightarrow\; 3b=9 \;\Rightarrow\; b=3

So f(x)=2x+3f(x)=2x+3. To find the inverse, let y=2x+3y=2x+3 and make xx the subject:

2x=y3    f1(x)=x322x=y-3 \;\Rightarrow\; f^{-1}(x)=\frac{x-3}{2}

Answer

a=2a=2, b=3b=3, and f1(x)=x32f^{-1}(x)=\dfrac{x-3}{2}. Check: with f(x)=2x+3f(x)=2x+3, f2(x)=2(2x+3)+3=4x+6+3=4x+9f^{2}(x)=2(2x+3)+3=4x+6+3=4x+9; and f1(f(x))=(2x+3)32=xf^{-1}(f(x))=\dfrac{(2x+3)-3}{2}=x.

Q4[5 marks]

Two functions are defined by g(x)=2x+1g(x)=2x+1 and fg(x)=4x2+4x+3fg(x)=4x^{2}+4x+3. Find f(x)f(x).

Show worked solution

Since fg(x)=f(g(x))fg(x)=f(g(x)), the whole expression must be rewritten purely in terms of g(x)g(x). Start by completing the square on the right-hand side:

4x2+4x+3=(2x+1)2+24x^{2}+4x+3=(2x+1)^{2}+2

The bracket (2x+1)2(2x+1)^{2} is exactly [g(x)]2[g(x)]^{2}, since g(x)=2x+1g(x)=2x+1. Substitute:

fg(x)=[g(x)]2+2fg(x)=[g(x)]^{2}+2

Comparing both sides, whatever is applied to g(x)g(x) is the rule for ff: square the input, then add 22.

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

Answer

f(x)=x2+2f(x)=x^{2}+2. Check with x=2x=2: g(2)=5g(2)=5 and f(5)=25+2=27f(5)=25+2=27, which matches fg(2)=4(4)+4(2)+3=27fg(2)=4(4)+4(2)+3=27 directly.

Q5[5 marks]

The function ff is defined by f(x)=x2f(x)=\sqrt{x-2}, where ff is only defined for x2x\geq 2. The function gg is defined by g(x)=x23g(x)=x^{2}-3 for all real xx.

Find fg(x)fg(x) in its simplest form, and state the set of values of xx for which fg(x)fg(x) is defined.

Show worked solution

Build fg(x)=f(g(x))fg(x)=f(g(x)) by substituting g(x)=x23g(x)=x^{2}-3 into ff:

fg(x)=(x23)2=x25fg(x)=\sqrt{(x^{2}-3)-2}=\sqrt{x^{2}-5}

This is only defined where the input to ff, which is g(x)g(x), satisfies ff's own condition g(x)2g(x)\geq 2:

x232    x25x^{2}-3\geq 2 \;\Rightarrow\; x^{2}\geq 5

Solve this inequality by taking square roots on both sides, keeping both branches since x25x^{2}\geq 5 allows xx to be large positive or large negative:

x5   or   x5x\leq -\sqrt{5} \;\text{ or }\; x\geq \sqrt{5}

Answer

fg(x)=x25fg(x)=\sqrt{x^{2}-5}, defined for x5x\leq -\sqrt{5} or x5x\geq \sqrt{5}. Check x=3x=3: g(3)=6g(3)=6, which is 2\geq 2, so f(6)=4=2f(6)=\sqrt{4}=2; directly, 95=4=2\sqrt{9-5}=\sqrt{4}=2.

Check x=1x=1: g(1)=2g(1)=-2, which fails g(x)2g(x)\geq2, and indeed 11 lies outside the stated set.

Q6[6 marks]

The function ff is defined by f(x)=2x+1x3f(x)=\dfrac{2x+1}{x-3}, where x3x\neq 3. Find f1(x)f^{-1}(x), and state the value of xx that must be excluded from the domain of f1f^{-1}.

Show worked solution

Let y=f(x)y=f(x) and clear the fraction by multiplying both sides by (x3)(x-3):

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

Expand, then collect every term containing xx on one side:

xy3y=2x+1    xy2x=3y+1xy-3y=2x+1 \;\Rightarrow\; xy-2x=3y+1

Factorise out xx, then divide to make xx the subject:

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

Answer

f1(x)=3x+1x2f^{-1}(x)=\dfrac{3x+1}{x-2}, with x2x\neq 2 excluded, this is because the domain of f1f^{-1} is the range of ff, and ff never reaches y=2y=2 (its horizontal asymptote). Check: f(4)=91=9f(4)=\dfrac{9}{1}=9, and f1(9)=287=4f^{-1}(9)=\dfrac{28}{7}=4.

Q7[6 marks]

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

Show worked solution

Complete the square to locate the vertex. Half of 4-4 is 2-2, and (2)2=4(-2)^{2}=4:

f(x)=x24x+1=(x2)24+1=(x2)23f(x)=x^{2}-4x+1=(x-2)^{2}-4+1=(x-2)^{2}-3

The vertex is at x=2x=2, which lies inside the given domain 0x50\leq x\leq 5, so the minimum value 3-3 is actually reached, at x=2x=2.

Because the domain is a closed interval rather than an unbounded one, the maximum is not automatic, it must be checked at both endpoints:

f(0)=(02)23=1,f(5)=(52)23=6f(0)=(0-2)^{2}-3=1, \qquad f(5)=(5-2)^{2}-3=6

x=5x=5 is farther from the vertex x=2x=2 than x=0x=0 is, so it gives the larger value. The maximum on this domain is 66, at x=5x=5.

Range: 3f(x)6\text{Range: } -3\leq f(x)\leq 6

Answer

Range: 3f(x)6-3\leq f(x)\leq 6. Check an interior point: f(1)=(12)23=2f(1)=(1-2)^{2}-3=-2, which sits between the minimum 3-3 and the value at the near endpoint f(0)=1f(0)=1, exactly as the shape of the parabola requires.

Q8[5 marks]

Two functions are defined by f(x)=2xkf(x)=2x-k and g(x)=x2+1g(x)=x^{2}+1, where kk is a constant. Given that fg(3)=17fg(3)=17, find the value of kk, and hence find gf(x)gf(x) in its simplest form.

Show worked solution

First evaluate g(3)g(3), since fg(3)=f(g(3))fg(3)=f(g(3)):

g(3)=32+1=10g(3)=3^{2}+1=10

Substitute into ff and set the result equal to 1717:

fg(3)=f(10)=2(10)k=20k=17    k=3fg(3)=f(10)=2(10)-k=20-k=17 \;\Rightarrow\; k=3

So f(x)=2x3f(x)=2x-3. Now build gf(x)=g(f(x))gf(x)=g(f(x)) by substituting f(x)=2x3f(x)=2x-3 into gg:

gf(x)=(2x3)2+1=4x212x+9+1=4x212x+10gf(x)=(2x-3)^{2}+1=4x^{2}-12x+9+1=4x^{2}-12x+10

Answer

k=3k=3 and gf(x)=4x212x+10gf(x)=4x^{2}-12x+10. Check: with k=3k=3, g(3)=10g(3)=10 and f(10)=2(10)3=17f(10)=2(10)-3=17, matching the given value.

Also gf(0)=g(3)=10gf(0)=g(-3)=10, which matches 4(0)0+10=104(0)-0+10=10 from the formula.

In each of these, the marks live in the details a rushed solution drops: the sign chosen from the domain, the stated range that becomes the inverse's domain, and the condition a>0a>0 that makes the answer unique. Layered questions are not harder ideas, they are the same ideas kept honest through one more step.

Key method points

Hard Functions questions stack familiar steps, so the marks go to whoever keeps each layer tidy and states domains and excluded values in full.

  • The inverse of a composite reverses the order of the functions: (fg)1=g1f1(fg)^{-1}=g^{-1}f^{-1}.
  • To invert a quadratic, complete the square first, then solve for xx; the domain restriction decides which square root to keep.
  • The domain of f1f^{-1} is the range of ff, and the range of f1f^{-1} is the domain of ff, always state it.
  • When a self-composite produces a2x+a^{2}x+\ldots, a stated condition such as a>0a>0 selects the correct root.
  • For an equality that holds for all xx, match the xx-coefficients and the constants to form separate equations.
  • Every result here checks by an independent route, a test value, or composing the inverse back to xx.

How a teacher helps

Hard Functions questions rarely fail because a step is unknown; they fail because two correct ideas get tangled, a square root taken with the wrong sign, or a domain left unstated. In a one-to-one lesson our teacher slows the moment the layers meet, so you decide the sign from the domain rather than guessing it.

Because our teachers are experienced, you work with someone who models the independent check that catches a slip before it reaches the final marks. Lessons are taught in English, while SPM papers are set in both Malay and English, so the notation reads the same in either version.

Get 1-to-1 help.

Book a Trial Class

Frequently asked questions

Why is (fg)1(fg)^{-1} equal to g1f1g^{-1}f^{-1} and not f1g1f^{-1}g^{-1}?

Undoing a composite reverses the order of the steps. Since fgfg does gg first then ff, the inverse must undo ff first then gg, which is g1f1g^{-1}f^{-1}.

You can always confirm it with a test value.

When I invert a quadratic, which square root do I keep?

The one allowed by the restricted domain. For f(x)=(x3)24f(x)=(x-3)^{2}-4 with x3x\geq 3, we need x30x-3\geq 0, so x=3+x+4x=3+\sqrt{x+4} uses the positive root only.

How do I find the domain of an inverse function?

The domain of f1f^{-1} is exactly the range of ff. Find the range of ff first, often quickest from a completed-square form, and carry it across as the inverse's domain.

How does the condition a>0a>0 help when a2=4a^{2}=4?

The equation a2=4a^{2}=4 gives a=2a=2 or a=2a=-2. The stated condition a>0a>0 rules out 2-2, leaving a=2a=2.

Such conditions are given precisely to make the answer unique.

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