- Practice
- About 25 min
- 5 practice questions
Composition, inverse, algebra of functions, odd and even functions, and graph transformations
Form g∘f and decide when it exists, find the inverse of a bijection, add and multiply real functions, recognise polynomial, exponential, logarithmic and rational functions, test for odd and even, and sketch graphs by reflection, translation and dilation.
If something looks wrong, please tell us.
By the end of this lesson you can
- Find g∘f and f∘g, and explain why composition is not commutative.
- Find the inverse of a bijection and verify it with g∘f = I and f∘g = I.
- Define f + g, f − g, fg, f/g and cf for real-valued functions.
- Name polynomial, linear, exponential, logarithmic, rational and reciprocal functions.
- Decide whether a function is odd, even or neither.
- Sketch a new graph from a known one by reflection, translation and dilation.
Once functions are defined, we can combine them: feed the output of one into another, run one backwards, or add their values. These operations, and the habit of drawing new graphs from familiar ones, are used throughout calculus.
Composition
Let f : X → Y and g : Y → Z. The composition g∘f : X → Z is defined by (g∘f)(x) = g(f(x)): apply f first, then g. More generally g∘f can be formed exactly when the range of f is contained in the domain of g.
Computing (g∘f)(x)
- Start with x x in the domain of f
- Apply f get f(x), which must lie in the domain of g
- Apply g get g(f(x)) = (g∘f)(x)
Worked example 1: composition of finite functions
Let f = {(1, 3), (2, 4), (3, 3)} and g = {(3, 5), (4, 6), (5, 7)}. Range of f = {3, 4} ⊆ domain of g = {3, 4, 5}, so g∘f exists: (g∘f)(1) = g(3) = 5, (g∘f)(2) = g(4) = 6, (g∘f)(3) = g(3) = 5. So g∘f = {(1, 5), (2, 6), (3, 5)}. But the range of g, {5, 6, 7}, is not contained in the domain of f, {1, 2, 3}, so f∘g is not defined.
Worked example 2: composition is not commutative
Let f(x) = 2x + 1 and g(x) = x² − 2 on R. (g∘f)(x) = g(2x + 1) = (2x + 1)² − 2 = 4x² + 4x + 1 − 2 = 4x² + 4x − 1. (f∘g)(x) = f(x² − 2) = 2(x² − 2) + 1 = 2x² − 3. Check at x = 1: (g∘f)(1) = g(3) = 7 and 4 + 4 − 1 = 7; (f∘g)(1) = f(−1) = −1 and 2 − 3 = −1. Since 7 ≠ −1, g∘f ≠ f∘g in general.
Theorem. If f : A → B and g : B → C are both one-to-one, so is g∘f. Proof: if x ≠ y then f(x) ≠ f(y), since f is one-to-one, and then g(f(x)) ≠ g(f(y)), since g is one-to-one. The converse fails: f and g∘f can be one-to-one while g is not. For instance, with f = {(1, a), (2, b)} into Y = {a, b, c} and g = {(a, p), (b, q), (c, p)}, the composite g∘f = {(1, p), (2, q)} is one-to-one, but g sends a and c to the same p.
Inverse of a function
Let f : X → Y be a bijection. Its inverse f⁻¹ : Y → X is defined by f⁻¹(y) = x when f(x) = y: it undoes f. Only bijections have inverses. If f is not one-to-one, some y has two pre-images and f⁻¹(y) would need two values; if f is not onto, some y has no pre-image and f⁻¹(y) would have none. Equivalently, f is invertible if there is g : Y → X with g∘f = I_X and f∘g = I_Y; then g = f⁻¹, and both f and g are bijections.
For example, if f = {(1, 3), (2, 1), (3, 2)} on {1, 2, 3}, then f⁻¹ = {(3, 1), (1, 2), (2, 3)}: just reverse every pair. Working rule for a real function: write y = f(x); solve for x in terms of y; this gives f⁻¹(y); then rename y as x.
Worked example 3: inverse of a linear function
Show f : R → R, f(x) = 5x + 2, is a bijection and find f⁻¹. One-to-one: 5x + 2 = 5y + 2 ⇒ x = y. Onto: given y, the number x = (y − 2)/5 is real and f(x) = 5(y − 2)/5 + 2 = y. Inverse: y = 5x + 2 ⇒ x = (y − 2)/5, so f⁻¹(x) = (x − 2)/5. Verify: f⁻¹(f(x)) = (5x + 2 − 2)/5 = x and f(f⁻¹(x)) = 5(x − 2)/5 + 2 = x.
Worked example 4: inverse of a rational function
Let f : R − {2} → R − {1}, f(x) = (x + 3)/(x − 2). Write y = (x + 3)/(x − 2). Then y(x − 2) = x + 3, so yx − 2y = x + 3, so x(y − 1) = 2y + 3 and x = (2y + 3)/(y − 1), which is defined because y ≠ 1. Hence f⁻¹(x) = (2x + 3)/(x − 1). Check: f(3) = 6/1 = 6 and f⁻¹(6) = 15/5 = 3.
Algebra of real functions
If f and g are real-valued functions on the same set X, define for every x ∈ X: (f + g)(x) = f(x) + g(x); (f − g)(x) = f(x) − g(x); (fg)(x) = f(x)g(x); (f/g)(x) = f(x)/g(x) where g(x) ≠ 0; (cf)(x) = c f(x) for a real constant c; and (−f)(x) = −f(x). The domain need not be a set of numbers: if f and g give each student's marks in two tests, f + g gives the total. These operations obey the usual rules, such as f + g = g + f, (f + g) + h = f + (g + h), f + 0 = f, f + (−f) = 0 and f(g + h) = fg + fh, each proved by checking the equality at every x.
Example: f(x) = x² and g(x) = x + 1. (f + g)(2) = 4 + 3 = 7, (fg)(2) = 4 × 3 = 12, and (f/g)(x) = x²/(x + 1) for x ≠ −1.
Some special functions
- Polynomial function: f(x) = a₀xⁿ + a₁xⁿ⁻¹ + ... + aₙ₋₁x + aₙ with constant coefficients.
- Linear function: f(x) = ax + b with a ≠ 0; its graph is a straight line.
- Exponential function: f(x) = aˣ with a > 1, such as 2ˣ, 3ˣ and eˣ, where e is an irrational number between 2 and 3. (For a = 1 we get the constant function 1.)
- Logarithmic function: f(x) = logₐ x on (0, ∞) with a > 1, the inverse of aˣ.
- Rational function: p(x)/q(x) with polynomials p and q, defined wherever q(x) ≠ 0.
- Reciprocal function of f: 1/f(x), defined wherever f(x) ≠ 0; for example 1/(x − 1) has largest domain R − {1}.
Odd and even functions
f : R → R is even if f(−x) = f(x) for all x (its graph is symmetric about the y-axis), and odd if f(−x) = −f(x) for all x (its graph is symmetric about the origin). x², x⁴ + x², |x| and the constant 3 are even; x, 2x and x³ + 2x are odd; x + x² is neither. A function that is not odd need not be even.
Test: for f(x) = x³ − 4x, f(−x) = −x³ + 4x = −(x³ − 4x) = −f(x), so f is odd. For g(x) = x⁴ + 3x² + 1, g(−x) = x⁴ + 3x² + 1 = g(x), so g is even. For h(x) = x² + x, h(−1) = 0 but h(1) = 2, so h(−1) is neither h(1) nor −h(1): h is neither.
Useful facts: odd + odd is odd; even + even is even; odd × odd and even × even are even; odd × even is odd; a constant times an even function is even and a constant times an odd function is odd; the only function that is both odd and even is the zero function. Proof that odd × even is odd: let f be odd, g even and h = fg. Then h(−x) = f(−x)g(−x) = (−f(x))g(x) = −h(x).
Graphing by transformations
Instead of plotting many points, start from a known graph and move it. Reflections and translations give a congruent copy; dilations stretch or compress it.
| New graph | Effect on the graph of y = f(x) |
|---|---|
| y = −f(x) | reflection in the x-axis |
| y = f(−x) | reflection in the y-axis |
| y = f⁻¹(x) | reflection in the line y = x |
| y = f(x + c), c > 0 | shift c units left |
| y = f(x − c), c > 0 | shift c units right |
| y = f(x) + d, d > 0 | shift d units up |
| y = f(x) − d, d > 0 | shift d units down |
| y = k f(x), k > 1 | vertical stretch, away from the x-axis |
| y = k f(x), 0 < k < 1 | vertical compression, towards the x-axis |
| y = f(kx), k > 1 | horizontal compression towards the y-axis by the factor k |
For instance y = eˣ and y = logₑ x are mirror images in y = x, because each is the inverse of the other. y = |x − 1| is y = |x| moved 1 unit right, and y = |x| + 1 is it moved 1 unit up. y = 2x² is narrower than y = x² and y = ½x² is wider. In y = (3x)² − 1 the x-scale is squeezed by 3: the x-intercepts move from ±1 for y = x² − 1 to ±1/3, while the y-intercept −1 stays. Likewise sin 2x has the same maximum 1 and minimum −1 as sin x, but crosses the x-axis at multiples of π/2 instead of π.
Worked example 5: building a graph step by step
Sketch y = 2(x − 3)² + 1 from y = x². Step 1: y = (x − 3)², shift 3 units right; the vertex moves from (0, 0) to (3, 0). Step 2: y = 2(x − 3)², stretch vertically by 2; the vertex stays at (3, 0) and the arms rise twice as fast. Step 3: y = 2(x − 3)² + 1, shift 1 unit up; the vertex is now (3, 1). Check one point: at x = 4, y = 2(1)² + 1 = 3, which is 2 × 1 + 1, as expected.
From y = sin x to y = 3 sin(x + 1) − 2
- y = sin x the known curve
- y = sin(x + 1) shift 1 unit left
- y = 3 sin(x + 1) stretch vertically by 3; values now between −3 and 3
- y = 3 sin(x + 1) − 2 shift 2 units down; values between −5 and 1
(g∘f)(x) = g(f(x)): f first. Only bijections have inverses, and f⁻¹(f(x)) = x. Even: f(−x) = f(x). Odd: f(−x) = −f(x). f(x − c) moves right, f(x) + d moves up.
Key takeaways: check that the range of f lies in the domain of g before forming g∘f; composition is usually not commutative; to invert, solve y = f(x) for x and verify both compositions; even graphs mirror in the y-axis and odd graphs turn half a revolution about the origin; and a complicated graph is often a familiar one shifted, reflected and stretched.
Check your understanding
-
1. If f(x) = x² + 1 and g(x) = 3x − 2, what is (f∘g)(1)?
- 2
- 4
- 10
- 5
Show answer
Answer: A. (f∘g)(1) = f(g(1)) = f(3 − 2) = f(1) = 1² + 1 = 2. (Working the other way, (g∘f)(1) = g(2) = 4, which shows the order matters.)
-
2. What is the inverse of f : R → R, f(x) = (x − 7)/4?
- f⁻¹(x) = 4x − 7
- f⁻¹(x) = (x + 7)/4
- f⁻¹(x) = 4x + 7
- f⁻¹(x) = 4/(x − 7)
Show answer
Answer: C. Write y = (x − 7)/4. Then 4y = x − 7, so x = 4y + 7, and renaming y as x gives f⁻¹(x) = 4x + 7. Check: f(4x + 7) = (4x + 7 − 7)/4 = x.
-
3. Which function is odd?
- f(x) = x⁴ − x²
- f(x) = x³ + 1
- f(x) = |x|
- f(x) = x⁵ − 3x
Show answer
Answer: D. For f(x) = x⁵ − 3x, f(−x) = −x⁵ + 3x = −(x⁵ − 3x) = −f(x), so it is odd. x⁴ − x² and |x| are even, and x³ + 1 gives f(−x) = −x³ + 1, which is neither f(x) nor −f(x).
-
4. The graph of y = |x + 4| − 3 is obtained from y = |x| by
- shifting 4 units left and 3 units down
- shifting 4 units right and 3 units up
- shifting 4 units left and 3 units up
- shifting 4 units right and 3 units down
Show answer
Answer: A. f(x + 4) with 4 > 0 moves the graph 4 units left, and subtracting 3 moves it 3 units down. The corner of the V moves from (0, 0) to (−4, −3).
-
5. If f is an odd function and g is an even function, then h(x) = f(x)g(x) is
- even
- odd
- neither odd nor even in every case
- always the zero function
Show answer
Answer: B. h(−x) = f(−x)g(−x) = (−f(x))(g(x)) = −h(x), so the product of an odd and an even function is odd.
Sign in to keep track of the lessons you finish.