M5.1.1 Chapter 1

Domain, range and inverses

Can I put any number into a function, and can every number come out?

Your guess

Pick one before you read on. It is fine to be wrong.

Your guess
  • You picked A. Read on. At the end, the chapter comes back to your guess.

  • You picked B. Read on. At the end, the chapter comes back to your guess.

  • You picked C. Read on. At the end, the chapter comes back to your guess.

By the end you can

  • Find the domain and range of a function
  • Say when a function has an inverse
  • Sketch a function and its inverse, mirrored in y = x

A function is a rule that gives exactly one output for each allowed input. The set of allowed inputs is the domain. The set of outputs that the rule really gives is the range.

Take f(x) = x². If we allow only the inputs −2, −1, 1 and 2, the domain is that list. The arrows show the range is 1 and 4.

Two columns joined by arrows. The column x holds −2, −1, 1 and 2. The column f(x) holds 1 and 4. The arrows run from −2 to 4, from −1 to 1, from 1 to 1 and from 2 to 4.xf(x)−2−11214
f(x) = x² on the domain −2, −1, 1, 2. The range is 1 and 4.

Two inputs may share an output, as −2 and 2 do here. That is allowed. A rule like this is called many to one. What a function never does is give one input two outputs.

Some papers write f : x → 2x + 1, with a small bar at the back of the arrow, and read it "f maps x to 2x + 1". This means f(x) = 2x + 1.

Unless a question says otherwise, the domain is every real number for which the rule works. A real number is any number on the number line, including fractions and roots such as √2.

We write a domain or range in two ways. Set notation uses braces: {x : x ≥ 2} reads "the set of x such that x is at least 2". Interval notation uses brackets: [2, ∞).

A square bracket includes the end. A round bracket leaves it out. The sign ∞ means "goes on without end". It is not a number, so it always has a round bracket. So [−1, 3] means −1 ≤ x ≤ 3, and (−1, 3] means −1 < x ≤ 3.

Three number lines, each named x. The first has a filled circle at −1, a filled circle at 3 and a bar between them. The second has an open circle at −1, a filled circle at 3 and a bar between them. The third has a filled circle at 2 and a bar that runs on to the right.−2−1012345x−2−1012345x−2−1012345x
The three lines show [−1, 3], then (−1, 3], then [2, ∞). A filled circle means the end is included. An open circle means it is left out.

Three things can stop an input. You cannot divide by zero. You cannot take the square root of a negative number and stay with real numbers. And a question may restrict the domain, for example "for 0 ≤ x ≤ 3".

To find the range, ask which outputs are possible. A sketch helps: read the lowest and highest heights the curve reaches. A restricted domain gives its own range.

A graph with x from 0 to 4 and y from 0 to 8. A straight line named y = 2x + 1 runs from the point (0, 1) up to the point (3, 7). Each end has a dot, its name and dashed guides to both axes.(0, 1)(3, 7)y = 2x + 11234123456780xy
The graph stops at the end points (0, 1) and (3, 7), so it shows only the domain asked for.

Worked example

f(x) = 2x + 1 for 0 ≤ x ≤ 3. Write the domain and find the range.

  1. The domain is given: 0 ≤ x ≤ 3, which is [0, 3].
  2. The line y = 2x + 1 rises as x grows, so the lowest output comes from the smallest input.
  3. Smallest input: f(0) = 2 × 0 + 1 = 1.
  4. Largest input: f(3) = 2 × 3 + 1 = 7.
  5. A straight line has no gaps, so every height from 1 to 7 is reached.
  6. The range is 1 ≤ y ≤ 7, which is [1, 7].

Answer: The range is [1, 7].

Now a square root. Its inside must be 0 or more, and the root sign gives the positive root, so the output is never below 0.

A graph with x from 0 to 9 and y from 0 to 5. A curve named y = √(x − 2) + 1 starts at the point (2, 1) and rises to the right, getting flatter.(2, 1)y = √(x − 2) + 1123456789123450xy
The curve starts at x = 2. Nothing is drawn to the left, and nothing is below the height 1.

Worked example

f(x) = √(x − 2) + 1. Find the largest possible domain, and the range.

  1. A real square root needs the inside to be 0 or more: x − 2 ≥ 0.
  2. Add 2 to both sides: x ≥ 2. The domain is [2, ∞).
  3. The root sign gives the positive root, so √(x − 2) ≥ 0, and it equals 0 when x = 2.
  4. Add 1 to the root: f(x) = √(x − 2) + 1 ≥ 1.
  5. At the start, f(2) = √0 + 1 = 1. As x grows the outputs grow without end, with no gaps.
  6. The range is y ≥ 1, which is [1, ∞).

Answer: The domain is [2, ∞) and the range is [1, ∞).

A fraction cannot have a bottom of zero. That removes one input, and often one output as well.

A graph with x from −2 to 8 and y from −4 to 4. A dashed upright line named x = 3 stands at x = 3. A curve named g, which is y = 1/(x − 3), has two branches. The left branch is below the x axis and the right branch is above it. Neither branch crosses the dashed line or the x axis.x = 3g−2−145678−4−3−212340xy
g(x) = 1/(x − 3). The curve has no point on the dashed line x = 3, and it never touches the x axis.

Worked example

g(x) = 1/(x − 3). Find the domain and the range.

  1. The bottom must not be zero. x − 3 = 0 when x = 3, so x ≠ 3.
  2. The domain is every real number except 3.
  3. For the range, write y = 1/(x − 3) and try to solve for x.
  4. Multiply by (x − 3): y(x − 3) = 1. If y ≠ 0, divide by y: x − 3 = 1/y.
  5. So x = 3 + 1/y. This gives an input for every y except y = 0, where 1/y has no meaning.
  6. Test it: g(4) = 1/(4 − 3) = 1, and g(2) = 1/(2 − 3) = −1.
  7. The outputs fall on both sides of 0, but 0 needs 1/(x − 3) = 0, and a fraction with top 1 is never 0. The range is every real number except 0.

Answer: The domain is x ≠ 3 and the range is y ≠ 0.

Now the inverse. A function is one to one if different inputs always give different outputs. Only a one to one function has an inverse function f⁻¹, because the inverse must take each output back to a single input.

The horizontal line test shows it. If every horizontal line cuts the graph at most once, the function is one to one.

A graph with x from −4 to 4 and y from −1 to 9. A curve named y = x² is a U shape. A dashed horizontal line at height 4 cuts it at two dots, one at x = −2 and one at x = 2. Dashed guides run from each dot down to the x axis.y = x²−4−3−2−112342680xy
The dashed line y = 4 cuts y = x² twice. So x² on all real numbers is not one to one.

We can mend this by restricting the domain. Keep only x ≥ 0. Now each output has one input, and the inverse is f⁻¹(x) = √x.

The inverse swaps inputs and outputs. So the domain of f⁻¹ is the range of f, and the range of f⁻¹ is the domain of f. If (a, b) is on the graph of f, then (b, a) is on the graph of f⁻¹. Swapping x and y reflects the graph in the line y = x.

A graph with x and y both from 0 to 5. A curve named y = x² rises from the origin. A curve named y = √x lies on the other side of a dashed line named y = x. The point (2, 4) is on the first curve and the point (4, 2) is on the second.(2, 4)(4, 2)y = xy = x²y = √x12345123450xy
f(x) = x² for x ≥ 0 and its inverse f⁻¹(x) = √x. Each curve is the mirror image of the other in the dashed line y = x.

To find an inverse: write y = f(x), solve for x, then write x for the input again. Check which root to take from the domain of f.

A graph with x and y both from 0 to 7. A steep curve named f, which is y = (x − 2)² + 1, starts at the point (2, 1) and rises. A flatter curve named f⁻¹, which is y = 2 + √(x − 1), starts at the point (1, 2). A dashed line named y = x lies between them. The points (3, 2) and (2, 3) are a mirror pair.(3, 2)(2, 3)y = xff⁻¹123456712345670xy
f(x) = (x − 2)² + 1 and f⁻¹(x) = 2 + √(x − 1), from the example below. The graphs are mirror images in y = x, and the start (2, 1) of f swaps to the start (1, 2) of f⁻¹.

Worked example

f(x) = x² − 4x + 5 for x ≥ 2. Write f(x) as (x − p)² + q. Find the range of f. Find f⁻¹(x), and give its domain and range.

  1. Complete the square: x² − 4x + 5 = (x − 2)² − 4 + 5 = (x − 2)² + 1.
  2. For x ≥ 2 the bracket x − 2 is 0 or more, and (x − 2)² grows as x grows.
  3. The smallest output is f(2) = 0 + 1 = 1, and the outputs grow without end. The range is y ≥ 1.
  4. Each output now comes from only one input on x ≥ 2, so f is one to one and has an inverse.
  5. Write y = (x − 2)² + 1, so (x − 2)² = y − 1.
  6. Take the square root. On this domain x − 2 is not negative, so take the positive root: x − 2 = √(y − 1).
  7. So x = 2 + √(y − 1). Write x for the input: f⁻¹(x) = 2 + √(x − 1).
  8. The domain of f⁻¹ is the range of f, which is x ≥ 1. The range of f⁻¹ is the domain of f, which is y ≥ 2.

Answer: f⁻¹(x) = 2 + √(x − 1), with domain x ≥ 1 and range y ≥ 2.

Two more words help when a question asks for them. The codomain is the set the outputs are allowed to lie in, which a question may state. The range is the part of the codomain that is really reached. A function is onto if its range is the whole codomain.

Take f(x) = x² from the real numbers to the real numbers. It is not onto: the range is y ≥ 0, so no input gives −1. But f(x) = x² from the real numbers to [0, ∞) is onto, because every y ≥ 0 equals x² for x = √y. A function that is one to one and onto is a bijection, and every bijection has an inverse.

Now two functions in a row. In fg(x) = f(g(x)), the function g goes first. So fg exists only for inputs x where g(x) is in the domain of f. This can shrink the domain of fg.

Worked example

f(x) = √(x − 2) and g(x) = 3 − x. Find fg(x) and its domain.

  1. fg(x) = f(g(x)). Put g(x) = 3 − x into f: fg(x) = √((3 − x) − 2) = √(1 − x).
  2. The domain of g is all real numbers, so any x can go into g.
  3. But f needs its input to be 2 or more, because √(x − 2) needs x − 2 ≥ 0. So we need g(x) ≥ 2: 3 − x ≥ 2.
  4. Take 3 from both sides: −x ≥ −1. Multiply by −1 and turn the sign round: x ≤ 1.
  5. Check with x = 1: g(1) = 2, and f(2) = 0, so fg(1) = √0 = 0. And x = 2 fails: g(2) = 1, and f(1) = √(−1) does not exist.
  6. So fg(x) = √(1 − x), with domain x ≤ 1.

Answer: fg(x) = √(1 − x), with domain x ≤ 1.

Try it

Fold the graph along y = x

You need: squared paper, a pencil and a ruler.

  1. Draw axes from 0 to 6 on both sides. Draw the line y = 2x + 1 and mark the points (0, 1), (1, 3) and (2, 5).
  2. Swap the two numbers of each point and mark the new points (1, 0), (3, 1) and (5, 2).
  3. Draw the dashed line y = x. Draw a line through the new points. It is the graph of f⁻¹(x) = (x − 1)/2.
  4. Fold the paper along the dashed line. Hold it to the light.

What you will see: Each point of the first line lands on its swapped point. The two lines are mirror images in y = x.

If you cannot try it, this is what happens.
A graph with x and y both from 0 to 6. A line named f, which is y = 2x + 1, rises steeply. A line named f⁻¹, which is y = (x − 1)/2, rises slowly. A dashed line named y = x lies between them. Dots mark (0, 1), (1, 3) and (2, 5) on the first line and (1, 0), (3, 1) and (5, 2) on the second.ff⁻¹y = x1234561234560xy

A wrong idea many people have

f⁻¹(x) means 1/f(x).

Why it feels right: A raised −1 on a number gives a reciprocal: 2⁻¹ is 1/2. The same mark on f seems to say the same thing.

The test that breaks it: Take f(x) = x + 2. Then f(3) = 5, so the inverse takes 5 back to 3: f⁻¹(5) = 3. The reciprocal would give 1/f(5) = 1/7, which is a different number.

What is true: For a function, f⁻¹ is the inverse function, which undoes f. The reciprocal is written 1/f(x) or (f(x))⁻¹, and it is a different thing.

A wrong idea many people have

Every function has an inverse.

Why it feels right: For straight line functions such as 2x + 1 we can always undo the steps, so it seems any function can be undone.

The test that breaks it: Take f(x) = x² on all real numbers. f(3) = 9 and f(−3) = 9. An inverse would have to send 9 back to both 3 and −3, and a function may not give two outputs.

What is true: Only a one to one function has an inverse. Restrict the domain first, for example to x ≥ 0, and the inverse exists on that domain.

A wrong idea many people have

The range of x² − 4x + 5 is y ≥ 5, because 5 is the last number.

Why it feels right: For y = x² + c the lowest point is c, so the last number seems to give the lowest output.

The test that breaks it: The −4x term moves the lowest point. f(2) = 4 − 8 + 5 = 1, and 1 is below 5.

What is true: Complete the square. In (x − p)² + q the lowest value is q, so here it is 1. Check the domain too, because it may cut off the lowest point.

Key words

function
a rule that gives exactly one output for each allowed input.
domain
the set of inputs a function allows.
range
the set of outputs a function really gives.
real number
any number on the number line, including fractions and roots.
one to one
different inputs always give different outputs.
inverse function
the function f⁻¹ that takes each output back to its input. It exists only if f is one to one.
restricting the domain
allowing only some inputs, so that a function becomes one to one.

Back to your guess

The answer is B: No. A function has a set of inputs it accepts, and its outputs may fill only part of the number line.

Take f(x) = √x. You cannot put in −4, because a negative number has no real square root. And the output is never negative either. The inputs allowed are called the domain, and the outputs reached are called the range. Both can be only part of the number line.

Check yourself

Try each one before you look. A wrong answer tells you where to go next.

  1. What is the largest domain of f(x) = √(x − 5)?

    Tap your answer.
    1. Not this one. You changed the sign of 5. The inside x − 5 must be 0 or more, so x ≥ 5. Go to M5.1.1. Try another.

    2. Not this one. You turned the sign the wrong way round. A square root needs the inside to be 0 or more, which gives x ≥ 5. Go to M5.1.1. Try another.

    3. Yes, that is right. A real square root needs x − 5 ≥ 0. Add 5 to both sides: x ≥ 5. The input 5 gives √0 = 0, so 5 is included.

    4. Not this one. The input 5 is allowed, because √0 = 0 is a real number. So the end is included. Go to M5.1.1. Try another.

    See the answer

    x ≥ 5

    A real square root needs x − 5 ≥ 0. Add 5 to both sides: x ≥ 5. The input 5 gives √0 = 0, so 5 is included.

    • If you chose A: You changed the sign of 5. The inside x − 5 must be 0 or more, so x ≥ 5. Go to M5.1.1.
    • If you chose B: You turned the sign the wrong way round. A square root needs the inside to be 0 or more, which gives x ≥ 5. Go to M5.1.1.
    • If you chose D: The input 5 is allowed, because √0 = 0 is a real number. So the end is included. Go to M5.1.1.
  2. What is the range of f(x) = (x + 1)² − 3, for all real x?

    Tap your answer.
    1. Yes, that is right. The square (x + 1)² is 0 or more, and it is 0 when x = −1. Take away 3: f(x) ≥ −3, and f(−1) = −3 is reached.

    2. Not this one. The −3 moves the lowest point down to −3, not up to 3. Go to M5.1.1. Try another.

    3. Not this one. The number inside the bracket moves the graph sideways, so it fixes the x of the lowest point. The range comes from the number outside, which is −3. Go to M5.1.1. Try another.

    4. Not this one. The squared bracket is 0 or more, but then 3 is taken away, so the lowest output is below 0. Go to M5.1.1. Try another.

    See the answer

    y ≥ −3

    The square (x + 1)² is 0 or more, and it is 0 when x = −1. Take away 3: f(x) ≥ −3, and f(−1) = −3 is reached.

    • If you chose B: The −3 moves the lowest point down to −3, not up to 3. Go to M5.1.1.
    • If you chose C: The number inside the bracket moves the graph sideways, so it fixes the x of the lowest point. The range comes from the number outside, which is −3. Go to M5.1.1.
    • If you chose D: The squared bracket is 0 or more, but then 3 is taken away, so the lowest output is below 0. Go to M5.1.1.
  3. The point (2, 9) is on the graph of a one to one function f. Which point must be on the graph of f⁻¹?

    Tap your answer.
    1. Not this one. That is the same point. The inverse swaps the two numbers. Go to M5.1.1. Try another.

    2. Yes, that is right. f takes the input 2 to the output 9. So f⁻¹ takes the input 9 back to the output 2. The point is (9, 2), the mirror image of (2, 9) in y = x.

    3. Not this one. The inverse swaps x and y. It does not change any signs. Go to M5.1.1. Try another.

    4. Not this one. That uses reciprocals. f⁻¹ undoes f. It is not 1 divided by f. Go to M5.1.1. Try another.

    See the answer

    (9, 2)

    f takes the input 2 to the output 9. So f⁻¹ takes the input 9 back to the output 2. The point is (9, 2), the mirror image of (2, 9) in y = x.

    • If you chose A: That is the same point. The inverse swaps the two numbers. Go to M5.1.1.
    • If you chose C: The inverse swaps x and y. It does not change any signs. Go to M5.1.1.
    • If you chose D: That uses reciprocals. f⁻¹ undoes f. It is not 1 divided by f. Go to M5.1.1.
  4. Which of these functions has an inverse function?

    Tap your answer.
    1. Not this one. f(2) = 4 and f(−2) = 4. Two inputs share one output, so f cannot be undone. Go to M5.1.1. Try another.

    2. Not this one. Adding 1 does not help. f(2) = 5 and f(−2) = 5, so the function is not one to one. Go to M5.1.1. Try another.

    3. Not this one. This domain holds both −2 and 2, which give the same output 4. It is not one to one. Go to M5.1.1. Try another.

    4. Yes, that is right. On x ≥ 3 the inputs are all positive, and x² grows as x grows. Each output comes from one input only, so f is one to one and has an inverse.

    See the answer

    f(x) = x², for x ≥ 3

    On x ≥ 3 the inputs are all positive, and x² grows as x grows. Each output comes from one input only, so f is one to one and has an inverse.

    • If you chose A: f(2) = 4 and f(−2) = 4. Two inputs share one output, so f cannot be undone. Go to M5.1.1.
    • If you chose B: Adding 1 does not help. f(2) = 5 and f(−2) = 5, so the function is not one to one. Go to M5.1.1.
    • If you chose C: This domain holds both −2 and 2, which give the same output 4. It is not one to one. Go to M5.1.1.
  5. Mei says: "g(x) = 2 + 1/(x − 3) has the input 3 missing, so its range is y ≠ 3." What is the range of g?

    Tap your answer.
    1. Not this one. The number 3 is missing from the domain, not from the range. The inputs and the outputs are different sets. Go to M5.1.1. Try another.

    2. Not this one. That would be the range of 1/(x − 3) alone. The 2 lifts every output by 2, so the missing output moves up with them. Go to M5.1.1. Try another.

    3. Yes, that is right. The part 1/(x − 3) is never 0, so g(x) = 2 + 1/(x − 3) is never 2. Every other output is reached: for y ≠ 2, solving y = 2 + 1/(x − 3) gives x = 3 + 1/(y − 2). So the range is y ≠ 2.

    See the answer

    y ≠ 2

    The part 1/(x − 3) is never 0, so g(x) = 2 + 1/(x − 3) is never 2. Every other output is reached: for y ≠ 2, solving y = 2 + 1/(x − 3) gives x = 3 + 1/(y − 2). So the range is y ≠ 2.

    • If you chose A: The number 3 is missing from the domain, not from the range. The inputs and the outputs are different sets. Go to M5.1.1.
    • If you chose B: That would be the range of 1/(x − 3) alone. The 2 lifts every output by 2, so the missing output moves up with them. Go to M5.1.1.
  6. f(x) = x² − 8x + 19. Find the smallest value of f(x).

    See the answer

    3

    Complete the square: x² − 8x + 19 = (x − 4)² − 16 + 19 = (x − 4)² + 3. The square is never below 0, so the smallest value is 3, when x = 4.

  7. f(x) = x² − 6x + 14 for x ≥ 3. Find f⁻¹(14).

    See the answer

    6

    f⁻¹(14) is the input that f turns into 14. Solve x² − 6x + 14 = 14, so x² − 6x = 0 and x(x − 6) = 0. That gives x = 0 or x = 6. Only 6 is in the domain x ≥ 3.

  8. g(x) = x² + 4x + 9 for x ≥ −2. Show that the range of g is y ≥ 5, and explain why g has an inverse.

    See the answer

    g(x) = (x + 2)² + 5. For x ≥ −2, x + 2 is 0 or more, so (x + 2)² ≥ 0 and g(x) ≥ 5. The value 5 is reached at x = −2. For any y ≥ 5, the input x = −2 + √(y − 5) is in the domain and gives g(x) = y, so every value from 5 up is reached. On this domain g rises as x grows, so each output has one input. So g is one to one and has an inverse.

    Three marks. One: complete the square to get (x + 2)² + 5. Two: use x ≥ −2 to show g(x) ≥ 5, show that 5 is reached, and show that every larger value is reached. Three: g only rises on this domain, so it is one to one and has an inverse.

  9. f(x) = √x and g(x) = x − 4. What is the domain of fg?

    Tap your answer.
    1. Not this one. That is the domain of f alone. In fg the input goes into g first, and then g(x) must be allowed in f, so g(x) ≥ 0. Go to M5.1.1. Try another.

    2. Not this one. You turned the sign round. We need g(x) = x − 4 to be 0 or more, which gives x ≥ 4. Go to M5.1.1. Try another.

    3. Not this one. You changed the sign of 4. From x − 4 ≥ 0, add 4 to both sides to get x ≥ 4. Go to M5.1.1. Try another.

    4. Yes, that is right. fg(x) = f(g(x)) = √(x − 4). The square root needs x − 4 ≥ 0, so x ≥ 4. The input 4 is allowed, because √0 = 0.

    See the answer

    x ≥ 4

    fg(x) = f(g(x)) = √(x − 4). The square root needs x − 4 ≥ 0, so x ≥ 4. The input 4 is allowed, because √0 = 0.

    • If you chose A: That is the domain of f alone. In fg the input goes into g first, and then g(x) must be allowed in f, so g(x) ≥ 0. Go to M5.1.1.
    • If you chose B: You turned the sign round. We need g(x) = x − 4 to be 0 or more, which gives x ≥ 4. Go to M5.1.1.
    • If you chose C: You changed the sign of 4. From x − 4 ≥ 0, add 4 to both sides to get x ≥ 4. Go to M5.1.1.
  10. f(x) = x², with inputs and outputs both taken from the real numbers. Which statement is true?

    Tap your answer.
    1. Yes, that is right. The range of x² is y ≥ 0, so negative numbers are never reached. The codomain is all real numbers, so f is not onto. (It is also not one to one, but that is a separate fault.)

    2. Not this one. Take y = −1. No real x has x² = −1. A function is onto only if every number in the codomain is reached. Go to M5.1.1. Try another.

    3. Not this one. Being one to one and being onto are different things. A function can fail one and pass the other. Onto asks whether the whole codomain is reached. Go to M5.1.1. Try another.

    See the answer

    f is not onto, because its range is only y ≥ 0.

    The range of x² is y ≥ 0, so negative numbers are never reached. The codomain is all real numbers, so f is not onto. (It is also not one to one, but that is a separate fault.)

    • If you chose B: Take y = −1. No real x has x² = −1. A function is onto only if every number in the codomain is reached. Go to M5.1.1.
    • If you chose C: Being one to one and being onto are different things. A function can fail one and pass the other. Onto asks whether the whole codomain is reached. Go to M5.1.1.
  11. f(x) = √(x − 2) and g(x) = 7 − x. The function fg is defined for x ≤ c. Find c.

    See the answer

    5

    fg(x) = f(g(x)) = √((7 − x) − 2) = √(5 − x). This needs 5 − x ≥ 0, so x ≤ 5. Check: g(5) = 2, and f(2) = 0, which is allowed.

Keep it

Copy this into your exercise book.

Domain: inputs allowed. Range: outputs reached. Only a one to one function has an inverse; restrict the domain to get one. f⁻¹ swaps x and y, so reflect the graph in y = x.

Draw: A curve and its inverse, with the dashed line y = x between them and a pair of mirror points.

Reading with a child? A short page for the adult: what this chapter teaches and three questions to ask.

No internet tomorrow? Save the whole book as one file (881 KB). It opens on any phone.