- Practice
- About 17 min
- 5 practice questions
Functions and how to represent them
Decide when a relation is a function, find images, pre-images, domain, co-domain and range, evaluate a function given by a formula, show it in four ways, and use the vertical line test on a graph.
If something looks wrong, please tell us.
By the end of this lesson you can
- State when a relation from X to Y is a function and test arrow diagrams and sets of pairs.
- Find f(a), f(x + 1) and the domain of a function given by a formula, and count functions from A to B.
- Represent a function as ordered pairs, a table, an arrow diagram and a graph, and apply the vertical line test.
Each student in your class has exactly one age; each book in a shop has exactly one price, although many books may share a price. Relations of this 'exactly one output for every input' kind are so useful that they get their own name: functions. The textbook pictures a function as a machine: put in x and exactly one output f(x) comes out.
Definition of a function
A relation f from a non-empty set X to a non-empty set Y is a function from X to Y if, for each x ∈ X, there is only one y ∈ Y with (x, y) ∈ f. We write f : X → Y and y = f(x). A function is also called a mapping or a transformation. Two conditions must both hold: (i) every element of X has an image, and (ii) that image is unique.
- X is the domain and Y is the co-domain of f.
- If f(a) = b, then b is the image of a and a is a pre-image of b.
- The set of all images is the range of f; it is a subset of the co-domain.
- Every function is a relation, and every relation is a subset of a cartesian product, but not every relation is a function.
Relation or function?
-
Every relation
- Any subset of X × Y
- Some elements of X may have no partner
- An element of X may have several partners
-
A function
- A special relation
- Every element of X has a partner
- Each element of X has exactly one partner
- Two elements of X may share a partner
Worked example 1: which relations are functions?
Let X = {1, 2, 3, 4} and Y = {p, q, r}. (i) R₁ = {(1, p), (2, q), (3, p)}: 4 has no image, so not a function. (ii) R₂ = {(1, q), (2, q), (3, r), (4, p)}: every element has exactly one image, so a function, even though 1 and 2 share q. Its range is {p, q, r}. (iii) R₃ = {(1, p), (2, q), (3, r), (4, p), (2, r)}: 2 has two images q and r, so not a function.
If n(A) = m and n(B) = n, the number of functions from A to B is nᵐ (each of the m elements of A has n choices).
Evaluating a function given by a formula
To find f(a), replace x by a everywhere in the formula. To find f(x + 1), replace x by the whole expression (x + 1), in brackets.
Worked example 2: f(x) = x² − 3x
Working: (i) f(−2) = (−2)² − 3(−2) = 4 + 6 = 10. (ii) f(x + 1) = (x + 1)² − 3(x + 1) = x² + 2x + 1 − 3x − 3 = x² − x − 2. (iii) f(x) + f(1) = (x² − 3x) + (1 − 3) = x² − 3x − 2. Comparing (ii) and (iii) shows f(x + 1) ≠ f(x) + f(1): in general f(a + b) is not f(a) + f(b).
Domain of a function given by a formula
In this chapter f is a real valued function, and its domain is every real number for which the formula makes sense. Division by zero is not allowed, so remove the values that make a denominator zero. For f(x) = 1/(x − 3) the domain is ℝ − {3}. For g(x) = 1/(x² − 7x + 12), factorise: x² − 7x + 12 = (x − 3)(x − 4), which is zero at x = 3 and x = 4, so the domain is ℝ − {3, 4}.
Four ways to represent a function
Take A = {0, 1, 2, 3}, B = {1, 3, 5, 7, 9} and f : A → B, f(x) = 2x + 1. Working: f(0) = 1, f(1) = 3, f(2) = 5, f(3) = 7.
- Set of ordered pairs: f = {(0, 1), (1, 3), (2, 5), (3, 7)}.
- Table form: a row of x values 0, 1, 2, 3 above a row of f(x) values 1, 3, 5, 7.
- Arrow diagram: arrows 0 → 1, 1 → 3, 2 → 5, 3 → 7; the element 9 of B receives no arrow.
- Graph: plot the points (0, 1), (1, 3), (2, 5), (3, 7) in the XY-plane.
| x | 0 | 1 | 2 | 3 |
|---|---|---|---|---|
| f(x) = 2x + 1 | 1 | 3 | 5 | 7 |
The vertical line test
Every function can be drawn as a curve, but not every curve is a function. A curve represents a function if every vertical line meets it in at most one point. If some vertical line meets it twice, one x has two y values. The parabola y = x² passes the test. The circle x² + y² = 9 fails: the vertical line x = 0 meets it at (0, 3) and (0, −3).
Applying the vertical line test
- Imagine vertical lines across the graph Slide a ruler held upright from left to right.
- Count meeting points on each line Look closely where the curve turns back.
- Any line meets it twice or more? Then one x has two outputs: not a function.
- Every line meets it at most once The curve is the graph of a function.
Key takeaways: a function sends every element of its domain to exactly one element of its co-domain; the range is the set of images. Substitute carefully, with brackets, to evaluate f. Remove values that make a denominator zero to find the domain. There are nᵐ functions from a set of m elements to a set of n elements. A curve is a function exactly when no vertical line cuts it twice.
Check your understanding
-
1. Let X = {1, 2, 3} and Y = {a, b}. Which relation is a function from X to Y?
- {(1, a), (2, b)}
- {(1, a), (2, a), (3, b)}
- {(1, a), (1, b), (2, a), (3, b)}
- {(1, a), (2, b), (3, c)}
Show answer
Answer: B. {(1, a), (2, a), (3, b)} gives each of 1, 2, 3 exactly one image in Y, so it is a function. In {(1, a), (2, b)} the element 3 has no image; in the third set 1 has two images; in the last set c is not in Y.
-
2. If f(x) = 3x² − 1, what is f(−2)?
- 11
- −13
- 35
- 13
Show answer
Answer: A. f(−2) = 3(−2)² − 1 = 3 × 4 − 1 = 12 − 1 = 11. Squaring −2 gives +4, not −4.
-
3. How many functions are there from a set with 3 elements to a set with 2 elements?
- 6
- 9
- 8
- 64
Show answer
Answer: C. Each of the 3 elements has 2 choices of image, so the number is 2 × 2 × 2 = 2³ = 8. (9 = 3² would be functions from a 2-element set to a 3-element set.)
-
4. What is the domain of f(x) = 1/(x² − 5x + 6)?
- ℝ
- ℝ − {−2, −3}
- ℝ − {1, 6}
- ℝ − {2, 3}
Show answer
Answer: D. The denominator must not be zero. x² − 5x + 6 = (x − 2)(x − 3), which is zero at x = 2 and x = 3. So the domain is ℝ − {2, 3}.
-
5. Which of these curves fails the vertical line test?
- The line y = 2x + 1
- The parabola y = x²
- The circle x² + y² = 9
- The horizontal line y = 4
Show answer
Answer: C. The vertical line x = 0 meets the circle at (0, 3) and (0, −3): one x value with two y values, so the circle is not the graph of a function. Every vertical line meets each of the other curves exactly once.
Sign in to keep track of the lessons you finish.