Table of Contents## Matrix Addition

Entire Site

The easiest matrix operation is addition. To add two matrices, you add their corresponding elements. This, of course, requires that your matrices have exactly the same number of rows and columns. Figure D-3 shows the addition of 2 matrices, each 3-by-2.

We see that the `translate`

transformation in SVG could be
accomplished easily by matrix addition. For example, the matrix addition
in Figure D-4 would implement
`transform="translate(7, 2)"`

for any
point (*x*, *y*).

The order in which you add matrices doesn’t matter. Technically, we say that matrix addition is commutative (A + B = B + A). It is also associative; given three matrices A, B, and C, (A + B) + C is the same as A + (B + C). There is such a thing as matrix subtraction; just subtract the corresponding elements of the two matrices. Just as with regular subtraction, matrix subtraction is not commutative.