- Practice
- About 13 min
- 5 practice questions
Recognising, evaluating and counting functions
Decide quickly whether a relation is a function, evaluate nested and shifted expressions such as f(f(3)) and f(x + 1), and count functions and one-one functions between finite sets.
If something looks wrong, please tell us.
The first questions on functions in a paper are usually short: is this relation a function, what is f(f(3)), find f(x) from f(x + 1), or how many functions are there from one set to another. Each takes under a minute with the right method and much longer without it. This lesson sets out those methods and the traps that come with each.
Is it a function?
A relation from A to B is a function when every element of A has exactly one image. For relations given by a rule on R, the quickest test is to ask whether some x gives two values of y. The rule y = x² − 4 gives one y for each x, so it is a function. The rule x = y² is not: x = 4 gives y = 2 and y = −2. On a graph this is the vertical line test: if some vertical line meets the graph twice, the graph is not that of a function of x.
Counting functions between finite sets
Let n(A) = m and n(B) = n. To build a function from A to B, each of the m elements of A independently chooses one of the n elements of B, so there are n × n × ... × n = n^m functions. Note the order: the size of the codomain is the base and the size of the domain is the power. For one-one functions, the images must all be different: the first element has n choices, the second n − 1, and so on, giving n(n − 1)(n − 2)...(n − m + 1) when m ≤ n, and none when m > n. When m = n, every one-one function is also onto, and there are n × (n − 1) × ... × 1 bijections.
Worked example 1: counting functions
How many functions are there from A = {1, 2, 3} to B = {a, b}, and from B to A? From A to B, each of 3 elements chooses one of 2 images: 2³ = 8. From B to A, each of 2 elements chooses one of 3 images: 3² = 9. The two answers differ, which is why the order of base and power matters. None of the 8 functions from A to B is one-one, since three elements cannot have three different images in a two-element set.
Worked example 2: one-one functions
How many one-one functions are there from {1, 2} to {a, b, c, d}? The element 1 can go to any of 4 letters; then 2 must go to one of the remaining 3. So there are 4 × 3 = 12 one-one functions, out of 4² = 16 functions in total. The other 4 functions send both elements to the same letter.
Evaluating nested and shifted forms
For f(f(a)), work from the inside: find f(a), then apply f to that number. For an expression such as f(x + h), replace every x in the formula by the whole bracket (x + h). The reverse problem gives f(x + 1) and asks for f(x). Substitute t = x + 1, so x = t − 1, rewrite everything in t, and finally rename t as x.
Worked example 3: from f(x + 1) to f(x)
Given f(x + 1) = x² + 3x + 5, find f(x) and f(2). Put t = x + 1, so x = t − 1. Then f(t) = (t − 1)² + 3(t − 1) + 5 = t² − 2t + 1 + 3t − 3 + 5 = t² + t + 3. So f(x) = x² + x + 3 and f(2) = 4 + 2 + 3 = 9. Check with the original form: f(2) means x + 1 = 2, so x = 1, and 1 + 3 + 5 = 9. Agreement of the two routes confirms the algebra.
Common traps
- Writing m^n instead of n^m for the number of functions from an m-set to an n-set.
- Forgetting that an element of the domain with no image makes a relation fail to be a function.
- Treating a shared image as a failure; it is allowed.
- Squaring a negative input without brackets: f(−2) for x² − 3x is 4 + 6, not −4 + 6.
From an m-element set to an n-element set: n^m functions, and n(n − 1)...(n − m + 1) one-one functions when m ≤ n. To find f(x) from f(x + h), substitute t = x + h.
Key takeaways
A relation is a function when each input has exactly one output. Count functions as (codomain size)^(domain size), and one-one functions as a falling product. Evaluate nested forms from the inside out. Recover f(x) from a shifted form by substitution, and check one value both ways.
Check your understanding
-
1. n(A) = 4 and n(B) = 2. How many functions are there from A to B?
- 8
- 16
- 6
- 24
Show answer
Answer: B. Each of the 4 elements of A chooses one of 2 images: 2^4 = 16.
-
2. How many one-one functions are there from {1, 2, 3} to {a, b, c, d}?
- 24
- 64
- 12
- 4
Show answer
Answer: A. The images must be different: 4 × 3 × 2 = 24. (4³ = 64 counts all functions.)
-
3. f(x) = 2x − 1. What is f(f(3))?
- 5
- 9
- 11
- 17
Show answer
Answer: B. Inside first: f(3) = 5. Then f(5) = 9.
-
4. If f(x − 1) = x² for all real x, then f(x) equals
- (x − 1)²
- (x + 1)²
- x² + 1
- x² − 1
Show answer
Answer: B. Put t = x − 1, so x = t + 1 and f(t) = (t + 1)². Check: f(0) should equal 1² = 1, and (0 + 1)² = 1.
-
5. Which of these is NOT a function from R to R?
- {(x, y) : y = x² − 4}
- {(x, y) : y = |x − 1|}
- {(x, y) : y = 3}
- {(x, y) : x = y²}
Show answer
Answer: D. For x = 4, x = y² gives y = 2 and y = −2, two images. Also negative x have no image. The other rules give exactly one y for each x.
Sign in to keep track of the lessons you finish.