If the target of one transformation S: X → Y is the same as the source of another transformation T: Y → Z, then we can combine the two transformations and form the composition TS: X → Z, TS(x) = T(S(x)).
Example The composition
(IDp)(Instructor): course → professor → number
is the same as
ID Number of the Instructor: course → number
(Population)(Capital City): country → city → number
is the same as
Population of the Capital City: country → number
Example We are familiar with the following exercise: Suppose y = x + 1 and z = y2. Then z = (x + 1)2 = x2 + 2x + 1. What we have done is actually composing two transformations
Add One: R → R, x → x + 1
Square: R → R, y → y2
to form a transformation
Add One and then Take square: R → R, x → (x + 1)2
For a multi-variable example, consider the transformations
T: R2 → R3,
(y1, y2) →
(z1, z2, z3) =
(y12 - 2y2,
y13 - 3y1y2,
y14 - 4y12y2 - 2y22)
S: R2 → R2, (x1, x2) → (y1, y2) = (x1 + x2, x1x2)
The composition TS is computed by substituting the formulae of y* (in terms of x*) into the formulae of z* (in terms of y*).
= (x1 + x2)2 - 2x1x2
= x12 + x22
z2 = (x1 + x2)3 - 3(x1 + x2)x1x2 = x13 + x23
z3 = (x1 + x2)4 - 4(x1 + x2)2x1x2 - 2(x1x2)2 = x14 + x24
Thus we have
TS(x1, x2) = (x12 + x22, x13 + x23, x14 + x24).
If transformations are given by formulae, then the composition is simply the substitution.
From the picture, we see that the composition TS is the reflection with respect to the line x + y = 0. Similarly, the following picture illustrates that the composition ST is the reflection with respect to the diagonal line x = y.