- Practice
- About 25 min
- 5 practice questions
Functions: definition, representations, special functions and one-to-one and onto
Recognise when a relation is a function, use tables, graphs, formulas and piecewise rules, apply the vertical and horizontal line tests, work with modulus, signum, floor and ceiling functions, test for one-to-one and onto, and find domains and ranges.
If something looks wrong, please tell us.
By the end of this lesson you can
- State the two conditions that make a relation a function and use the words image, pre-image, domain, co-domain and range.
- Represent a function by a table, a graph, a formula or a piecewise rule, and use the vertical line test.
- Evaluate the identity, constant, modulus, signum, greatest integer and smallest integer functions.
- Test a function for one-to-one, onto and bijective, also by the horizontal line test.
- Find the largest domain and the range of a real function.
Think of a test written by a group of students, with marks from 0 to 100. Every student gets a mark, and no student gets two different marks in the same test. Those two facts are exactly what turn a relation into a function. Functions are the main objects of calculus, so this lesson builds the vocabulary carefully.
A function is a special relation
Definition. A relation f from A to B (a subset of A × B) is a function from A to B if (i) for every a ∈ A there is some b ∈ B with (a, b) ∈ f, and (ii) if (a, b) ∈ f and (a, c) ∈ f then b = c. In words: every element of A has exactly one image. We write f : A → B; A is the domain, B the co-domain, and f(a) = b says b is the image of a and a is a pre-image of b. We say the image because it is unique, and a pre-image because an element of B may have several pre-images or none. The range is the set of elements of B that have a pre-image, so range ⊆ co-domain. If B ⊆ R, f is real-valued. Two functions are equal if they have the same domain and f(a) = g(a) for every a in it.
Every function is a relation, but not every relation is a function. Take f = {(p, 1), (q, 2), (r, 2), (s, 3)}. It is a function from {p, q, r, s} to {1, 2, 3}. It is not a function from {p, q, r, s, t} to {1, 2, 3}, since t has no image, and not a function from {p, q, r, s} to {1, 2, 4}, since the image of s is not in that co-domain. So the domain and co-domain must always be stated.
Ways of representing a function
- Tabular: list the arguments x₁, x₂, ..., xₙ in one row and the values y₁, y₂, ..., yₙ beneath them.
- Graphical: for subsets of R, plot the points (x, f(x)); x is the argument (independent) and f(x) the value (dependent).
- Analytical: a formula such as f(x) = (x − 1)/(x + 1) or f(x) = √(9 − x²). The set of x for which the formula gives a definite real value is the natural domain: R − {−1} and [−3, 3] in these two examples.
- Piecewise: different formulas on different intervals; first find which interval x lies in, then use that formula.
Worked example 1: a piecewise function
Let f(x) = 1 − x if x < 0; f(x) = x² if 0 ≤ x ≤ 2; f(x) = 4 if x > 2. Then f(−3) = 1 − (−3) = 4; f(0) = 0² = 0; f(1.5) = 2.25; f(2) = 2² = 4; f(7) = 4. Notice that different inputs share the value 4; that is allowed in a function.
The vertical line test
A curve in the plane represents a function of x (on a given domain) only if every vertical line through a point of the domain meets the curve exactly once. Meeting it twice would give two values for one x; missing it would leave x without an image. The circle x² + y² = 4 fails: the line x = 1 meets it at (1, √3) and (1, −√3). The curve y² = x fails for the same reason, but each half, y = √x and y = −√x with x ≥ 0, passes.
Some elementary functions
| Function | Rule | Sample values |
|---|---|---|
| Identity I on X | f(x) = x | f(5) = 5 |
| Constant | f(x) = c for all x | c = 0 gives the zero function |
| Modulus |x| | −x if x < 0; x if x ≥ 0 | |−4| = 4, |3| = 3 |
| Signum sgn | x/|x| if x ≠ 0; 0 if x = 0 | sgn(−7) = −1, sgn(0) = 0, sgn(2) = 1 |
| Greatest integer (floor) ⌊x⌋ | largest integer ≤ x | ⌊3.6⌋ = 3, ⌊−1.2⌋ = −2, ⌊5⌋ = 5 |
| Smallest integer (ceiling) ⌈x⌉ | smallest integer ≥ x | ⌈3.6⌉ = 4, ⌈−1.2⌉ = −1, ⌈5⌉ = 5 |
The floor and ceiling functions are called step functions: their graphs are horizontal steps. Take care with negatives: ⌊−2.5⌋ = −3, not −2, because −3 is the largest integer that does not exceed −2.5; and ⌈−2.5⌉ = −2.
One-to-one, onto and bijective
f : A → B is one-to-one (injective) if x ≠ y ⇒ f(x) ≠ f(y); equivalently f(x) = f(y) ⇒ x = y. It is onto (surjective) if every b ∈ B has at least one pre-image, that is, range = co-domain. It is bijective if it is both. A function that is not onto is called an into function. Every identity function is a bijection; a constant function is not onto unless the co-domain has only one element.
For finite sets with n(A) = m and n(B) = n: a one-to-one function from A to B is possible only if m ≤ n; an onto function only if m ≥ n; and a bijection exists exactly when m = n. Whether f is one-to-one depends on its rule and domain; whether it is onto also depends on the co-domain.
The two properties
-
One-to-one
- No two inputs share an output
- Prove: f(x) = f(y) ⇒ x = y
- Horizontal lines meet the graph at most once
-
Onto
- Every element of the co-domain is hit
- Prove: for each y, solve f(x) = y inside the domain
- Every horizontal line through the co-domain meets the graph
Horizontal line test. For a function given by its graph: if a horizontal line through some y of the co-domain meets the graph more than once, f is not one-to-one; if a horizontal line through some y of the co-domain misses the graph, f is not onto. f is one-to-one exactly when each horizontal line through the range meets the graph once.
Worked example 2: one-to-one but not onto
f : N → N, f(n) = 2n + 1. One-to-one: 2m + 1 = 2n + 1 ⇒ m = n. Onto: the values are 3, 5, 7, ..., so 1 and every even number have no pre-image; f is not onto. With the co-domain changed to the set of odd numbers greater than 1, f becomes a bijection.
Worked example 3: a cube is a bijection
f : R → R, f(x) = x³. One-to-one: if x³ = y³ then x³ − y³ = (x − y)(x² + xy + y²) = 0. The second factor equals (x + y/2)² + 3y²/4, which is zero only when x = y = 0; so in every case x = y. Onto: for any real y, x = ∛y is real and x³ = y. So f is a bijection. By contrast f(x) = x² on R is neither: f(−2) = f(2), and −1 has no pre-image.
Worked example 4: catching a hidden failure
Is f : R → R, f(x) = x/(x² + 1), one-to-one? Suppose f(x) = f(y). Then x(y² + 1) = y(x² + 1), so xy² + x − x²y − y = 0, that is xy(y − x) − (y − x) = 0, so (y − x)(xy − 1) = 0. Hence x = y or xy = 1. Choosing x = 2, y = 1/2: f(2) = 2/5 and f(1/2) = (1/2)/(5/4) = 2/5. Two different inputs, one output, so f is not one-to-one.
Worked example 5: pre-images and a suitable co-domain
For f : R → R, f(x) = 3x² + 2: the pre-images of 14 solve 3x² = 12, so x = 2 or x = −2; the only pre-image of 2 is 0; and −1 has none, because 3x² = −3 has no real solution. Next, for f : [0, 4] → B with f(x) = 2x + 1, the function increases from f(0) = 1 to f(4) = 9, so taking B = [1, 9] makes f onto.
Finding domains and ranges
To find the largest domain of a real function, exclude every x that makes a denominator zero or puts a negative number under an even root. For f(x) = √(x² − 7x + 10): we need x² − 7x + 10 = (x − 2)(x − 5) ≥ 0. Testing one point in each interval: x = 0 gives 10 > 0, x = 3 gives −2 < 0, x = 6 gives 4 > 0. So the domain is (−∞, 2] ∪ [5, ∞).
For f(x) = √(16 − x²)/√(x² − 4): the numerator needs 16 − x² ≥ 0, i.e. −4 ≤ x ≤ 4; the denominator needs x² − 4 > 0 (strictly, since it is under a root and also in the denominator), i.e. x < −2 or x > 2. Together: [−4, −2) ∪ (2, 4].
For the range of f(x) = 1/(2 + 3 sin x): since −1 ≤ sin x ≤ 1, we get −3 ≤ 3 sin x ≤ 3 and −1 ≤ 2 + 3 sin x ≤ 5. The denominator takes every value in [−1, 5] except that it must not be 0. On [−1, 0) the reciprocal gives values ≤ −1; on (0, 5] it gives values ≥ 1/5. So the range is (−∞, −1] ∪ [1/5, ∞). Domain: exclude sin x = −2/3.
Function: every input has exactly one output. One-to-one: f(x) = f(y) ⇒ x = y. Onto: range = co-domain. Bijective: both.
Key takeaways: state the domain and co-domain of every function; use the vertical line test to decide whether a curve is a function and the horizontal line test for one-to-one and onto; watch negative inputs in ⌊x⌋ and ⌈x⌉; and when solving f(x) = f(y), factor fully, because a second factor can hide extra solutions.
Check your understanding
-
1. What is ⌊−3.4⌋ + ⌈−3.4⌉?
- −6
- −8
- −7
- 0
Show answer
Answer: C. ⌊−3.4⌋ is the largest integer not exceeding −3.4, which is −4. ⌈−3.4⌉ is the smallest integer not below −3.4, which is −3. The sum is −4 + (−3) = −7.
-
2. For f : R → R, f(x) = 2x² − 3, what are the pre-images of 15?
- 3 only
- 3 and −3
- √6 and −√6
- There are none
Show answer
Answer: B. Solve 2x² − 3 = 15: 2x² = 18, x² = 9, so x = 3 or x = −3. Both are real, so 15 has two pre-images.
-
3. Which function from R to R is one-to-one but not onto?
- f(x) = 3x + 1
- f(x) = x²
- f(x) = x³
- f(x) = 2ˣ
Show answer
Answer: D. 2ˣ is strictly increasing, so it is one-to-one, but its values are always positive, so 0 and the negative numbers have no pre-image: not onto. 3x + 1 and x³ are bijections; x² is not one-to-one.
-
4. What is the largest domain of f(x) = √(x² − 9x + 20)?
- (−∞, 4] ∪ [5, ∞)
- [4, 5]
- (4, 5)
- (−∞, 4) ∪ (5, ∞)
Show answer
Answer: A. x² − 9x + 20 = (x − 4)(x − 5). It is ≥ 0 when x ≤ 4 or x ≥ 5 (at x = 4.5 it is −0.25, negative). The end points are included because √0 = 0 is defined.
-
5. If A has 4 elements and B has 6, which statement is true?
- There is an onto function from A to B
- There is no one-to-one function from A to B
- There is a one-to-one function from A to B, but no onto function
- There is a bijection from A to B
Show answer
Answer: C. Since 4 ≤ 6, the four elements can go to four different elements of B, so a one-to-one function exists. Four elements cannot cover six, so no onto function exists, and therefore no bijection.
Sign in to keep track of the lessons you finish.