### Composition and Matrix Multiplication

##### 4. Composition/multiplication mixed with addition and scalar multiplication

Consider the following equivalent columns.

Our answer to 1^{?} is the matrix multiplication.
What should be the answer to 2^{?} and 3^{?}?

From the explicit formula for `Ax`, it is easy to see that

(**A** + **B**)**x** = `Ax` + `Bx`,
(`c`**A**)**x** = `c`(`Ax`).

Therefore the answer to 2^{?} is the following definition,

For linear transformations **T**, **S**:
**R**^{n} → **R**^{m},
their addition **T** + **S** is defined by the formula
(**T** + **S**)(**x**) =
**T**(**x**) + **S**(**x**)

and the answer to 3^{?} is the following definition.

For a linear transformation **T**:
**R**^{n} → **R**^{m},
and a number `r`, the scalar multiplication `r`**T** is defined by the formula
(`r`**T**)(**x**) = `r`(**T**(**x**))

Example Let **T** and **S** be the reflection in
`x`-axis and the rotation by 90 degrees on the plane **R**^{2}.
The following picture illustrates the addition **T** + **S**.

The formula for the addition is (**T** + **S**)(`x`, `y`) =
**T**(`x`, `y`) + **S**(`x`, `y`) =
(`x`, - `y`) + (- `y`, `x`) = (`x` - `y`, `x` - `y`),
and the corresponding matrix is

[ |
1 |
0 |
] + [ |
0 |
-1 |
] = [ |
1 |
-1 |
] |

0 |
-1 |
1 |
0 |
1 |
-1 |

For another example, consider two transformations **T** = `Projection to x-axis` and
**S** = `Projection to y-axis` from **R**^{2} to itself.
The following picture shows their addition is the identity.

In terms of the corresponding matrix, we have

[ |
1 |
0 |
] + [ |
0 |
0 |
] = [ |
1 |
0 |
] |

0 |
0 |
0 |
1 |
0 |
1 |

When the multiplication is mixed with addition and scalar multiplication,
we have the following properties.

- distributive
- (
**A** + **B**)**C** = `AC` + `BC`
- distributive
**A**(**B** + **C**) = `AB` + `AC`
- associative
**A**(`r`**B**) = `r`(**AB**) = (`r`**A**)**B**

The properties are easy to prove in terms of linear transformations. For example,
the following argument proves (**T** + **S**)**R** =
`TR` + `SR`.

((**T** + **S**)**R**)(**x**)

= (**T** + **S**)(**R**(**x**)) (definition of composition)

= **T**(**R**(**x**)) + **S**(**R**(**x**)) (definition of addition)

= (`TR`)(**x**) + (`SR`)(**x**) (definition of composition)

= (`TR` + `SR`)(**x**).

The other properties can be proved in similar way.