Unit 1, lesson 5

Range and Codomain

How the codomain of a function differs from its range, how to find the range by solving for the input or reading the graph, and how bounds and a smaller domain shape it.

  • Theory part 9
  • Practice part 10
  • Sets and Functions

Theory, part 9

Nothing loads from YouTube until you press play.

Practice, part 10

Nothing loads from YouTube until you press play.

A fuel pump display can show any amount from 0.00 to 999.99, yet a pump filling a 50-liter tank at 2 dollars per liter never shows more than 100.00. The display is a container for possible outputs, and the amounts that actually appear form a smaller set. Every function comes with these two sets, and the smaller one answers a practical question. For which numbers yy does the equation f(x)=yf(x) = y have a solution?

Key terms

Codomain

Definition A function ff from a set AA to a set BB, written f ⁣:A→Bf\colon A \to B, assigns to each element xx of AA exactly one element f(x)f(x) of BB. The set AA is the domain of ff and the set BB is its codomain. The codomain is chosen as part of the definition of the function, and the only requirement is that every output lies in it. When a real function is given by a formula alone, its domain is the natural domain of the formula and its codomain is taken to be R\mathbb{R}, the set of all real numbers.

In plain words The codomain is the set where the outputs are allowed to land. Think of it as the label on a container, which says what may go inside, not what is actually inside.

Example The rule f(x)=x2f(x) = x^2 as a function f ⁣:R→Rf\colon \mathbb{R} \to \mathbb{R} has codomain R\mathbb{R}, even though no output is negative. The same rule from R\mathbb{R} to [0,∞)[0, \infty) is also a valid function, because every square lies in [0,∞)[0, \infty). The same rule from R\mathbb{R} to [1,∞)[1, \infty) is not a function at all, since the input 00 has the output 00, which is outside [1,∞)[1, \infty).

Image

Definition Let f ⁣:A→Bf\colon A \to B be a function. For an element xx of AA, the element f(x)f(x) is called the image of xx under ff. For a subset SS of AA, the image of SS is the set of all outputs of inputs from SS,

f(S)={ f(x)∣x∈S }.f(S) = \{\, f(x) \mid x \in S \,\}.

So a number yy belongs to f(S)f(S) exactly when y=f(x)y = f(x) for at least one xx in SS.

In plain words The image of a number is where the function sends it. The image of a set is everything its inputs reach, with each output listed once, however many inputs share it.

Example Take f(x)=x2f(x) = x^2 and S={−2,−1,0,1,2}S = \{-2, -1, 0, 1, 2\}. The five inputs have the images 4,1,0,1,44, 1, 0, 1, 4, so

f(S)={0,1,4}.f(S) = \{0, 1, 4\}.

This set has only three elements, because −2-2 and 22 share the image 44, and −1-1 and 11 share the image 11.

Range

Definition The range of a function f ⁣:A→Bf\colon A \to B is the image of its whole domain,

f(A)={ y∈B∣y=f(x)for some x∈A }.\begin{aligned} f(A) = \{\, &y \in B \mid y = f(x) \\[0.4em] &\text{for some } x \in A \,\}. \end{aligned}

A number yy is in the range exactly when the equation f(x)=yf(x) = y has at least one solution xx in the domain AA. Some older books use the word range for the codomain. Here the range always means the set of outputs that actually occur.

In plain words The range is the set of outputs the function really produces. To test a number yy, try to solve f(x)=yf(x) = y for an input xx that is allowed.

Example Let f(x)=x2+3f(x) = x^2 + 3 with domain R\mathbb{R}. Solving x2+3=yx^2 + 3 = y gives x2=y−3x^2 = y - 3, which has a real solution exactly when y−3≥0y - 3 \ge 0. For y=7y = 7 the solutions are x=2x = 2 and x=−2x = -2, so 77 is in the range. For y=1y = 1 the equation becomes x2=−2x^2 = -2, which has no real solution, so 11 is not. The range is [3,∞)[3, \infty).

Range as a subset of the codomain

Definition For every function f ⁣:A→Bf\colon A \to B the range is a subset of the codomain,

f(A)⊆B,f(A) \subseteq B,

because each output is an element of BB by definition. The two sets may be equal, or the range may be strictly smaller. A function whose range equals its codomain is called onto, or surjective.

In plain words The codomain is the container and the range is what is actually in it. The container can have room to spare.

Example The function f ⁣:R→Rf\colon \mathbb{R} \to \mathbb{R} with f(x)=x2f(x) = x^2 has range [0,∞)[0, \infty), a proper part of its codomain. A negative number such as −4-4 is in the codomain but is never an output, since x2=−4x^2 = -4 has no real solution. By contrast, the function g ⁣:R→Rg\colon \mathbb{R} \to \mathbb{R} with g(x)=x3g(x) = x^3 is onto, because every real number yy is the output of the input x=y3x = \sqrt[3]{y}.

Projection of a graph

Definition The graph of a real function ff with domain DD is the set of points (x,f(x))(x, f(x)) with xx in DD. Projecting a point (x,y)(x, y) onto the yy-axis keeps only its second coordinate yy. The range of ff is the projection of its graph onto the yy-axis, that is, the set of second coordinates of all points on the graph. Equivalently, a number cc is in the range exactly when the horizontal line y=cy = c meets the graph at least once. In the same way, the domain is the projection of the graph onto the xx-axis.

In plain words Slide every point of the graph sideways onto the yy-axis. The part of the axis that gets covered is the range.

Example The graph of f(x)=4−x2f(x) = \sqrt{4 - x^2}, with domain [−2,2][-2, 2], is the upper half of the circle of radius 22 centered at the origin. Its heights run from 00 at the ends up to 22 at the top, so its projection onto the yy-axis is [0,2][0, 2]. Algebra confirms the picture. Every value is at least 00 because it is a square root, and at most 22 because 4−x2≤44 - x^2 \le 4. Each cc in [0,2][0, 2] is reached, since 4−c2\sqrt{4 - c^2} is in the domain and

f(4−c2)=4−(4−c2)=c2=c.\begin{aligned} f\left(\sqrt{4 - c^2}\right) &= \sqrt{4 - (4 - c^2)} \\[0.4em] &= \sqrt{c^2} \\[0.4em] &= c. \end{aligned}

The last step uses c≥0c \ge 0.

Attained and unattained bounds

Definition Let ff have domain DD. A number MM is an upper bound of ff if f(x)≤Mf(x) \le M for every xx in DD, and a number mm is a lower bound of ff if f(x)≥mf(x) \ge m for every xx in DD. A bound is attained if it is itself a value of ff, that is, it equals f(c)f(c) for some cc in DD, and unattained otherwise. An attained upper bound is the largest element of the range, the maximum value of ff, and an attained lower bound is the minimum value. The unattained bounds that matter are the ones the values approach. An upper bound MM is unattained but approached if f(x)≠Mf(x) \ne M for every xx in DD while for every ε>0\varepsilon > 0 some xx in DD has f(x)>M−εf(x) > M - \varepsilon. Such an MM is not in the range, and the range has no largest element. Lower bounds that are unattained but approached are defined the same way.

In plain words A range can creep up on a number forever without ever touching it. When the range is an interval, that number is an open end and is written with a parenthesis in interval notation.

Example Consider

f(x)=x2x2+1,x∈R.f(x) = \frac{x^2}{x^2 + 1}, \qquad x \in \mathbb{R}.

Since 0≤x2<x2+10 \le x^2 < x^2 + 1, every value satisfies 0≤f(x)<10 \le f(x) < 1. The lower bound 00 is attained at x=0x = 0. The upper bound 11 is never reached, yet the values come as close to it as you like.

xxf(x)f(x)
0000
110.50.5
330.90.9
1010≈0.990\approx 0.990
100100≈0.9999\approx 0.9999

Solving f(x)=cf(x) = c confirms this. Multiplying by x2+1x^2 + 1 gives (1−c)x2=c(1 - c)x^2 = c. For c=1c = 1 this says 0=10 = 1, so 11 is never a value. For c≠1c \ne 1 it gives

x2=c1−c,x^2 = \frac{c}{1 - c},

which has a real solution exactly when 0≤c<10 \le c < 1. The range is [0,1)[0, 1). Questions about whether a bound is attained come back in calculus as extreme values.

Effect of a restricted domain

Definition If SS is a subset of the domain DD of ff, the restriction of ff to SS is the function with domain SS and the same rule. Its range is the image f(S)f(S), and

f(S)⊆f(D).f(S) \subseteq f(D).

Restricting the domain keeps the range the same or makes it smaller, never larger. The new range has to be found from all of SS, not only from the values at the endpoints of SS, because the graph can turn around in between, and an endpoint left out of SS can leave a bound unattained.

In plain words Fewer inputs give at most the same outputs. Cut the graph down to the allowed inputs, then project what is left onto the yy-axis.

Example The function f(x)=x2f(x) = x^2 has a different range on each of these domains.

DomainRange
R\mathbb{R}[0,∞)[0, \infty)
[−1,3][-1, 3][0,9][0, 9]
(1,3](1, 3](1,9](1, 9]

On [−1,3][-1, 3] the endpoint values are f(−1)=1f(-1) = 1 and f(3)=9f(3) = 9, yet the range is [0,9][0, 9] and not [1,9][1, 9], because the input 00 lies in [−1,3][-1, 3] and gives the output 00. On (1,3](1, 3] the function is increasing, so its values lie in (1,9](1, 9], and each cc in (1,9](1, 9] is reached at x=cx = \sqrt{c}. The bound 11 is unattained because the input 11 was left out.

Check yourself

  1. Find the range of the function below on its natural domain.
g(x)=2x+1x−3g(x) = \frac{2x + 1}{x - 3}
Show the answer

The natural domain is all x≠3x \ne 3. Solving g(x)=yg(x) = y gives

y(x−3)=2x+1,sox(y−2)=3y+1.\begin{aligned} y(x - 3) &= 2x + 1, \\[0.4em] \text{so} \quad x(y - 2) &= 3y + 1. \end{aligned}

For y≠2y \ne 2 this has the solution

x=3y+1y−2,x = \frac{3y + 1}{y - 2},

which is never 33, since setting it equal to 33 leads to 3y+1=3y−63y + 1 = 3y - 6, that is 1=−61 = -6. For y=2y = 2 the equation becomes 0=70 = 7, with no solution. The range is (−∞,2)∪(2,∞)(-\infty, 2) \cup (2, \infty).

  1. The function h ⁣:[0,4]→Rh\colon [0, 4] \to \mathbb{R} is given by h(x)=(x−1)2h(x) = (x - 1)^2. Name its codomain, find its range, and say whether hh is onto.
Show the answer

The codomain is R\mathbb{R}. Every value is at least 00, and h(1)=0h(1) = 0. For xx in [0,4][0, 4] the distance from xx to 11 is at most 33, so every value is at most 99, and h(4)=9h(4) = 9. The endpoint value h(0)=1h(0) = 1 is neither the smallest nor the largest value. Each cc in [0,9][0, 9] is reached at x=1+cx = 1 + \sqrt{c}, which lies in [1,4][1, 4]. So the range is [0,9][0, 9], and hh is not onto, since a number such as −1-1 is never an output.

  1. Find the range of k(x)=3−1xk(x) = 3 - \frac{1}{x} on [1,∞)[1, \infty) and say which bounds are attained.
Show the answer

For x≥1x \ge 1 we have 0<1x≤10 < \frac{1}{x} \le 1, so 2≤k(x)<32 \le k(x) < 3. The lower bound 22 is attained at x=1x = 1. Each cc in [2,3)[2, 3) is reached at x=13−cx = \frac{1}{3 - c}, which is at least 11. The upper bound 33 is never attained, because 1x>0\frac{1}{x} > 0. The range is [2,3)[2, 3).

How this lesson connects