### Composition and Matrix Multiplication

##### 1. Composition of transformations

If the target of one transformation S: XY is the same as the source of another transformation T: YZ, then we can combine the two transformations and form the composition TS: XZ, TS(x) = T(S(x)).

Example The composition

(IDp)(Instructor): course → professor → number

is the same as

ID Number of the Instructor: course → number

The composition

(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: RR, xx + 1
Square: RR, yy2

to form a transformation

Add One and then Take square: RR, x → (x + 1)2

For a multi-variable example, consider the transformations

T: R2R3, (y1, y2) → (z1, z2, z3) = (y12 - 2y2, y13 - 3y1y2, y14 - 4y12y2 - 2y22)
S: R2R2, (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*).

z1 = (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.

Example Let T and S be the reflection in x-axis and the rotation by 90 degrees on the plane R2. The following picture illustrates the composition TS.

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.