📘 CodingMarble Learn

Functions: Composite, Inverse and Standard Graphs

A function is a rule that gives exactly one output for each allowed input. The allowed inputs are the domain; the outputs are the range. Two functions can be joined: g(f(x)) means do f first, then g. An inverse function f⁻¹ undoes f, and its graph is the mirror image of the graph of f in the line y = x. Only one-to-one functions have an inverse.

🎬 Step-by-step story

  1. A function is a machine. Put in x = 3. The rule 2x acts. Out comes 6. Each input gives only one output.
  2. Some inputs are not allowed. The machine 1/x cannot take 0. The allowed inputs are called the domain.
  3. Join two machines. First f doubles 3 to 6. Then g adds 3, giving 9. This is the composite g(f(3)) = 9.
  4. The inverse machine runs backwards. It takes 9, subtracts 3, halves it, and gives back 3. It undoes f.
  5. Draw both graphs. The line y = 2x and its inverse y = x/2 are mirror images in the line y = x.
  6. Your turn. Pick f and g, slide x, and swap the order. See that g(f(x)) and f(g(x)) are often different.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why can't one input give two outputs?

Then the machine would not know which answer to give, and f(x) would not mean one number. Watch the ball in step 1: one ball in, one ball out.

Why is 0 not allowed in 1/x?

Dividing by 0 has no answer. In step 2 the ball for 0 bounces off the machine.

Why do g(f(x)) and f(g(x)) give different answers?

Doubling then adding 3 is not the same as adding 3 then doubling. In free play, swap f and g to see the numbers change.

How does the inverse know what to do?

It does the opposite steps in the opposite order: f doubles, so f⁻¹ halves. See the ball run backwards in step 4.

Why is the inverse graph a reflection?

The inverse swaps every input and output, so the point (2, 4) becomes (4, 2). Swapping x and y flips the picture over y = x, as in step 5.

Why does x² need a smaller domain to have an inverse?

2 and −2 both give 4, so the inverse would not know which to return. Pick f = x² (x ≥ 0) in free play: only x ≥ 0 passes.

What is a function?

A function is a rule. You give it a number (the input). It gives back one number (the output). We write f(x), read "f of x".

One input must never give two outputs. Two inputs may give the same output. That is fine.

A function can be shown in four ways: a rule (f(x) = 2x + 1), a table of values, a graph, or arrows between two sets. On a graph, use the vertical line test: if any up-down line cuts the graph twice, it is not a function.

Domain and range

The domain is the set of inputs that are allowed. The range is the set of outputs you can get.

Two rules to find the domain: never divide by zero, never take the square root of a negative number.

Standard functions and their graphs

Learn these shapes. Most questions use them.

A family of functions is a group with the same shape. y = x² + c moves the U up or down. y = (x − a)² moves it right by a. y = k·x² makes it narrower or wider.

From a graph you can read: where the function is increasing or decreasing, its maximum or minimum, and its zeros (where it cuts the x-axis).

Composite functions

A composite function joins two machines. g(f(x)), also written (g∘f)(x), means: do f first, then g.

Example: f(x) = 2x, g(x) = x + 3.

They are different! Order matters. Also, the output of f must be in the domain of g, or g(f(x)) is not defined.

Inverse functions

The inverse f⁻¹ undoes f. If f(3) = 6, then f⁻¹(6) = 3. So f⁻¹(f(x)) = x.

How to find it:

  1. Write y = f(x).
  2. Swap x and y.
  3. Make y the subject.

Example: y = 2x + 3 → x = 2y + 3 → y = (x − 3)/2. So f⁻¹(x) = (x − 3)/2.

Only a one-to-one function has an inverse (each output comes from just one input). Use the horizontal line test. y = x² fails it, so we restrict the domain to x ≥ 0; then its inverse is √x.

The graph of f⁻¹ is the reflection of the graph of f in the line y = x. The domain of f becomes the range of f⁻¹, and the other way round.

Note: f⁻¹(x) is not 1/f(x). The reciprocal 1/x happens to be its own inverse, but that is special.

Modelling with functions

Functions describe real situations. A phone plan: cost C(n) = 199 + 2n for n extra GB. A company's cost function C(q) = fixed cost + cost per item × q. Its revenue R(q) = price × q. Profit P(q) = R(q) − C(q). The break-even point is where P(q) = 0.

Steps: name the input and output, write the rule, state a sensible domain (you cannot make −5 items), then use the graph to answer questions.

Try it

In the 3D, choose f = x + 3 and g = 2x. Set x = 1. Predict g(f(1)) and f(g(1)) first, then check. At home: write your own "think of a number" trick (double it, add 5...). Then write the inverse steps that get back the starting number.

Key formulas and definitions

Worked examples

1. f(x) = 3x − 1. Find f(4) and f(−2).

f(4) = 3 × 4 − 1 = 11. f(−2) = 3 × (−2) − 1 = −7.

2. Find the domain of f(x) = 1/(x − 5).

The bottom cannot be 0, so x − 5 ≠ 0, so x ≠ 5. Domain: all real numbers except 5.

3. f(x) = x², g(x) = x + 1. Find g(f(2)) and f(g(2)).

f(2) = 4, so g(f(2)) = 4 + 1 = 5. g(2) = 3, so f(g(2)) = 3² = 9. Different answers: order matters.

4. Find the inverse of f(x) = (x + 4)/3.

y = (x + 4)/3. Swap: x = (y + 4)/3. Multiply by 3: 3x = y + 4. So y = 3x − 4. f⁻¹(x) = 3x − 4. Check: f(2) = 2, and f⁻¹(2) = 2. ✓

5. f(x) = 2x + 1, g(x) = x². Find an expression for f(g(x)) and solve f(g(x)) = 19.

f(g(x)) = 2x² + 1. Set 2x² + 1 = 19, so 2x² = 18, x² = 9, x = 3 or x = −3.

6. A bakery has fixed cost ₹2000 a day and each cake costs ₹150 to make. Cakes sell for ₹250. Find the profit function and the break-even number.

C(q) = 2000 + 150q. R(q) = 250q. P(q) = 250q − (2000 + 150q) = 100q − 2000. Break-even: 100q − 2000 = 0, q = 20 cakes.

Common mistakes

Practice quiz

1. If f(x) = x + 5, what is f(2)?
2. Which number is NOT in the domain of f(x) = 1/x?
3. In g(f(x)), which function acts first?
4. The graph of f⁻¹ is the reflection of f in:
5. The inverse of f(x) = x − 7 is:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is a composite function?

A function made by applying one function to the output of another: g(f(x)) means do f first, then g.

How do you find the inverse of a function?

Write y = f(x), swap x and y, and solve for y. The result is f⁻¹(x). It exists only if f is one-to-one.

What is the difference between domain and range?

The domain is all the inputs you may use; the range is all the outputs the function actually gives.

Where this is taught

NetherlandsVWO 4 (bovenbouw, 2e fase)Relationships (part 1)
NetherlandsVWO 5Relationships
PolandLiceum ogólnokształcące, klasa IIFunctions
RomaniaClasa a IX-aAlgebra: Functions via graph reading
RomaniaClasa a IX-aAlgebra: Functions via graph reading
South Korea중학교 2학년Linear functions
South Korea고등학교 1학년Functions and graphs
South Korea고등학교 1학년Functions and graphs
South Korea고등학교 2학년Functions and the economy
South Korea고등학교 2학년Change and relationships
South Korea고등학교 3학년Functions and economy
FrancePremièreMathematics (2026 programme)
FranceTerminaleMathematics
FranceTerminaleMathematics
FranceTerminaleMathematics (2019 programme)

Learn first

Learn next

Related lessons

All Maths lessons