Functions · Lesson 2 of 2

Domain and range

Which inputs a function accepts and which outputs it gives: division by zero, square roots and logarithms; reading a range; and why the domain of an inverse is the range of the function.

16 minYou should already know: Expressions, formulae & change of subject
  1. 1
  2. 2

Lesson 1 put numbers and expressions into functions without asking whether every input is allowed. Some are not: you can’t divide by zero, for example. This lesson names the allowed inputs and the outputs, and shows why the two matter for inverses.

Domain and range

  • The domain is the set of inputs the function accepts.
  • The range is the set of outputs it actually gives.
domainrange−2−1012014f(x) = x²: every input has one output
From domain to rangeEach input has exactly one output

A function must give one output for each input. Two inputs may share an output, as −2-2 and 22 both go to 4 here.

Finding the domain: three things to avoid

For a function on the real numbers, the domain is every xx except those that break one of these rules:

  1. Division by zero. Leave out the xx values that make a denominator zero.
  2. Square roots of negatives. What is under  \sqrt{\ } must be ≥0\ge 0.
  3. Logarithms of zero or negatives. What is inside log⁡\log must be >0> 0.

So a fraction is undefined exactly where its bottom is zero. Factorise the bottom and make each bracket zero.

More: where a function is undefined

Worked example · WAEC 2014

WAEC 2014 · Paper 2 · Q1

Given f(y)=log⁡2(y+1y+3)f(y) = \log_2\left(\dfrac{y + 1}{y + 3}\right):

find the domain of f(y)f(y);

solve f(y)=1f(y) = 1.

  1. The rule for logs

    • A logarithm is defined only for positive numbers.
    • So y+1y+3>0{\frac{y + 1}{y + 3} > 0}.

    Think first. What must be true of the number inside the log?

  2. When is a fraction positive?

    • Both positive: y+1>0{y + 1 > 0} and y+3>0{y + 3 > 0}, which means y>−1{y > -1}.
    • Both negative: y+1<0{y + 1 < 0} and y+3<0{y + 3 < 0}, which means y<−3{y < -3}.
    • So the domain is {y:y<−3 or y>−1}{\{y : y < -3 \text{ or } y > -1\}}.

    Think first. The top and bottom must have the same sign. When are both positive? Both negative?

  3. Solve f(y) = 1

    • log⁡2y+1y+3=1{\log_2\frac{y + 1}{y + 3} = 1} means y+1y+3=21=2{\frac{y + 1}{y + 3} = 2^1 = 2}.
    • Multiply by y+3y + 3: y+1=2y+6{y + 1 = 2y + 6}.
    • Take y+6y + 6 from both sides: y=−5{y = -5}.

    Think first. Write log₂(…) = 1 without the log.

  4. Check against the domain

    • −5<−3{-5 < -3}, so y=−5y = -5 is in the domain.
    • And −4−2=2{\frac{-4}{-2} = 2} ✓.

Finding the range

The range is every value the function actually reaches. Picture the graph, or look at how the rule is built:

  • A square is never negative, so (x−2)2+5(x - 2)^2 + 5 is never less than 5. Its range is y≥5y \ge 5.
  • x2+1x^2 + 1 is at least 1, so 4x2+1\dfrac{4}{x^2 + 1} is at most 41=4\frac41 = 4. It is always positive, but gets as close to 0 as you like.
40y = 4 ÷ (x² + 1)
Reading a rangeHighest value 4; never reaches 0: 0 < y ≤ 4

Pick a function, then slide xx into and out of its domain:

Domain and rangePick a function, slide x
−4−3−2−1123456−3−2−112345xy
x ≥ 2domain (x-axis)y ≥ 0range (y-axis)1y at x = 3
x = 3 is in the domain, and gives y = 1, which is in the range. The domain is x ≥ 2; the range is y ≥ 0.

The domain of an inverse

The inverse runs the function backwards, so its inputs are the function’s outputs:

domain of f−1=range of f\text{domain of } f^{-1} = \text{range of } f

Only a function that is one-to-one (each output comes from one input) has a proper inverse. x2x^2 is not: −2-2 and 22 both give 4, so the inverse can’t know which to return. Questions then either restrict the domain (say, to x≥0x \ge 0) or accept the answer with ±\pm.

Worked example · WAEC 2022

WAEC 2022 · Paper 2 · Q3

Two functions ff and gg are defined on the set of real numbers, R\mathbb{R}, by f:x→x2+2f : x \to x^2 + 2 and g:x→1x+2g : x \to \dfrac{1}{x + 2}, x≠−2x \ne -2. Find the domain of (g∘f)−1(g \circ f)^{-1}.

  1. The composite

    • ff acts first: g∘f(x)=g(x2+2){g \circ f(x) = g(x^2 + 2)}.
    • Replace xx in gg: 1(x2+2)+2=1x2+4{\frac{1}{(x^2 + 2) + 2} = \frac{1}{x^2 + 4}}.

    Think first. g∘f: f first. What is g(x² + 2)?

  2. Make x the subject

    • Write y=1x2+4{y = \frac{1}{x^2 + 4}}, so x2+4=1y{x^2 + 4 = \frac1y}.
    • Take 4 from both sides: x2=1y−4=1−4yy{x^2 = \frac1y - 4 = \frac{1 - 4y}{y}}.
    • So x=±1−4yy{x = \pm\sqrt{\frac{1 - 4y}{y}}}, and (g∘f)−1(x)=±1−4xx{(g \circ f)^{-1}(x) = \pm\sqrt{\frac{1 - 4x}{x}}}.

    Think first. Write y = 1/(x² + 4) and solve for x.

  3. Its domain

    • The bottom can’t be zero: x≠0{x \ne 0}.
    • What is under the root must be at least 0: 1−4xx≥0{\frac{1 - 4x}{x} \ge 0}.
    • Both parts positive: 0<x≤14{0 < x \le \frac14} (both negative is impossible).
    • So the domain is {x:0<x≤14}{\{x : 0 < x \le \frac14\}}.

    Think first. What must be true for the root to exist?

  4. Check with the range

    • x2+4≥4{x^2 + 4 \ge 4}, so 1x2+4{\frac{1}{x^2 + 4}} is at most 14{\frac14} and always positive.
    • The range of g∘fg \circ f is 0<y≤14{0 < y \le \frac14}: the same set ✓.

Equations built from functions

When a question sets two functions equal, as in “where do y=f(x)y = f(x) and y=g(x)y = g(x) meet?”, write f(x)=g(x)f(x) = g(x) and solve. A substitution, such as u=2x−5u = 2x - 5, often turns it into a simple equation.

More: equations with functions

Your turn

WAEC 2023 · Paper 2 · Q9 (a)

Two functions gg and hh are defined on the set of real numbers, R\mathbb R, by g:x→2+xx2+x−20g: x \to \dfrac{2 + x}{x^2 + x - 20} and h:x→x+3h: x \to x + 3.

  1. (a)(i)

    Find g∘h(x)g \circ h(x);

  2. (a)(ii)

    the values of xx for which g∘h(x)g \circ h(x) is undefined.

    Separate values with commas, e.g. 3, −2

Worked solution (try it first)

(a)(i)

  1. g∘h(x)=g(x+3)g \circ h(x) = g(x + 3): replace every xx in gg by x+3x + 3.
  2. The top: 2+(x+3)=x+52 + (x + 3) = x + 5.
  3. The bottom: (x+3)2+(x+3)−20=x2+6x+9+x+3−20(x + 3)^2 + (x + 3) - 20 = x^2 + 6x + 9 + x + 3 - 20
    =x2+7x−8= x^2 + 7x - 8.
  4. So g∘h(x)=x+5x2+7x−8g \circ h(x) = \dfrac{x + 5}{x^2 + 7x - 8}.

Report a problem with this question