Matrices

A matrix is an array of numbers, arranged into a grid, for example:

1   2

3   4

To add two matrices together, simply add each number in the first matrix with the corresponding number in the second matrix. Matrix addition is defined if the matrices have the same dimensions.

Multiplication

Multiplying a matrix by a single number is just as simple; you merely multiply all numbers inside the matrix by the number on the outside. For example,

2 *      4   3               =         6

             5   11                             10 22

However, when multiplying two matrices together, things get more complicated. 2x2 matrices are multiplied together as follows:

a    b   *    f        g       =     af+bg ag+bj

c    d              h    j               cf+dh cg+dj

For example,

1    2   *    5        6   =    19    22

3    4              7    8              43    50

A 2x3 matrix can be multiplied by a 3x2 matrix as follows:

a    b   *    h        j    k    =    ah+bl aj+bm   ak+bn

c    d              l    m       n                    ch+dl cj+dm   ck+bn

f     g                                                              fh+gl  fj+fm fk+fn

The result of multiplying a 2x3 matrix by a 3x2 matrix is a 3x3 matrix. For example,

1          2          *         7          8          9          =         27       30       33

3          4                          10       11       12                       61       68       75

5          6                                                                                          95      

Matrix multiplication is defined when the number of colums in the first matrix is equal to the number of rows in the second matrix.

Powers

Matrix powers are just like powers of regular numbers, and are only defined for matrices where the  number of rows and columns are the same (referred to as square matrices) due to the criteria for matrix multiplication.

2    2 2           =         8    8

2    2                              8    8

 

1    2 2           =         7     10

3    4                              15   22

 

1    2 3           =         37    54

3    4                              81    118

While matrix multiplication is not commutative, matrix powers evaluate to the same result regardless of whether the multiplication is left-associative or right-associative.