Sub topic 8
Range: the outputs that occur
This chapter assumes you can evaluate a function such as f(x) = 2x + 3 and that you know what the domain is. It also assumes you can read interval notation like [0, ∞) and plot points on the coordinate plane. The chapter defines the range, shows how to read it from each representation, and covers the errors that come up most often.
The definition
The range of a function is the set of all outputs the function actually produces when you feed it every input in its domain. The key word is actually. A number is in the range only if at least one allowed input gives that number.
The domain and range answer different questions:
- Domain: which inputs are allowed?
- Range: which outputs occur?
For f(x) = x², you can say "the outputs are real numbers". That is true, but it is not the range. The value −4 is a real number, yet no real input squares to −4, so −4 is not in the range. The range is every real number that is 0 or greater.
Some textbooks use the word codomain for the set of outputs a function is declared to be able to produce. This tutorial uses only the range, the set of outputs that really occur.
Reading the range from a mapping or a table
With a finite list of input-output pairs, the range is the set of second entries. Take these pairs:
| x | f(x) |
|---|---|
| -2 | 4 |
| -1 | 1 |
| 1 | 1 |
| 2 | 4 |
The domain is {−2, −1, 1, 2}. The range is {1, 4}. Three rules apply when you list a range:
- Write each output once, even if several inputs produce it.
- Order does not matter, but listing from smallest to largest is easier to check.
- Do not include outputs that appear nowhere in the table.
The diagram shows two facts about outputs. Many inputs can share one output, so a function is not required to be one-to-one. The range can also be much smaller than the set of numbers you might expect.
Reading the range from a graph
On a graph, the domain is the horizontal extent (the x-values) and the range is the vertical extent (the y-values). To find the range, ask which heights the curve reaches.
- Find the lowest and highest points of the graph. These give the smallest and largest outputs, if they exist.
- Check the endpoints. A closed (filled) dot means the output is included. An open (hollow) dot means it is excluded.
- Check the ends of the graph. An arrow means the curve continues forever in that direction, so the range extends to ∞ or −∞.
- Look for gaps. If the graph skips a band of heights, those heights are not in the range.
Imagine sweeping a horizontal line up and down the plane. Every height where the line touches the graph at least once belongs to the range. This mirrors the vertical line test, which uses vertical lines to check that each input has one output.
Here are common cases, written in interval notation and set notation:
| Function | Range in interval notation | Range in set notation | Column |
|---|---|---|---|
| f(x) = 2x + 3 | (−∞, ∞) | {y \ | y is a real number} |
| f(x) = x² | [0, ∞) | {y \ | y ≥ 0} |
| f(x) = −(x − 1)² + 3 | (−∞, 3] | {y \ | y ≤ 3} |
| f(x) = √x | [0, ∞) | {y \ | y ≥ 0} |
| f(x) = 4 | {4} | {4} | |
| f(x) = 1/x | (−∞, 0) ∪ (0, ∞) | {y \ | y ≠ 0} |
Notice how the shape of each graph explains its row:
- A non-constant line rises or falls without bound, so it reaches every height.
- An upward parabola has a lowest point (its vertex) and opens upward forever. A downward parabola has a highest point and opens downward forever.
- A constant function is a horizontal line, so it has exactly one output. Its range is a single value, not an interval.
- 1/x gets arbitrarily close to 0 but never equals it, because a fraction with numerator 1 is never 0. So 0 is excluded from the range.
Finding the range from an equation: the working method
A full treatment of equations comes in a later chapter. The core idea is simple and worth knowing now. A number y is in the range exactly when the equation f(x) = y has a solution x in the domain.
For f(x) = x², ask whether x² = y can be solved:
- If y = 9, then x = 3 or x = −3. The value 9 is in the range.
- If y = 0, then x = 0. The value 0 is in the range.
- If y = −4, then x² = −4 has no real solution. The value −4 is not in the range.
The code below applies this test to f(x) = x². It returns an input that produces y, or None if none exists.
import math
def input_for(y):
# h(x) = x**2 equals y for some real x only when y >= 0
if y < 0:
return None
return math.sqrt(y)
print(input_for(9)) # 3.0
print(input_for(0)) # 0.0
print(input_for(-4)) # NoneThis method works because it follows the definition directly. You do not need to guess the shape of the graph.
Computing a range in code
When the domain is a finite list, you can compute the range exactly. Apply the function to every input and collect the results in a set, which removes repeats.
def f(x):
return 2 * x + 3
domain = [-1, 0, 1, 2]
outputs = sorted({f(x) for x in domain})
print(outputs) # [1, 3, 5, 7]The same function, with the same rule, can have different ranges on different domains. The range depends on the domain you choose:
def h(x):
return x ** 2
full = sorted({h(x) for x in range(-3, 4)})
restricted = sorted({h(x) for x in range(1, 4)})
print(full) # [0, 1, 4, 9]
print(restricted) # [1, 4, 9]On the integers from −3 to 3, the outputs are 0, 1, 4, and 9. On the integers from 1 to 3, the output 0 disappears because the input 0 is no longer allowed.
Range and a restricted domain
Because the range is built from the domain, restricting the domain can shrink the range. Consider f(x) = x² with two different domains:
- With the domain of all real numbers, the range is [0, ∞).
- With the domain [1, 3], the function produces every value from 1 up to 9. The range is [1, 9].
For [1, 3], the output rises steadily from f(1) = 1 to f(3) = 9, so the range is [1, 9], not [0, ∞). A graph drawn only over [1, 3] has endpoints at heights 1 and 9. Those heights are the smallest and largest outputs, and the range is everything between them.
Common errors
Confusing the range with the domain. Learners often report x-values when asked for y-values. Before you answer, say aloud which axis you are reading. The range is always about outputs.
Listing repeated outputs. For the table above, the range is {1, 4}, not {4, 1, 1, 4}. A set contains each member once.
Assuming the range is all real numbers. Only some functions reach every height. Squares, absolute values, square roots, and constants all have restricted ranges.
Ignoring the endpoints. [0, ∞) includes 0 and (0, ∞) does not. For y = x² the output 0 occurs at x = 0, so the bracket is correct. For y = 1/x, the output 0 never occurs, so 0 must be excluded.
Putting a bracket next to infinity. Infinity is not a number you can reach, so it always takes a parenthesis: [0, ∞), never [0, ∞].
Reading the range from the equation's appearance. The equation y = √x − 5 has range [−5, ∞), not [0, ∞). The shift of −5 moves every output down by 5, so the smallest output is −5.
Forgetting the domain's effect. If a problem states a domain, such as x ≥ 2, use only that part of the graph.
Summary of the method
- Identify the representation: mapping, table, graph, or equation.
- For a mapping or table, list the distinct outputs.
- For a graph, find the lowest and highest heights and check endpoints and gaps.
- For an equation, ask which values of y make f(x) = y solvable with x in the domain.
- Write the answer in interval notation or set notation, and check each bracket.
Exercise
A function has the pairs (−2, 5), (0, 5), (3, 8), (4, 8), (6, 1). State the domain and the range as sets.
Show answer
The domain is the set of first entries: {−2, 0, 3, 4, 6}. The range is the set of distinct second entries: {1, 5, 8}. The outputs 5 and 8 each appear twice but are listed only once.
Exercise
Find the range of f(x) = −(x − 1)² + 3 in interval notation. Explain why 5 is not in the range.
Show answer
The range is (−∞, 3]. The squared term (x − 1)² is never negative, so −(x − 1)² is never positive, and f(x) is at most 3. The maximum 3 occurs at x = 1. Since 5 > 3, the equation −(x − 1)² + 3 = 5 would need (x − 1)² = −2, which has no real solution.
Exercise
The function g(x) = 7 is defined for all real numbers. What is its range, and how does that differ from the range of f(x) = 2x + 3?
Show answer
The range of g is {7}, a single value, because every input gives 7. The range of f is (−∞, ∞), because a non-constant line reaches every height. The range of g is not an interval, since it contains only one number.
Exercise
Let h(x) = x² with domain [−2, 1]. Find the range in interval notation.
Show answer
The output is smallest at x = 0, where h(0) = 0. The largest input magnitude is 2 at x = −2, giving h(−2) = 4, while h(1) = 1. So the outputs run from 0 up to 4, and the range is [0, 4].