FreeMathCamp
Course Articles

Free Math Camp

A free course in the maths you need before calculus. Short lessons, interactive visuals, practice that adapts to you, and a record of progress on your account.

freemathcamp.app

Made by Adam Richard Turner

hello@adamrichardturner.dev

Course

  • Foundations
  • Articles
  • Start free
  • Sign in

Legal

  • Privacy
  • Terms
  • Do not sell or share

Copyright © Adam Richard Turner. All rights reserved.

  1. Articles
  2. /
  3. Graphs & Functions
Graphs & Functions

Composite and Inverse Functions: f(g(x)) and f⁻¹(x) Explained

How to chain functions together and why the order matters, how to find an inverse by swapping xxx and yyy, and why the graph of an inverse is a reflection in the line y=xy = xy=x.

3 min read Supports 4 lessons
In short

A composite function f(g(x))f(g(x))f(g(x)) feeds the output of ggg into fff. An inverse function f−1f^{-1}f−1 undoes fff: if f(2)=7f(2) = 7f(2)=7, then f−1(7)=2f^{-1}(7) = 2f−1(7)=2.

Composite functions

Functions can be chained like machines on a production line. The output of the first becomes the input of the second. Feeding xxx into ggg and then the result into fff gives the composite f(g(x))f(g(x))f(g(x)), also written (f∘g)(x)(f \circ g)(x)(f∘g)(x).

x  →  g    g(x)  →  f    f(g(x))x \;\xrightarrow{\;g\;}\; g(x) \;\xrightarrow{\;f\;}\; f\big(g(x)\big)xg​g(x)f​f(g(x))
  1. f(x)=x2,g(x)=x+3f(x) = x^2, \quad g(x) = x + 3f(x)=x2,g(x)=x+3

    Find f(g(2))f(g(2))f(g(2)) and g(f(2))g(f(2))g(f(2)).

1/4
Watch out

Order matters. f(g(x))f(g(x))f(g(x)) means do ggg first. Work from the inside out.

You can compose with expressions too: f(g(x))=(x+3)2f(g(x)) = (x + 3)^2f(g(x))=(x+3)2 while g(f(x))=x2+3g(f(x)) = x^2 + 3g(f(x))=x2+3.

Inverse functions

An inverse function runs the machine backwards. If fff doubles a number and adds 111, its inverse subtracts 111 and halves. Applying a function and then its inverse returns you to where you started: f−1(f(x))=xf^{-1}(f(x)) = xf−1(f(x))=x.

Finding an inverse
y=f(x)  →swap x, y  x=f(y)  →solve for y  y=f−1(x)y = f(x) \;\xrightarrow{\text{swap } x,\,y}\; x = f(y) \;\xrightarrow{\text{solve for } y}\; y = f^{-1}(x)y=f(x)swap x,y​x=f(y)solve for y​y=f−1(x)
Worked example

Find the inverse of f(x)=3x−6f(x) = 3x - 6f(x)=3x−6.

  1. 1

    Write y=3x−6y = 3x - 6y=3x−6 and swap xxx and yyy.

    x=3y−6x = 3y - 6x=3y−6
Tip

Check: f(4)=6f(4) = 6f(4)=6 and f−1(6)=123=4f^{-1}(6) = \frac{12}{3} = 4f−1(6)=312​=4 ✓.

The graph of an inverse

Swapping xxx and yyy turns every point (a,b)(a, b)(a,b) on the graph of fff into (b,a)(b, a)(b,a) on the graph of f−1f^{-1}f−1. Geometrically, that is a reflection in the line y=xy = xy=x.

Mirror images in the line y=xy = xy=x.

When there is no inverse

A function only has an inverse if each output comes from just one input. f(x)=x2f(x) = x^2f(x)=x2 sends both 333 and −3-3−3 to 999, so "undo" would not know which to return. Restricting the domain to x≥0x \ge 0x≥0 fixes this, and then the inverse is x\sqrt{x}x​.

Watch out

f−1(x)f^{-1}(x)f−1(x) is not 1f(x)\frac{1}{f(x)}f(x)1​. The −1-1−1 here means "inverse function", not a power.

Key idea

Some of the most important functions are inverse pairs: squaring and square roots, exponentials and logarithms, sine and sin⁡−1\sin^{-1}sin−1.

Common questions

Does f(g(x)) equal g(f(x))?

Usually not. With f(x)=x2f(x) = x^2f(x)=x2 and g(x)=x+3g(x) = x + 3g(x)=x+3, f(g(x))=(x+3)2f(g(x)) = (x + 3)^2f(g(x))=(x+3)2 but g(f(x))=x2+3g(f(x)) = x^2 + 3g(f(x))=x2+3.

How do you find an inverse function?

Write y=f(x)y = f(x)y=f(x), swap xxx and yyy, then solve for yyy. The result is f−1(x)f^{-1}(x)f−1(x).

Practise composite and inverse functions

The Composite Functions lesson has worked examples and unlimited practice that adapts to you.

Open the lesson

On this page

  1. Composite functions
  2. Inverse functions
  3. The graph of an inverse
  4. When there is no inverse
  5. Common questions
Lessons on this
  • Composite FunctionsFunctions
  • Inverse FunctionsFunctions
  • LogarithmsExponentials & Logarithms
  • Solving Trig EquationsTrigonometry
Related reading10
Ideas this article builds on or leads to.
  • Graphs & Functions
    What Is a Function? Inputs, Outputs, f(x) and the Vertical Line Test

    A function is a rule that gives exactly one output for each input. Writing f(x)f(x)f(x) means "the output of the function fff when the input is xxx".

  • Algebra
    Rearranging Formulae: How to Change the Subject of a Formula

    Rearranging a formula means making a different letter its subject, the letter on its own on one side. You use the same balancing steps as solving an equation, treating the other letters as if they were numbers.

  • Exponentials & Logarithms
    What Is a Logarithm? Logs Explained Simply

    A logarithm is an exponent. log⁡bx\log_b xlogb​x asks: what power of $b$ gives $x$? Since 23=82^3 = 823=8, log⁡28=3\log_2 8 = 3log2​8=3.

  • Graphs & Functions
    Transformations of Graphs: Shifts, Stretches and Reflections

    A transformation moves or reshapes a graph. In y=a f(x−h)+ky = a\,f(x - h) + ky=af(x−h)+k, hhh shifts it right, kkk shifts it up, ∣a∣|a|∣a∣ stretches it vertically, and a negative aaa reflects it in the xxx-axis.

  • Algebra
    Algebraic Expressions: Variables, Terms, Coefficients and Like Terms

    An expression combines numbers and variables (letters standing for numbers) with operations, like 3x+53x + 53x+5. Like terms have exactly the same variable part and can be combined by adding their coefficients.

  • Graphs & Functions
    Domain and Range of a Function: How to Find Them

    The domain of a function is the set of inputs it accepts. The range is the set of outputs it actually produces.

  • Powers & Roots
    What Are Exponents? Powers, Bases and Repeated Multiplication

    An exponent (or power) says how many times to multiply a number, the base, by itself: 25=2×2×2×2×2=322^5 = 2 \times 2 \times 2 \times 2 \times 2 = 3225=2×2×2×2×2=32.

  • Powers & Roots
    Square Roots and Surds: Simplifying Radicals Step by Step

    The square root n\sqrt{n}n​ is the non-negative number that squares to nnn: 49=7\sqrt{49} = 749​=7. A root that cannot be written as a whole number or fraction, like 2\sqrt{2}2​, is called a surd (or radical).

  • Exponentials & Logarithms
    Exponential Growth and Decay: Formula, Graphs and Examples

    Exponential growth multiplies a quantity by the same factor every step, giving f(x)=a⋅bxf(x) = a \cdot b^xf(x)=a⋅bx. When the factor bbb is between 000 and 111, the quantity shrinks instead: exponential decay.

  • Trigonometry
    SOH CAH TOA: Sine, Cosine and Tangent in Right-Angled Triangles

    In a right-angled triangle, sine, cosine and tangent are ratios of sides that depend only on an angle: sin⁡θ=opphyp\sin\theta = \frac{\text{opp}}{\text{hyp}}sinθ=hypopp​, cos⁡θ=adjhyp\cos\theta = \frac{\text{adj}}{\text{hyp}}cosθ=hypadj​, tan⁡θ=oppadj\tan\theta = \frac{\text{opp}}{\text{adj}}tanθ=adjopp​. SOH CAH TOA is the memory aid.