# Topic 4: Matrices
## Introduction

The numbers in the matrix are called entries or elements
The order of a matrix defines its shape. For example, 2×1 matrix. First digit defines number of rows, second digit defines number of columns.
Matrices of order n×1 with just one column, are called column matrices:
For example: ${\begin{bmatrix}1\\5\\6\end{bmatrix}}$
Matrices of order 1×n with just one row, are called row matrices
For example: ${\begin{bmatrix}1&5&6\\\end{bmatrix}}$
A zero matrix is a matrix with all entries equal to zero.
For example: ${\begin{bmatrix}0&0\\0&0\\0&0\end{bmatrix}}$
An identity matrix is a square matrix with entries of 1 on the leading diagonal (from top left to bottom right) and entries of zero everywhere else.
For example: ${\begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}}$

### Adding and subtracting matrices

Two or more matrices of identical dimensions $m$ and $n$ can be added. Given m-by-n matrices A and B, their sum A + B is the m-by-n matrix computed by adding corresponding elements For example:
    ${\begin{bmatrix}1&3&2\\1&0&0\\1&2&2\end{bmatrix}}+{\begin{bmatrix}0&0&5\\7&5&0\\2&1&1\end{bmatrix}}={\begin{bmatrix}1+0&3+0&2+5\\1+7&0+5&0+0\\1+2&2+1&2+1\end{bmatrix}}={\begin{bmatrix}1&3&7\\8&5&0\\3&3&3\end{bmatrix}}$

### Multiplying a matrix by a number

To multiply a matrix by a number, multiply every element by the number. For example:
    $2\cdot {\begin{bmatrix}1&8&-3\\4&-2&5\end{bmatrix}}={\begin{bmatrix}2\cdot 1&2\cdot 8&2\cdot -3\\2\cdot 4&2\cdot -2&2\cdot 5\end{bmatrix}}={\begin{bmatrix}2&16&-6\\8&-4&10\end{bmatrix}}$

## Matrix multiplication

In order for matrix multiplication to occur, the number of columns in the first matrix must equal the number of rows in the second matrix. Consider Matrix A and B below:
    ${\begin{bmatrix}1&3&1\\2&-1&1\\\end{bmatrix}}\cdot {\begin{bmatrix}1&1\\2&-1\\3&1\end{bmatrix}}$
Thus, the 2x3 and 3x2 matrices can be multiplied either way in this example. For this example, a 2x2 matrices will result. Note that if the 3x2 was multiplied by the 2x3, a 3x3 matrice would result. Proceed by multiplying the 1st row of Matrix A with the first column of Matrix B and summing the results. This will be your first element of the 2x2. Multiply the first row of Matrix A with the second column of Matrix B. This will be the element in the first row and second column of the resulting 2x2 matrix. This process is shown below.
Continuing with Matrix A and B from above
    ${\begin{bmatrix}1&3&1\\2&-1&1\\\end{bmatrix}}\cdot {\begin{bmatrix}1&1\\2&-1\\3&1\end{bmatrix}}={\begin{bmatrix}1+6+3&1+-3+1\\2+-2+3&2+1+1\\\end{bmatrix}}={\begin{bmatrix}10&-1\\3&4\\\end{bmatrix}}$
note that matrix multiplication is not commutative. so MxN is not equal to NxM
The 2x3 matrix is the most complex hand calculation the IBO will require on any examination, with subsequent matrices (3x3, 3x4, 4x4) being done through use of a GDC.

## 2×2 matrices

Similar to the process shown above, only simpler. A 2x2 multiplied by a 2x2 will always yield a 2x2 matrix. Consider Matrix A and B below:
    ${\begin{bmatrix}4&2\\-1&8\\\end{bmatrix}}\cdot {\begin{bmatrix}-1&3\\2&0\\\end{bmatrix}}={\begin{bmatrix}-4+4&12+0\\1+16&-3+0\\\end{bmatrix}}={\begin{bmatrix}0&12\\17&-3\\\end{bmatrix}}$

## 3×3 matrices

It is not advised by the IBO for SL students to calculate by hand 3x3 matrices, as it is merely a complex extension of multiplying 2x2 matrices. Instead, the IBO recommends the use of a GDC (Graphing Display Calculator), and the Matrix function on it.