IB Mathematics: Analysis and Approaches HL — Topic 2: Functions
Composite and Inverse Functions
Combine processes, follow their domains, then reverse the relationship.
Learning goal
Combine functions, determine their domains and ranges, and find and interpret inverse functions.
Syllabus link
SL 2.5 is common to AA SL and HL: composite functions, the identity function and inverses of one-to-one functions. Graph reflections revisit SL 2.2.
Big idea
Composition joins processes; an inverse reverses a process.
Key relationship
\((f\circ g)(x)=f(g(x))\): apply \(g\) first, then \(f\).
Composite functions: the order matters
A composite function is a function of a function: in \(f(g(x))\), the function \(f\) acts on \(g(x)\), the output of \(g\). In other words, the whole value \(g(x)\) becomes the input for \(f\).
Notation and terminology — read from the inside out
\[\boxed{f[g(x)]=f(g(x))=(f\circ g)(x).}\] All three are read “f of g of x” and mean the same thing: apply \(g\) first, then \(f\).
The symbol \(\circ\) denotes composition. Here \(g\) is the inner function, acting first, and \(f\) is the outer function, acting on the result.

Worked example 1 — evaluate in both orders
Let \(f(x)=2x+1\) and \(g(x)=x^2\).
Find \((f\circ g)(3)\).
Find \((g\circ f)(3)\).
Solution
(a) \(g(3)=3^2=9\), so \(f(g(3))=2(9)+1=\boxed{19}\).
(b) \(f(3)=2(3)+1=7\), so \(g(f(3))=7^2=\boxed{49}\).
The same two functions give different answers when their order is reversed.
The same method works on a graph
To find \(f(g(a))\), read \(g(a)\) from the graph of \(g\). Use this output as the new horizontal coordinate on the graph of \(f\), and read its output.
Two common mistakes
\(f(g(x))\) is not the product \(f(x)g(x)\). Also, \(f\circ g\) means \(g\) first: the symbol nearest to \(x\) acts first.
Tutorial: Evaluate a composite function
Evaluating a numerical input and finding an expression, using two methods.
Finding an expression for a composite function
To find \(f(g(x))\), replace every occurrence of \(x\) in the rule for \(f(x)\) by \(g(x)\). Then replace each \(g(x)\) by its expression and simplify. We are finding a function of a function, so the whole inner expression is the new input; use brackets where needed.
Worked example 2 — replace every \(x\) by \(g(x)\)
Let \(f(x)=2x^2-5x+7\) and \(g(x)=3x-1\).
Find an expression for \((f\circ g)(x)\).
Find an expression for \((g\circ f)(x)\).
Find \((f\circ g)(2)\).
Solution
(a) First write the rule using \(g(x)\). Replace both occurrences of \(x\) in \(f(x)=2x^2-5x+7\) by \(g(x)\): \[f(g(x))=2[g(x)]^2-5g(x)+7.\] Then substitute the expression for \(g(x)\). Since \(g(x)=3x-1\), \[\begin{aligned} f(g(x))&=2(3x-1)^2-5(3x-1)+7\\ &=18x^2-12x+2-15x+5+7\\ &=\boxed{18x^2-27x+14}. \end{aligned}\] (b) In the other order, replace \(x\) in \(g(x)=3x-1\) by \(f(x)\): \[\begin{aligned} g(f(x))&=3f(x)-1\\ &=3(2x^2-5x+7)-1\\ &=\boxed{6x^2-15x+20}. \end{aligned}\] (c) Using the expression from part (a), \[\begin{aligned}(f\circ g)(2)&=18(2)^2-27(2)+14\\&=\boxed{32}\end{aligned}\].
Check by stages: \(g(2)=5\), then \[\begin{aligned}f(5)&=2(5)^2-5(5)+7\\&=32\end{aligned}\].
Tutorial: Find an expression for a composite function
Several examples of replacing each input in the outer function.
Worked example 3 — a formula is not always needed
Use the table to answer the following questions.
| \(x\) | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| \(f(x)\) | 2 | 3 | 1 | 0 |
| \(g(x)\) | 1 | 0 | 3 | 2 |
Find \(f(g(0))\).
Find \(g(f(0))\).
Find \(f(f(1))\).
Solution
\[\begin{aligned} \textbf{(a)}\quad f(g(0))&=f(1)=\boxed{3},\\ \textbf{(b)}\quad g(f(0))&=g(2)=\boxed{3},\\ \textbf{(c)}\quad f(f(1))&=f(3)=\boxed{0}. \end{aligned}\] The first two answers happen to agree at \(x=0\). This does not prove that the two composite functions are equal for every input.
Domain and range: follow the input
For \((f\circ g)(a)=f(g(a))\), the number \(a\) travels through \(g\) first and then through \(f\). The middle value has two roles: it is an output of \(g\) and the next input for \(f\).

Start with \(a\) in the domain of \(g\). This makes the first step possible. Applying \(g\) produces the intermediate value \(g(a)\), which lies in the range of \(g\).
Check that \(g(a)\) belongs to the domain of \(f\). In this sketch, the whole range of \(g\) sits inside the domain of \(f\), so every intermediate output is accepted. Apply \(f\) to this number.
Arrive at \(f(g(a))\). This final value belongs to the range of \(f\). As \(a\) runs through all allowed starting inputs, the final values form the range of the composite function.
What the nested regions tell us
If \(\operatorname{Ran} g\subseteq\operatorname{Dom} f\), the whole journey is possible for every input of \(g\), so \(\operatorname{Dom}(f\circ g)=\operatorname{Dom} g\).
Only the inputs supplied by \(g\) reach the second function. Consequently, \[\boxed{\operatorname{Ran}(f\circ g)\subseteq\operatorname{Ran} f.}\] The composite may reach only part of the range of \(f\), as illustrated by the dashed inner region on the right. Equality is also possible.
Seeing the domain and range on graphs
Follow one input — then find all possible final outputs
Let \(g(x)=x+1\), \(0\leq x\leq2\), and \(f(x)=x^2\), \(x\in\mathbb{R}\).
Follow the input \(a=1\) through \(g\), then through \(f\).
Find the domain and range of \(f\circ g\).
Solution
\[\textbf{(a)}\quad\underbrace{1}_{a}\xrightarrow{\ g\ }\underbrace{2}_{g(a)} \xrightarrow{\ f\ }\underbrace{4}_{f(g(a))}.\] (b) For all starting inputs, \(g\) sends \([0,2]\) to \([1,3]\), and \(f\) squares these positive intermediate values to give \([1,9]\). Therefore \[\boxed{\begin{gathered}(f\circ g)(x)=(x+1)^2\\\operatorname{Dom}(f\circ g)=[0,2]\\\operatorname{Ran}(f\circ g)=[1,9].\end{gathered}}\] Here \(\operatorname{Ran} f=[0,\infty)\), but the composite only reaches \([1,9]\).
See the two stages. The middle value \(u=g(x)\) is the horizontal input in the sketch of \(f\). Filled endpoints show that the interval boundaries are included.
Stage 1: \(g(x)=x+1\)

\(\operatorname{Dom} g=[0,2]\), \(\operatorname{Ran} g=[1,3]\).
The marked interior point shows \(g(1)=2\).
Stage 2: \(f(u)=u^2\)

Full function: \(\operatorname{Dom} f=\mathbb{R}\), \(\operatorname{Ran} f=[0,\infty)\).
Solid part: inputs \([1,3]\), outputs \([1,9]\).
The composite: \((f\circ g)(x)=(x+1)^2\)

Read the domain horizontally.
The composite starts at \(x=0\) and ends at \(x=2\): its domain is \([0,2]\).
Read the range vertically.
Its lowest output is \(1\), and its highest is \(9\). Every value between them is reached: its range is \([1,9]\).
Why only part of the parabola?
Although \(f\) accepts every real input, \(g\) supplies only values from \(1\) to \(3\). Only the solid part of the sketch of \(f\) is used.
\[\begin{gathered}\text{Starting inputs }[0,2]\\\downarrow\ g\\\text{Middle values }[1,3]\\\downarrow\ f\\\text{Final outputs }[1,9]\end{gathered}\]
Checking domains in practice
If some outputs of \(g\) fall outside the domain of \(f\), only certain starting inputs complete the journey. Keep precisely those inputs for which both stages are possible.
Two checks for \(f\circ g\)
\[\boxed{\operatorname{Dom}(f\circ g)=\{x\in\operatorname{Dom} g:g(x)\in\operatorname{Dom} f\}.}\] Check 1: \(x\) is an allowed input for \(g\). Check 2: \(g(x)\) is an allowed input for \(f\).
To use \(f\circ g\) on all of \(\operatorname{Dom} g\), we need \(\operatorname{Ran} g\subseteq\operatorname{Dom} f\). Otherwise, restrict the input set to those values that pass both checks.
Worked example 4 — reversing the order changes the domain
Let \(f(x)=\sqrt{x}\), \(x\geq0\), and \(g(x)=x-3\), \(x\in\mathbb{R}\).
Find \((f\circ g)(x)\) and state its domain.
Find \((g\circ f)(x)\) and state its domain.
Solution
(a) The first stage \(g\) accepts every real number, but \(f\) requires its input \(g(x)=x-3\) to be non-negative. Thus \(x-3\geq0\), giving \[\boxed{\begin{gathered}(f\circ g)(x)=\sqrt{x-3}\\x\geq3.\end{gathered}}\]

(b) In the reverse order, \(g(f(x))=\sqrt{x}-3\). The square root requires \(x\geq0\), and subtracting 3 adds no restriction: \[\boxed{\begin{gathered}(g\circ f)(x)=\sqrt{x}-3\\x\geq0.\end{gathered}}\] For example, \(x=1\) is allowed in \(g\circ f\), but not in \(f\circ g\).
Worked example 5 — simplification can hide an excluded input
Let \(f(x)=1/x\), \(x\ne0\), and \(g(x)=1/(x-2)\), \(x\ne2\).
Find the domain of \(f\circ g\).
Find and simplify an expression for \((f\circ g)(x)\).
Solution
(a) The inner function requires \(x\ne2\). Its output \(1/(x-2)\) is never zero, so it is always accepted by \(f\). Thus \(\boxed{\operatorname{Dom}(f\circ g)=\mathbb{R}\setminus\{2\}}\).
(b) Substitute \(g(x)\) into \(f\), then simplify: \[f(g(x))=\frac{1}{\frac{1}{x-2}}=\boxed{x-2,\quad x\ne2}.\] Although the simplified expression \(x-2\) can be evaluated at 2, the original composition cannot: \(g(2)\) is undefined.
Keep the original restrictions
Find the domain before cancelling or simplifying. A cancelled factor does not restore an input that was originally excluded.
Working backwards: unknown coefficients
Sometimes the composite function is given and one of its components is unknown. Write the composition, expand, then compare matching coefficients.
Worked example 6 — two possible inner functions
The functions \(f\) and \(g\) are defined by \[f(x)=ax+b,\qquad g(x)=x^2-5x+6,\qquad a,b\in\mathbb{R}.\] Given that \((g\circ f)(x)=4x^2-6x+2\) for all \(x\in\mathbb{R}\), find both possible expressions for \(f(x)\).
Solution
First substitute \(f(x)\) into \(g\): \[\begin{aligned} g(f(x))&=(ax+b)^2-5(ax+b)+6\\ &=a^2x^2+a(2b-5)x+(b^2-5b+6). \end{aligned}\] Since the expressions agree for every real \(x\), their corresponding coefficients are equal: \[\begin{array}{c|c|c} \text{coefficient of }x^2&\text{coefficient of }x&\text{constant term}\\[2pt] \boxed{a^2=4}&\boxed{a(2b-5)=-6}&\boxed{b^2-5b+6=2} \end{array}\] The first equation gives \(a=2\) or \(a=-2\). Keep both possibilities.
| Case 1: \(a=2\) | Case 2: \(a=-2\) |
| \(2(2b-5)=-6\) | \(-2(2b-5)=-6\) |
| \(2b-5=-3\), so \(b=1\) | \(2b-5=3\), so \(b=4\) |
| Constant: \(1-5+6=2\) \(\checkmark\) | Constant: \(16-20+6=2\) \(\checkmark\) |
Hence the two possible functions are \[\boxed{f(x)=2x+1\quad\text{or}\quad f(x)=-2x+4.}\]
Tutorial: Composite function exam question
An unknown function, two possible answers and a hidden quadratic.
Inverse functions: reversing a process
An inverse reverses the input-output relationship of a function.
An inverse undoes a function
If \(f(a)=b\), then \(f^{-1}(b)=a\): the inverse takes the original output back to its input. To undo a sequence of operations, reverse their order and undo each operation.
Worked example 7 — reverse the order and the operations
Let \(f(x)=3x-5\), with domain \([1,4]\).
Find an expression for \(f^{-1}(x)\).
State the domain and range of \(f^{-1}\).
Find \(f^{-1}(7)\) and explain its meaning.
Solution
(a) Reverse the order and undo each operation:

Therefore \(\boxed{f^{-1}(x)=\dfrac{x+5}{3}}\).
(b) Since \(f\) is increasing, its endpoint values give its range: \[f(1)=-2,\qquad f(4)=7\quad\Longrightarrow\quad \operatorname{Ran} f=[-2,7].\] Thus \(\operatorname{Dom} f^{-1}=[-2,7]\) and \(\operatorname{Ran} f^{-1}=[1,4]\).
(c) \(f^{-1}(7)=4\) means that the input which produces an output of 7 is 4.
Domains and ranges swap
\[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=\operatorname{Ran} f\\\operatorname{Ran} f^{-1}=\operatorname{Dom} f.\end{gathered}}\] Here: \(\underbrace{[1,4]}_{\text{inputs of }f}\xrightarrow{\ f\ }\underbrace{[-2,7]}_{\text{outputs of }f}\), while \(f^{-1}\) travels back.
Tutorial: Inverse functions — full lesson
Meaning, algebra, graphs and domain/range; a complete revision lesson.
When does an inverse function exist?
An inverse function must assign exactly one output to each of its inputs. This is possible only when the original function is one-to-one: different inputs give different outputs.
The horizontal line test
A function is one-to-one if every horizontal line meets its graph at most once. If a line meets the graph twice, one output came from two different inputs, so reversing the arrows would give two outputs for one input.
\(f(x)=x^2,\quad x\in\mathbb{R}\)

\(f(-1)=f(1)=1\): not one-to-one.
\(g(x)=x^3,\quad x\in\mathbb{R}\)

Each output has one input: one-to-one.
Worked example 8 — restrict a domain to obtain an inverse
Consider \(f(x)=x^2\), initially with domain \(\mathbb{R}\).
Explain why \(f\) has no inverse function on this domain.
Give a domain restriction for which an inverse exists, and find that inverse.
Give a different domain restriction and find the corresponding inverse.
Solution
(a) The output 4 comes from both \(-2\) and 2. Reversing this would require the inverse to send 4 to two different outputs.
(b) Restrict to \(x\geq0\): each non-negative output comes from one non-negative input. Thus \[\boxed{f^{-1}(x)=\sqrt{x},\ x\geq0.}\]
(c) Restrict instead to \(x\leq0\): each non-negative output comes from one non-positive input. Thus \[\boxed{f^{-1}(x)=-\sqrt{x},\ x\geq0.}\]
Inverse is not reciprocal
The symbol \(f^{-1}\) names an inverse function; it does not mean \(1/f\). For example, if \(f(x)=3x-5\), then \[f^{-1}(x)=\frac{x+5}{3},\qquad\frac1{f(x)}=\frac1{3x-5}.\] These are different functions with different purposes.
Finding an inverse algebraically
A reliable method
1. Write \(y=f(x)\).2. Swap \(x\) and \(y\).3. Rearrange to make \(y\) the subject.
4. Write \(f^{-1}(x)\) and state its domain and range by swapping those of \(f\).
You may instead rearrange for \(x\) first, then swap the letters; both methods give the same result.
Worked example 9 — a cubic function
Let \(f(x)=(x-2)^3+1\), \(x\in\mathbb{R}\).
Find an expression for \(f^{-1}(x)\).
State the domain and range of \(f^{-1}\).
Solution
(a) This function is one-to-one. Start with \(y=(x-2)^3+1\): \[\begin{aligned} x&=(y-2)^3+1 &&\text{swap }x\text{ and }y,\\ x-1&=(y-2)^3 &&\text{subtract 1},\\ \sqrt[3]{x-1}&=y-2 &&\text{take the cube root},\\ y&=2+\sqrt[3]{x-1} &&\text{add 2}. \end{aligned}\] Thus \(\boxed{f^{-1}(x)=2+\sqrt[3]{x-1}}\). A real cube root has a unique real value; there is no \(\pm\) choice.
(b) The domain and range of \(f\) are both \(\mathbb{R}\), so \[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=\mathbb{R}\\\operatorname{Ran} f^{-1}=\mathbb{R}\end{gathered}}\].
Worked example 10 — a rational function
Let \(g(x)=\dfrac{2x+3}{x-1}\), \(x\ne1\).
Find an expression for \(g^{-1}(x)\).
State the domain and range of \(g^{-1}\).
Solution
(a) Swap the variables and rearrange: \[\begin{aligned} x&=\frac{2y+3}{y-1} &&\Longrightarrow& x(y-1)&=2y+3\\ xy-x&=2y+3 &&\Longrightarrow& y(x-2)&=x+3. \end{aligned}\] Therefore \[\boxed{g^{-1}(x)=\frac{x+3}{x-2}.}\] Check a pair: \(g(2)=7\), and \[\begin{aligned}g^{-1}(7)&=\frac{7+3}{7-2}\\&=2\end{aligned}\].
(b) Writing \(g(x)=2+5/(x-1)\) shows that its range is \(\mathbb{R}\setminus\{2\}\); every value other than 2 occurs exactly once. Swapping domain and range gives \[\boxed{\begin{gathered}\operatorname{Dom} g^{-1}=\mathbb{R}\setminus\{2\}\\\operatorname{Ran} g^{-1}=\mathbb{R}\setminus\{1\}.\end{gathered}}\]
Tutorial: Finding inverse expressions — four examples
Practise the swap-and-rearrange method with several functions.
Quadratic inverses: choose the correct branch
The domain restriction determines which half of a parabola is used. It also determines the range of the inverse, which tells us whether to choose plus or minus.
Worked example 11 — the same quadratic, two domain choices
Find each inverse, stating its domain and range.
\(f(x)=x^2-4x+7\), \(x\geq2\).
\(g(x)=x^2-4x+7\), \(x\leq2\).
Solution
For both parts, complete the square: \[\begin{aligned}x^2-4x+7&=(x-2)^2+3\end{aligned}\]. Both restricted functions have range \([3,\infty)\). After swapping \(x\) and \(y\), \[x=(y-2)^2+3\quad\Longrightarrow\quad(y-2)^2=x-3 \quad\Longrightarrow\quad y=2\pm\sqrt{x-3}.\] This is a choice of two branches, not yet a single inverse function.
| (a) For \(f\): inputs \(x\geq2\) | (b) For \(g\): inputs \(x\leq2\) |
| The inverse must output \(y\geq2\). | The inverse must output \(y\leq2\). |
| Choose \(y=2+\sqrt{x-3}\). | Choose \(y=2-\sqrt{x-3}\). |
| \(\boxed{f^{-1}(x)=2+\sqrt{x-3}}\) | \(\boxed{g^{-1}(x)=2-\sqrt{x-3}}\) |
| Domain \([3,\infty)\); range \([2,\infty)\). | Domain \([3,\infty)\); range \((-\infty,2]\). |

Solid: \(f\). Dashed curved branch: \(f^{-1}\).

Solid: \(g\). Dashed curved branch: \(g^{-1}\).
In each sketch, the pale diagonal is \(y=x\). The vertex \((2,3)\) becomes \((3,2)\).
Tutorial: Quadratic inverse — plus or minus?
Complete the square, then use the required range to select one branch.
The identity function and checking inverses by composition
The identity function leaves each input unchanged: \(\operatorname{id}(x)=x\). For example, \(\operatorname{id}(-3)=-3\). Composing a function with the appropriate identity leaves the function unchanged.
Inverse compositions give the identity
If \(f(a)=b\), then \(f^{-1}(b)=a\). For a one-to-one function \(f:D\to R\), where \(R\) is its range, \[\boxed{\begin{gathered}f^{-1}(f(x))=x\ (x\in D)\\f(f^{-1}(x))=x\ (x\in R).\end{gathered}}\] These are identity functions on the corresponding input sets.
A pair of inverse functions must undo each other in both orders, on the correct domains. State these domains when checking the identities.
Worked example 12 — a square root and its inverse
Let \(f(x)=\sqrt{x-1}+2\), \(x\geq1\).
Find an expression for \(f^{-1}(x)\).
State the domain and range of \(f^{-1}\).
Verify that \(f^{-1}(f(x))=x\), stating the domain on which this holds.
Verify that \(f(f^{-1}(x))=x\), stating the domain on which this holds.
Solution
(a) The square root is non-negative, so \(\operatorname{Ran} f=[2,\infty)\). Swapping \(x\) and \(y\), \[\begin{aligned} x&=\sqrt{y-1}+2,\\ x-2&=\sqrt{y-1} &&\text{so }x\geq2,\\ (x-2)^2&=y-1,\\ y&=(x-2)^2+1. \end{aligned}\] Thus \(\boxed{f^{-1}(x)=(x-2)^2+1}\).
(b) Swap the domain and range of \(f\): \[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=[2,\infty)\\\operatorname{Ran} f^{-1}=[1,\infty)\end{gathered}}\].
(c) For \(x\geq1\), \[\begin{aligned} f^{-1}(f(x)) &=\left(\sqrt{x-1}+2-2\right)^2+1\\ &=(x-1)+1=\boxed{x}. \end{aligned}\] (d) In the reverse order, for \(x\geq2\), \[\begin{aligned} f(f^{-1}(x)) &=\sqrt{(x-2)^2+1-1}+2\\ &=\sqrt{(x-2)^2}+2\\ &=|x-2|+2\\ &=(x-2)+2=\boxed{x},\qquad\text{because }x\geq2. \end{aligned}\] Both compositions give the identity, each on its appropriate domain.
Why the domain is essential
\(\sqrt{u^2}=|u|\), not always \(u\). Here \(x\geq2\) is what allows \(|x-2|\) to become \(x-2\).
If we wrongly extended the proposed inverse to \(x=0\), its formula would give 5, and then \(f(5)=4\ne0\). The inverse identity would fail.
A useful interpretation for equations
Solving \(f(x)=7\) is the same as finding \(f^{-1}(7)\). Here, \[\sqrt{x-1}+2=7\quad\Longrightarrow\quad x=f^{-1}(7)=(7-2)^2+1=26.\]
Sketching an inverse: reflect the whole graph
A graph is a collection of input-output pairs. Reversing every pair swaps its coordinates:
The point and reflection rules
\[\boxed{(a,b)\text{ on }y=f(x)\quad\Longleftrightarrow\quad(b,a)\text{ on }y=f^{-1}(x).}\] The graphs are reflections of each other in \(y=x\). Intercepts swap, and endpoint inclusion is preserved: a closed point stays closed and an open point stays open.
Worked example 13 — a sequence of sketches
The graph of \(f(x)=x^3+1\), \(-1\leq x\leq1\), passes through \((-1,0)\), \((0,1)\) and \((1,2)\).
Sketch \(f^{-1}\), showing the corresponding points.
State the domain and range of \(f^{-1}\).
Solution
(a) Swap the coordinates of each point, then reflect the curve as shown below.
| Point on \(f\) | \((-1,0)\) | \((0,1)\) | \((1,2)\) |
| Point on \(f^{-1}\) | \((0,-1)\) | \((1,0)\) | \((2,1)\) |
1. Mark the original points

2. Swap the coordinates

3. Reflect the curve

The solid curve is \(f\); the dashed curved graph is \(f^{-1}\). The faint diagonal is the mirror line \(y=x\). Use the same scale on both axes so that the reflection looks correct.
(b) Since \(\operatorname{Dom} f=[-1,1]\) and \(\operatorname{Ran} f=[0,2]\), \[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=[0,2]\\\operatorname{Ran} f^{-1}=[-1,1].\end{gathered}}\] The formula \(f^{-1}(x)=\sqrt[3]{x-1}\) confirms the sketch, but it was not needed to construct it.
Tutorial: Draw an inverse from the original graph
Swap marked points and intercepts, then reflect across \(y=x\).
Inverse graphs: vertical and horizontal asymptotes swap
A vertical line \(x=a\) reflects to the horizontal line \(y=a\). A horizontal line \(y=b\) reflects to the vertical line \(x=b\).
Swap the direction, keep the number
\[\begin{array}{ccc} f\text{: vertical asymptote }x=a&\longrightarrow&f^{-1}\text{: horizontal asymptote }y=a,\\[3pt] f\text{: horizontal asymptote }y=b&\longrightarrow&f^{-1}\text{: vertical asymptote }x=b. \end{array}\]
Worked example 14 — sketch first, then confirm algebraically
Let \(f(x)=1+\dfrac2{x-3}\), \(x\ne3\).
Sketch \(f^{-1}\), using asymptotes and points.
Find an expression for \(f^{-1}(x)\).
State the domain and range of \(f^{-1}\).
Solution
(a) Swap horizontal and vertical asymptotes, and reverse each point’s coordinates.
| Feature | \(f\) | \(f^{-1}\) |
|---|---|---|
| Vertical asymptote | \(x=3\) | \(x=1\) |
| Horizontal asymptote | \(y=1\) | \(y=3\) |
| Useful point | \((4,3)\) | \((3,4)\) |
| Useful point | \((5,2)\) | \((2,5)\) |
| Useful point | \((2,-1)\) | \((-1,2)\) |
Original graph

Reflected graph

(b) Swap \(x,y\): \(x=1+\dfrac2{y-3}\). Then \(y-3=\dfrac2{x-1}\), so \[\boxed{f^{-1}(x)=3+\frac2{x-1}.}\] (c) The original domain excludes 3 and the range excludes 1. Hence \[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=\mathbb{R}\setminus\{1\}\\\operatorname{Ran} f^{-1}=\mathbb{R}\setminus\{3\}.\end{gathered}}\]
Tutorial: Sketch an inverse by swapping asymptotes
Three worked examples combining graphical and algebraic methods.
Bringing algebra, domains and graphs together
An inverse question is often a connected sequence: establish the range, find the inverse expression, state its restrictions, then sketch.
Worked example 15 — a decreasing square-root function
Let \(f(x)=\sqrt{6-2x}-1\) on its largest real domain.
State the domain and range of \(f\).
Find \(f^{-1}\), giving its domain and range.
Sketch \(f\) and \(f^{-1}\) on the same axes.
Solution
(a) Domain and range of \(f\). The radicand must be non-negative: \[6-2x\geq0\quad\Longrightarrow\quad x\leq3.\] The square root is at least 0 and grows without bound as \(x\) decreases. Therefore \[\operatorname{Dom} f=(-\infty,3],\qquad\operatorname{Ran} f=[-1,\infty).\] The function is strictly decreasing, hence one-to-one.
(b) Find the inverse. Swap \(x\) and \(y\), then rearrange: \[\begin{aligned} x&=\sqrt{6-2y}-1,\\ x+1&=\sqrt{6-2y} &&\text{requires }x\geq-1,\\ (x+1)^2&=6-2y,\\ y&=3-\frac{(x+1)^2}{2}. \end{aligned}\] Thus \[\boxed{\begin{gathered}f^{-1}(x)=3-\frac{(x+1)^2}{2}\\x\geq-1\\\operatorname{Ran} f^{-1}=(-\infty,3].\end{gathered}}\]

(c) Sketches of \(f\) and \(f^{-1}\)
The endpoint \((3,-1)\) becomes \((-1,3)\).
The point \((1,1)\) lies on the mirror line, so it stays fixed.
The inverse is only the branch with \(x\geq-1\), not a complete parabola.
Solid: \(f\). Dashed curve: \(f^{-1}\). Pale diagonal: \(y=x\).
Tutorial: Inverse function — expression, graph, domain and range
A full lesson connecting all four features; useful after this example.
Self-inverse functions: a further application
A function is self-inverse if it equals its own inverse, with the same domain. Applying it twice returns the original input. This is a further application of the ideas in 2.5, suitable for SL and HL.
Two equivalent ways to recognise a self-inverse function
\[\boxed{f^{-1}=f}\qquad\Longleftrightarrow\qquad\boxed{f(f(x))=x\text{ for every allowed input}.}\] The function must map its domain onto itself. Its graph is unchanged by reflection in \(y=x\).
Worked example 16 — show that a function is self-inverse
Show that \(f(x)=\dfrac{x+3}{x-1}\), \(x\ne1\), is self-inverse.
Solution
Method 1: find the inverse. Start with \(y=(x+3)/(x-1)\) and swap the variables: \[\begin{aligned} x&=\frac{y+3}{y-1}\\ xy-x&=y+3\\ y(x-1)&=x+3\\ y&=\frac{x+3}{x-1}. \end{aligned}\] Since \(f(x)=1+4/(x-1)\), its range is \(\mathbb{R}\setminus\{1\}\). Thus the inverse has the same formula and the same domain as \(f\): \(\boxed{f^{-1}=f}\).
Method 2: compose the function with itself. For \(x\ne1\), \[f(f(x))= \frac{\frac{x+3}{x-1}+3}{\frac{x+3}{x-1}-1} =\frac{\frac{4x}{x-1}}{\frac4{x-1}} =\boxed{x}.\] The inner output is never 1, so the second application is defined.

The graph reflects onto itself. Its horizontal and vertical asymptotes are \(y=1\) and \(x=1\), which swap.
For example, \(f(2)=5\) and \(f(5)=2\).
A self-inverse function need not be the identity: it may interchange two different numbers.
Tutorial: Self-inverse functions
The definition, graphical meaning and two methods of verification.
Practice — build fluency
All questions in this lesson are non-calculator. Give exact answers and include domain restrictions where requested. Work on separate paper.
Let \(f(x)=3x-2\) and \(g(x)=x^2+1\), both with domain \(\mathbb{R}\).
Find \(f(g(-2))\) and \(g(f(-2))\).
Find expressions for \(f\circ g\) and \(g\circ f\).
Use the table to find \(f(g(2))\), \(g(f(1))\) and \(f(f(0))\).
\(x\) 0 1 2 3 \(f(x)\) 3 0 1 2 \(g(x)\) 2 3 0 1 Let \(f(x)=\sqrt{x+2}\), \(x\geq-2\), and \(g(x)=3x-1\), \(x\in\mathbb{R}\). Find both composite functions and their domains.
Let \(f(x)=1/(x-1)\), \(x\ne1\), and \(g(x)=x^2\), \(x\in\mathbb{R}\). Find \(f\circ g\) and \(g\circ f\), with their domains.
Let \(f(x)=5-2x\), with domain \([-1,3]\). Find its inverse and state the domain and range of the inverse.
Let \(f(x)=(x+1)^3-4\), \(x\in\mathbb{R}\). Find \(f^{-1}\), and then find \(f^{-1}(23)\).
Explain why \(f(x)=x^2+1\), \(x\in\mathbb{R}\), has no inverse function. Find the inverse when the domain is restricted to \(x\leq0\), and give its domain and range.
A one-to-one function has domain \([-2,4)\) and range \((1,7]\). Its graph contains the points \((-2,7)\) and \((1,3)\). State the inverse’s domain and range, and give the corresponding two points on its graph.
A function is defined by \(f(x)=2+3/(x+1)\), \(x\ne-1\). State the asymptotes of \(f^{-1}\), then find its expression and domain.
A student writes: “If \(f^{-1}(x)=1/f(x)\), then \(f(f^{-1}(x))=1\).” Explain both errors using \(f(x)=2x+3\) as an example.
Practice — connect the ideas
The functions \(g\) and \(f\) are defined by \(g(x)=x^2-4x+5\) and \(f(x)=ax+b\). Given that \[(g\circ f)(x)=9x^2+6x+2\] for all real \(x\), find both possible pairs \((a,b)\).
Let \(f(x)=x^2+6x+13\), with domain \(x\leq-3\).
Write \(f(x)\) in completed-square form and state its range.
Find \(f^{-1}\), giving its domain and range.
Verify that \(f^{-1}(f(x))=x\) for \(x\leq-3\). Explain the role of the domain restriction.
Mixed question [12 marks]
The function \(f\) is defined by \(f(x)=\sqrt{10-2x}-1\), on its largest real domain.
State the domain and range of \(f\). [2]
Find \(f^{-1}(x)\), giving its domain and range. [4]
Solve \(f(x)=3\). [2]
Sketch both graphs on the same axes. Label their endpoints, their axis intercepts and the line \(y=x\). [4]
Determine which of the following functions are self-inverse. Justify each answer algebraically. \[p(x)=6-x\quad(x\in\mathbb{R}),\qquad q(x)=\frac9x\quad(x\ne0),\qquad r(x)=2x\quad(x\in\mathbb{R}).\]
Let \(f(x)=\sqrt{x}\), \(x\geq0\), and \(g(x)=x^2\), \(x\in\mathbb{R}\).
Find \(f(g(x))\) and \(g(f(x))\), including their domains.
Explain why \(g\) is not the inverse of \(f\) with the stated domain of \(g\).
State a domain restriction on \(g\) that makes it the inverse of \(f\).
Before you check your answers
Have you followed the correct order? Kept all excluded inputs? Swapped domain and range? Chosen a single square-root branch? Labelled points and asymptotes on your sketches?
Answers — fluency questions
Question 1 — worked answer
(a) \(g(-2)=5\), so \(f(g(-2))=f(5)=\boxed{13}\).
\(f(-2)=-8\), so \(g(f(-2))=g(-8)=\boxed{65}\).
(b) \[\begin{aligned}f(g(x))&=3(x^2+1)-2\\&=\boxed{3x^2+1}\end{aligned}\].
\[\begin{aligned}g(f(x))&=(3x-2)^2+1\\&=\boxed{9x^2-12x+5}\end{aligned}\].
Question 2 — worked answer
\(f(g(2))=f(0)=\boxed3\), \(g(f(1))=g(0)=\boxed2\),
\(f(f(0))=f(3)=\boxed2\).
Question 3 — worked answer
\(f(g(x))=\boxed{\sqrt{3x+1}}\), requiring \(\boxed{x\geq-1/3}\).
\(g(f(x))=\boxed{3\sqrt{x+2}-1}\), requiring \(\boxed{x\geq-2}\).
Question 4 — worked answer
\(f(g(x))=\boxed{1/(x^2-1)}\), with \(\boxed{x\ne-1,1}\).
\(g(f(x))=\boxed{1/(x-1)^2}\), with \(\boxed{x\ne1}\).
Question 5 — worked answer
\(x=5-2y\) gives \(\boxed{f^{-1}(x)=(5-x)/2}\).
\(f(-1)=7\), \(f(3)=-1\), and \(f\) is decreasing. Hence
\[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=[-1,7]\\\operatorname{Ran} f^{-1}=[-1,3]\end{gathered}}\].
Question 6 — worked answer
\(x=(y+1)^3-4\) gives \(\boxed{f^{-1}(x)=\sqrt[3]{x+4}-1}\), with domain and range \(\mathbb{R}\). Then \(f^{-1}(23)=3-1=\boxed2\).
Question 7 — worked answer
\(f(-1)=f(1)=2\), so the original function is not one-to-one.
With original inputs \(x\leq0\), the inverse must output non-positive values: \[\boxed{\begin{gathered}f^{-1}(x)=-\sqrt{x-1}\\\operatorname{Dom} f^{-1}=[1,\infty)\\\operatorname{Ran} f^{-1}=(-\infty,0].\end{gathered}}\]
Question 8 — worked answer
\[\boxed{\begin{gathered}\operatorname{Dom} f^{-1}=(1,7]\\\operatorname{Ran} f^{-1}=[-2,4)\end{gathered}}\]. The corresponding points are \(\boxed{(7,-2)}\) and \(\boxed{(3,1)}\). Brackets are preserved when the sets swap.
Question 9 — worked answer
\(f\) has asymptotes \(x=-1\) and \(y=2\). Therefore the inverse has asymptotes \(\boxed{x=2}\) and \(\boxed{y=-1}\).
Rearranging \(x=2+3/(y+1)\) gives \[\boxed{\begin{gathered}f^{-1}(x)=\frac{3}{x-2}-1\\x\ne2\end{gathered}}\]. Its range is \(\mathbb{R}\setminus\{-1\}\).
Question 10 — worked answer
Inverse and reciprocal are different: here \(f^{-1}(x)=(x-3)/2\), while \(1/f(x)=1/(2x+3)\). Also, composition is not multiplication: \[f(f^{-1}(x))=2\left(\frac{x-3}{2}\right)+3=\boxed{x},\quad\text{not }1.\]
Answers — connected questions
Question 11 — worked answer
Expanding gives \[\begin{aligned}g(f(x))&=a^2x^2+a(2b-4)x\\&\quad+b^2-4b+5\end{aligned}\].
Thus \(a^2=9\), \(a(2b-4)=6\) and \(b^2-4b+5=2\).
If \(a=3\), then \(b=3\); if \(a=-3\), then \(b=1\). Both satisfy the constant equation.
Hence \(\boxed{(a,b)=(3,3)\text{ or }(-3,1)}\).
Question 12 — worked answer
(a) \(f(x)=(x+3)^2+4\), so the range is \(\boxed{[4,\infty)}\).
(b) \(y=-3\pm\sqrt{x-4}\). Since inverse outputs must satisfy \(y\leq-3\), choose \[\boxed{\begin{gathered}f^{-1}(x)=-3-\sqrt{x-4}\\x\geq4\\\operatorname{Ran} f^{-1}=(-\infty,-3].\end{gathered}}\] (c) \[\begin{aligned}f^{-1}(f(x))&=-3-\sqrt{(x+3)^2}\\&=-3-|x+3|\end{aligned}\]. Since \(x\leq-3\), \(|x+3|=-(x+3)\), giving \(-3+(x+3)=\boxed{x}\).
Question 13 — worked answer
(a) \(10-2x\geq0\) gives \(\boxed{\operatorname{Dom} f=(-\infty,5]}\); the range is \(\boxed{[-1,\infty)}\).
(b) Swap and rearrange: \(x+1=\sqrt{10-2y}\), so \[\boxed{\begin{gathered}f^{-1}(x)=5-\frac{(x+1)^2}{2}\\x\geq-1\\\operatorname{Ran} f^{-1}=(-\infty,5].\end{gathered}}\] (c) \[\begin{aligned}x&=f^{-1}(3)\\&=5-16/2\\&=\boxed{-3}\end{aligned}\].
(d) Endpoint pairs: \((5,-1)\leftrightarrow(-1,5)\). Intercepts swap: \[(9/2,0)\leftrightarrow(0,9/2),\qquad(0,\sqrt{10}-1)\leftrightarrow(\sqrt{10}-1,0).\]

Question 13(d): sketch guide
Solid: \(f\). Dashed curve: \(f^{-1}\). The diagonal is \(y=x\). Closed points mark included endpoints. The original curve continues to the left; the inverse continues downwards. Do not add the other half of the inverse parabola.
Question 14 — worked answer
\(p(p(x))=6-(6-x)=x\): \(\boxed{p\text{ is self-inverse}}\).
\(q(q(x))=9/(9/x)=x\) for \(x\ne0\): \(\boxed{q\text{ is self-inverse}}\).
\(r(r(x))=4x\), which is not \(x\) for all \(x\): \(\boxed{r\text{ is not self-inverse}}\).
Question 15 — worked answer
(a) \(\boxed{f(g(x))=|x|,\ x\in\mathbb{R}}\); \(\boxed{g(f(x))=x,\ x\geq0}\).
(b) The first composition fails to give \(x\) when \(x<0\). Also, an inverse of \(f\) must have domain \([0,\infty)\), the range of \(f\).
(c) Restrict \(g\) to \(\boxed{x\geq0}\). Then \(g=f^{-1}\).
Tutorial library and final checklist
The ten tutorials below are also linked beside their relevant lesson sections. Open a tutorial below or use its embedded player in the lesson. The labels describe each tutorial’s focus.
Evaluate a composite
Section 1: numerical evaluation and an expression.
Composite expressions
Section 2: substitution into the outer function.
Unknown function
Section 4: an exam question with two possible answers.
Inverse: full lesson
Section 5: meaning, expressions, graphs and sets.
Four inverse examples
Section 7: algebraic methods.
Quadratic inverse
Section 8: choosing plus or minus.
Draw an inverse
Section 10: reflect points and curves.
Swap asymptotes
Section 11: three rational-function examples.
Inverse: full lesson
Section 12: expression, graph, domain and range.
Self-inverse functions
Section 13: definition and verification.
What you should now be able to do
Read \(f\circ g\) in the correct order and evaluate from a formula, table or graph.
Find composite expressions and keep every domain restriction.
Explain the identity function and the meaning of an inverse.
Decide whether an inverse exists, and restrict a domain when needed.
Find an inverse algebraically and justify any square-root branch choice.
Swap domain and range, reflect points, and swap horizontal/vertical asymptotes.
Check inverse identities on their correct domains.
Connections
SL 2.2: functions, domain/range and the reflection interpretation.
SL 2.11: transformations help you recognise shifted parent graphs and their domains, ranges and asymptotes.
SL 5.6: recognising an inner and outer function prepares you for the chain rule.