Functions

A function is a rule that turns each input into exactly one output, written like f(x) = 3x + 1. Function notation makes it easy to talk about combining rules (composite functions) and undoing them (inverse functions).

Key facts

  • f(4) means substitute 4 into the function f.
  • The domain is the set of allowed inputs; the range is the set of outputs.
  • fg(x) means do g first, then f: fg(x) = f(g(x)).
  • The inverse f⁻¹(x) undoes f. Write y = f(x), swap x and y, and make y the subject.
  • Only one-to-one functions have an inverse; the graph of f⁻¹ is the reflection of the graph of f in y = x.
  • Leave out of the domain any x that makes you divide by 0 or take the square root of a negative.

Worked examples

Example 1

f(x) = 2x² − 3. Find f(−2), and solve f(x) = 47.

  1. Square first. f(−2) = 2 × 4 − 3 = 5
  2. Set f(x) = 47. 2x² − 3 = 47, so x² = 25
  3. Square root. x = 5 or x = −5

Answer: f(−2) = 5; x = ±5

Example 2

f(x) = 3x − 1 and g(x) = x² + 2. Find fg(2) and gf(x).

  1. Work out g(2) first. g(2) = 2² + 2 = 6
  2. Then put 6 into f. f(6) = 3 × 6 − 1 = 17
  3. gf(x): put f(x) into g. gf(x) = (3x − 1)² + 2
  4. Expand. 9x² − 6x + 1 + 2 = 9x² − 6x + 3

Answer: fg(2) = 17; gf(x) = 9x² − 6x + 3

Example 3

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

  1. Write y = f(x) and swap x and y. x = (2y + 5)/3
  2. Make y the subject. 3x = 2y + 5, so y = (3x − 5)/2

Answer: f⁻¹(x) = (3x − 5)/2

Example 4

Give the domain and range of f(x) = √(x − 4).

  1. Need x − 4 ≥ 0. x ≥ 4
  2. A square root is never negative. f(x) ≥ 0

Answer: Domain x ≥ 4; range f(x) ≥ 0

Example 5

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

  1. Put x = 4 into the function. 3 × 4 + 2 = 14

Answer: 14

Example 6

g(x) = x^2 − 1. Find g(−3).

  1. Put x = −3 into the function. (−3)^2 − 1 = 9 − 1 = 8

Answer: 8

Example 7

f(x) = 5x − 4. Solve f(x) = 21.

  1. Set the function equal to 21. 5x − 4 = 21
  2. Solve. 5x = 25, x = 5

Answer: x = 5

Example 8

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

  1. Work out f(3) first. f(3) = 7
  2. Then put it into g. g(7) = 49

Answer: 49

Example 9

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

  1. Write y = 4x − 3 and make x the subject. x = (y + 3)/4
  2. Write it as a function of x. f⁻¹(x) = (x + 3)/4

Answer: f⁻¹(x) = (x + 3)/4