Skip to content
mathismaths.com

Algebra · Lesson 15 of 16

Functions and Graphs

A function is a rule that turns each input into exactly one output. Its graph is a picture of every input–output pair.

What you will learn

  • Use function notation f(x).
  • Find domain and range, composite and inverse functions.
  • Recognise the graph of a function.

Before you start: you should know substitution and straight-line graphs. See Linear Equations.

The idea

A function is a machine: put a number in, apply a rule, get a number out. The crucial condition is that each input produces exactly one output. The rule “double it and add one” is a function; so is “square it”.

We name functions with letters and write

f(x)=2x+1f(x) = 2x + 1

read as ”ff of xx equals 2x+12x + 1”. Then f(3)f(3) means “put 33 into the machine”: f(3)=2(3)+1=7f(3) = 2(3) + 1 = 7.

Domain and range

  • The domain is the set of inputs allowed. For f(x)=xf(x) = \sqrt{x}, the domain is x≥0x \geq 0, because you cannot take the real square root of a negative number.
  • The range is the set of outputs the function actually produces. For g(x)=x2g(x) = x^2, the range is g(x)≥0g(x) \geq 0.
Sorted into groups: x, f(x) = x²x: -3, -2, -1, 0, 1, 2, 3. f(x) = x²: 9, 4, 1, 0, 1, 4, 9.x-3-2-10123f(x) = x²9410149
A table of values for f(x) = x squared. Outputs are never negative.

Graphs

Plot every input xx against its output f(x)f(x) and you get the graph y=f(x)y = f(x). The graph is a complete visual record of the function. A quick test: a curve is the graph of a function only if every vertical line crosses it at most once.

Coordinate grid with shapesA coordinate grid from -4 to 4 across and -1 to 10 up, showing 1 shape.-4-3-2-11234-112345678910
The graph of y = x squared is a U-shaped curve called a parabola, symmetric about the y-axis.

Transforming graphs

Small changes to the rule move the graph in predictable ways:

  • f(x)+3f(x) + 3 shifts the graph up 33.
  • f(x−3)f(x - 3) shifts it right 33 (note the opposite sign).
  • 2f(x)2f(x) stretches it vertically by factor 22.
  • −f(x)-f(x) reflects it in the xx-axis.

Worked examples

Example 1: Evaluating and solving

For f(x)=x2−4xf(x) = x^2 - 4x, find f(−2)f(-2) and solve f(x)=5f(x) = 5.

  1. Substitute: f(−2)=(−2)2−4(−2)=4+8=12f(-2) = (-2)^2 - 4(-2) = 4 + 8 = 12.
  2. To solve f(x)=5f(x) = 5, write x2−4x=5x^2 - 4x = 5, so x2−4x−5=0x^2 - 4x - 5 = 0.
  3. Factorise: (x−5)(x+1)=0(x - 5)(x + 1) = 0.

Answer: f(−2)=12f(-2) = 12; f(x)=5f(x) = 5 when x=5x = 5 or x=−1x = -1.

Example 2: Composite functions

Let f(x)=3x+1f(x) = 3x + 1 and g(x)=x2g(x) = x^2. Find f(g(2))f(g(2)) and g(f(2))g(f(2)).

  1. Work from the inside out. g(2)=4g(2) = 4, then f(4)=13f(4) = 13.
  2. For the other order: f(2)=7f(2) = 7, then g(7)=49g(7) = 49.

Answer: f(g(2))=13f(g(2)) = 13 and g(f(2))=49g(f(2)) = 49. Order matters.

Example 3: Finding an inverse

Find the inverse of f(x)=x+52f(x) = \dfrac{x + 5}{2}.

  1. Write y=x+52y = \dfrac{x + 5}{2}.
  2. Rearrange to make xx the subject: 2y=x+52y = x + 5, so x=2y−5x = 2y - 5.
  3. Swap the letters back to name the inverse: f−1(x)=2x−5f^{-1}(x) = 2x - 5.
  4. Check: f(3)=4f(3) = 4 and f−1(4)=3f^{-1}(4) = 3. ✓

Answer: f−1(x)=2x−5f^{-1}(x) = 2x - 5

The graph of an inverse function is the reflection of the original graph in the line y=xy = x.

Why it matters

Functions are how mathematics models the world. Temperature as a function of time, profit as a function of price, the height of a ball as a function of seconds since it was thrown. Every spreadsheet column calculated from another is a function, and every line of code that takes an input and returns a value is one too.

Functions are the objects that calculus studies. The derivative of a function describes its rate of change, and composite functions are exactly what the chain rule differentiates.

Practice

Your turn. Type or choose an answer, then press Check. Getting one wrong is fine, that is what practice is for. You can try as many times as you like.

Question 1 of 8

f(x)=2x+3f(x) = 2x + 3. Find f(4)f(4).

Question 2 of 8

f(x)=x2−1f(x) = x^2 - 1. Find f(−3)f(-3).

Question 3 of 8

f(x)=x+2f(x) = x + 2 and g(x)=3xg(x) = 3x. Find f(g(2))f(g(2)).

Question 4 of 8

With the same ff and gg, find g(f(2))g(f(2)).

Question 5 of 8

f(x)=2x+3f(x) = 2x + 3. Solve f(x)=11f(x) = 11.

Question 6 of 8

f(x)=x+5f(x) = x + 5. What is f−1(10)f^{-1}(10)?

Question 7 of 8

Which value must be excluded from the domain of f(x)=1xf(x) = \dfrac{1}{x}?

Choose one answer

Question 8 of 8

What is the range of f(x)=x2f(x) = x^2?

Choose one answer