Grade by Grade
D. Characteristics of Functions · Combining Functions and Modelling

Transformations as Composition with Linear Functions

D2.8About 70 minutes
Learning goals
  • I can explain that f(A(x + B)) is f composed with the linear function g(x) = A(x + B), and that it transforms the graph horizontally.
  • I can explain that A(f(x) + B) is a linear function composed with f, and that it transforms the graph vertically.
  • I can find the image of key points under these compositions using mapping rules.
  • I can write any transformation y = a f(k(x − d)) + c as a chain of compositions.

Words to know

transformation
A change to a graph: a translation (shift), a reflection, or a stretch or compression.
linear function
A function of the form g(x) = mx + b. Here it is written g(x) = A(x + B).
mapping rule
A rule that shows where each point (x, y) moves, such as (x, y) → (x/2 − π/4, y).
horizontal compression
A transformation that squeezes the graph toward the y-axis. In f(Ax) with |A| > 1, every x-coordinate is divided by A.

You have been composing all along

In Grade 11 (MCR3U, Functions and Equivalent Expressions) you learned to sketch y = a f(k(x − d)) + c by applying stretches, reflections and translations. Here is a new way to see it: every transformation is a composition with a linear function.

  • Putting a linear function inside f, as in f(2x + 1), changes the inputs, so it moves the graph horizontally.
  • Putting f inside a linear function, as in 3f(x) − 4, changes the outputs, so it moves the graph vertically.

This lesson connects the two ideas. It also explains a classic trap: why sin(2x + π/2) is shifted π/4, not π/2.

y =a( · ) + cfk(x − d)3rd: outside linearacts on y: vertical2nd: f1st: inside linearacts on x: horizontalx enters herey = a f(k(x − d)) + c is h₂(f(h₁(x))), with h₁(x) = k(x − d) and h₂(x) = ax + c
A full transformation is a chain of three functions: a linear function acting on x, then f, then a linear function acting on the output.

Inside: f(g(x)) with g(x) = A(x + B)

Let g(x) = A(x + B). Then f(g(x)) = f(A(x + B)). Compared with y = f(x):

  • a horizontal stretch or compression by the factor 1/|A| (a compression if |A| > 1, a stretch if |A| < 1),
  • a reflection in the y-axis if A < 0,
  • a horizontal translation of B units left (if B > 0) or |B| units right (if B < 0).

Mapping rule: a point (x, y) on f moves to (x/A − B, y). Why? The new graph has the height y at the input x' where A(x' + B) = x, so x' = x/A − B.

Order matters inside: stretch or reflect first, then translate, which is what the mapping rule does.

Worked example

Example 1: f(x) = sin x and g(x) = 2(x + π/4)

Describe y = f(g(x)) = sin(2(x + π/4)), find the image of (π/2, 1), and state the period.

  1. Here A = 2 and B = π/4: a horizontal compression by the factor 1/2, then a translation π/4 left.
  2. Mapping rule: (x, y) → (x/2 − π/4, y). The maximum (π/2, 1) moves to (π/4 − π/4, 1) = (0, 1).
  3. Check: sin(2(0 + π/4)) = sin(π/2) = 1 ✓.
  4. Period: 2π ÷ 2 = π.
  5. Expanded, the function is sin(2x + π/2). The phase shift is π/4, not π/2: always factor out A to read the shift. (You may also notice that sin(2x + π/2) = cos 2x, an identity from the sibling unit Trigonometric Identities and Equations.)

y = sin(2(x + π/4)) is y = sin x compressed horizontally by 1/2 and shifted π/4 left; (π/2, 1) → (0, 1); period π.

−π−π/2π/2π3π/22π1−1xy(π/2, 1) → (0, 1)y = sin xy = sin(2(x + π/4))Mapping: x → x/2 − π/4period 2π → π
Composing sin x (dashed) with g(x) = 2(x + π/4) gives the solid curve. Every point moves by the mapping rule; the maximum at (π/2, 1) moves to (0, 1).

Outside: g(f(x)) with g(x) = A(x + B)

Now put f inside: g(f(x)) = A(f(x) + B) = A f(x) + AB. Read it as two steps on the output:

  1. add B (a vertical translation of B units), then
  2. multiply by A (a vertical stretch by the factor |A|, with a reflection in the x-axis if A < 0).

Mapping rule: (x, y) → (x, A(y + B)). The x-coordinates do not change.

If you expand, A(f(x) + B) = A f(x) + AB: a stretch by A followed by a translation of AB. Both descriptions give the same graph.

Worked example

Example 2: f(x) = sin x, outside this time

Let g(x) = 2(x + π/4). Describe g(f(x)) = 2(sin x + π/4) and find its maximum and minimum values.

  1. Mapping rule: (x, y) → (x, 2(y + π/4)).
  2. The maximum of sin x is 1, so the new maximum is 2(1 + π/4) = 2 + π/2 ≈ 3.57.
  3. The minimum of sin x is −1, so the new minimum is 2(−1 + π/4) = −2 + π/2 ≈ −0.43.
  4. Expanded: y = 2 sin x + π/2: amplitude 2, axis y = π/2 ≈ 1.57, period still 2π (the inside was not touched).

y = 2 sin x + π/2: amplitude 2, maximum about 3.57, minimum about −0.43, period 2π. Compare Example 1: same g, opposite order, a completely different graph.

Worked example

Example 3: Logarithms and a reflection

Let f(x) = log x and g(x) = −(x − 3). Describe f(g(x)) and g(f(x)), and give their domains and asymptotes.

  1. g(x) = −(x − 3) has A = −1 and B = −3.
  2. Inside: f(g(x)) = log(−(x − 3)) = log(3 − x). Reflect in the y-axis, then translate 3 right. Mapping (x, y) → (−x + 3, y): (1, 0) → (2, 0) and (10, 1) → (−7, 1).
  3. Domain: 3 − x > 0, so x < 3. The vertical asymptote x = 0 moves to x = 3.
  4. Outside: g(f(x)) = −(log x − 3) = 3 − log x. Translate down 3, then reflect in the x-axis (equivalently, reflect, then translate up 3). Mapping (x, y) → (x, −(y − 3)): (1, 0) → (1, 3), (10, 1) → (10, 2).
  5. Domain: x > 0; the asymptote stays x = 0 (vertical changes do not move vertical asymptotes).

log(3 − x): domain x < 3, asymptote x = 3. 3 − log x: domain x > 0, asymptote x = 0, decreasing.

-8-6-4-22468101−1xy(10, 1)(−7, 1)x = 3y = log xy = log(−(x − 3)) = log(3 − x)Mapping: x → −x + 3(1, 0) → (2, 0)
log x (dashed) composed with g(x) = −(x − 3) on the inside gives log(3 − x) (solid): reflected in the y-axis and shifted 3 right, with asymptote x = 3. Its points are (2, 0) and (−7, 1).
Worked example

Example 4: A polynomial, both ways

Let f(x) = x³ + 20 and g(x) = (1/2)(x + 4). Find the images of the points (0, 20) and (2, 28) under f(g(x)) and under g(f(x)), and write both equations.

  1. Inside: A = 1/2, B = 4. Mapping (x, y) → (x ÷ (1/2) − 4, y) = (2x − 4, y).
  2. (0, 20) → (−4, 20) and (2, 28) → (0, 28). Equation: y = ((x + 4)/2)³ + 20. Check: x = 0 gives 2³ + 20 = 28 ✓.
  3. Outside: mapping (x, y) → (x, (1/2)(y + 4)).
  4. (0, 20) → (0, 12) and (2, 28) → (2, 16). Equation: y = (1/2)(x³ + 24) = (1/2)x³ + 12. Check: x = 2 gives 4 + 12 = 16 ✓.

f(g(x)) = ((x + 4)/2)³ + 20: stretched horizontally by 2 and shifted 4 left. g(f(x)) = (1/2)x³ + 12: compressed vertically by 1/2 after a shift up 4.

Reading y = a f(k(x − d)) + c as a composition

Write h₁(x) = k(x − d) (this is A(x + B) with A = k and B = −d) and h₂(x) = ax + c. Then y = h₂(f(h₁(x))). The inside function makes the horizontal changes (factor 1/|k|, then shift d); the outside function makes the vertical changes (factor |a|, then shift c). With graphing technology, you can enter f(A(x + B)) and A(f(x) + B) with sliders for A and B and watch the two kinds of change happen.

Just for fun

A sine curve walked out of a composition shifted π/4 to the left. Its friends asked what happened. "Nothing," it said. "I'm the same function. Somebody just changed my input."

Hands-on activity

Transform by mapping rule

You need: grid paper, a pencil, a ruler and a calculator (optional: a free online grapher such as Desmos on a computer or phone).

  1. Make a table of key points of y = x³ + 20: (−2, 12), (−1, 19), (0, 20), (1, 21), (2, 28).
  2. Apply the inside rule for g(x) = (1/2)(x + 4): (x, y) → (2x − 4, y). Plot the new points and join them.
  3. Apply the outside rule for the same g: (x, y) → (x, (1/2)(y + 4)). Plot and join.
  4. Check one new point of each graph by substituting it into its equation.
  5. Optional: in the grapher, type f(x) = x³ + 20, then y = f(A(x + B)) and y = A(f(x) + B), and add sliders for A and B. Drag A from 2 to −2 and watch the reflection.

What to look for: inside: (−8, 12), (−6, 19), (−4, 20), (−2, 21), (0, 28): the same heights, spread out twice as wide and centred at x = −4. Outside: (−2, 8), (−1, 11.5), (0, 12), (1, 12.5), (2, 16): the same x-values, with heights squeezed toward y = 0 by half after a shift up 4. With the sliders, a negative A flips the inside graph left-to-right and the outside graph upside down.

Your turn

1

f(x) = √x and g(x) = 3(x − 2). Describe f(g(x)) and give the image of (4, 2).

2

Same f and g. Describe g(f(x)) and give the image of (4, 2).

3

Write y = cos(3x − π) in the form f(A(x + B)) and state the phase shift.

4

f(x) = 2ˣ. Which linear g makes f(g(x)) = 2^(−x + 5)? Describe the transformation.

5

f(x) = log x. Describe y = 2 log x − 6 as g(f(x)) with g(x) = A(x + B).

6

y = 4 sin(2x + π) − 1 = h₂(f(h₁(x))). Find h₁ and h₂.

More practice: warm-up

1

Does f(x + 3) move the graph horizontally or vertically?

2

Does f(x) + 3 move the graph horizontally or vertically?

3

f(2x) is a horizontal ___ by a factor of ___.

4

f(−x) is a reflection in which axis?

5

−f(x) is a reflection in which axis?

More practice: on your own

1

Apply the mapping for f(g(x)) with g(x) = −2(x + 1) to the point (6, 5).

2

f(x) = 1/x. Find f(g(x)) for g(x) = 2(x − 3), and state the asymptotes.

3

Show that for f(x) = x², f(3x) and 9f(x) are the same function. Explain in terms of transformations.

4

f(x) = sin x. Write y = −2 sin(x/2 + π/4) + 3 as h₂(f(h₁(x))) and state amplitude, period and phase shift.

5

The graph of y = log x is transformed to y = log(10x). Show that this is the same as a vertical translation.

Challenge

1

Find A and B so that f(A(x + B)) = sin(4x − 2π) is the same graph as y = sin(4x).

2

For f(x) = 2ˣ, show that every horizontal translation f(x + B) equals a vertical stretch C·f(x), and find C in terms of B.

3

Let g(x) = A(x + B). Find the composition g(g(x)), and find A and B so that g(g(x)) = x for every x, other than g(x) = x.

Check your understanding

Quiz

1.

f(g(x)) with g(x) = A(x + B) changes the graph of f in which direction?

2.

What is the phase shift of y = sin(3x + π)?

3.

f(x) = log x and g(x) = x − 5. Which describes g(f(x))?

4.

Under f(g(x)) with g(x) = 2(x − 1), where does the point (6, 4) on f move?

5.

Which composition reflects the graph of f in the y-axis?

6.

y = −3f(x) + 6 can be written as A(f(x) + B). What are A and B?

For parents and teachers

Big idea: D2.8 asks students to connect transformations of simple functions (such as x³ + 20, sin x and log x) with composition: f(A(x + B)) gives the horizontal changes and A(f(x) + B) gives the vertical changes. This unifies the Grade 11 transformation rules with the idea of composition.

How to help: ask "Is the change inside the brackets (horizontal) or outside (vertical)?" and "Did you factor out A before reading the shift?" A free grapher with sliders makes this lesson very visual.

Common difficulties:

  • Reading sin(2x + π/2) as a shift of π/2 instead of π/4.
  • Thinking f(2x) stretches the graph by 2 (it compresses by 1/2).
  • Moving vertical asymptotes with vertical transformations, or horizontal asymptotes with horizontal ones.
  • Applying a translation before a stretch in the mapping rule.

The mapping rule for the inside, (x, y) → (x/A − B, y), comes from solving A(x' + B) = x for x'.