# A-level Mathematics/OCR/FP1/Matrices

Jump to: navigation, search

A matrix is an array of numbers (elements) presented in a standard form such as the one below. If you wish to use one in an algebraic expression, it is conventional to use a capital letter as an identifier.

$\begin{pmatrix} 1 & 2 & 3\\ 7 & 8 & 9 \end{pmatrix}$

The order of a matrix is the number of rows multiplied by the number of columns e.g. the order of the above matrix is $[ 2 x 3 ]$ (pronounced two by three)

Intuitively, a matrix is called square if it has the same number of rows as columns, and we can also say column matrix to mean a matrix with only one column, and row matrix for a matrix with only one row.

## Operations

### Adding Matrices

Adding matrices is as you would expect: take a number from the first matrix and add it to the number in the corresponding position in the second matrix and place the result in the third matrix in the same position. This has the obvious limitation that only matrices of the same order can be added together.

$\begin{pmatrix} 1 & 2 & 3\\ 7 & 8 & 9 \end{pmatrix} + \begin{pmatrix} 11 & 12 & 4\\ 1 & 3 & 5 \end{pmatrix} = \begin{pmatrix} 12 & 14 & 7\\ 8 & 11 & 14 \end{pmatrix}$

### Subtracting Matrices

Subtracting matrices is also as you would expect and is the exact opposite of adding matrices (see above).

$\begin{pmatrix} 1 & 2 & 3\\ 7 & 8 & 9 \end{pmatrix} - \begin{pmatrix} 11 & 12 & 4\\ 1 & 3 & 5 \end{pmatrix} = \begin{pmatrix} -10 & -10 & -1\\ 6 & 5 & 4 \end{pmatrix}$

### Multiplying Matrices

Unfortunately, multiplying matrices is not as expected. The most simple way of defining multiplication of matrices is to give an example in algebraic form.

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}.\begin{pmatrix} e & f \\ g & h \end{pmatrix} = \begin{pmatrix} ae+bg & af+bh \\ ce+dg & cf+dh \end{pmatrix}$

As above, to find the value of each element in the resulting matrix, you have to take the sum of the row in the first matrix multiplied by the column in the second matrix. Because of this, matrices can only be multiplied together if they are conformable - i.e. if the second matrix has the same number of rows as there are columns in the first matrix. A quick rule of thumb is that if you have an $[ a x b ]$ order matrix you can multiply it by a $[ b x c ]$ matrix to obtain an $[ a x c ]$ matrix.

$\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6\end{pmatrix}.\begin{pmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12\end{pmatrix} = \begin{pmatrix} 7+18+33 & 8+20+36 \\ 28+45+66 & 32+50+72 \end{pmatrix} = \begin{pmatrix} 58 & 64 \\ 139 & 154 \end{pmatrix}$

The other major problem with multiplying matrices is that it is not, in general, commutative. This means that $\mathbf{AB} \not= \mathbf{BA}$. This is very counterintuitive as multiplication between real numbers is not like this. As an example, if we multiply the above two matrices the other way around, we get a different matrix.

$\begin{pmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{pmatrix}.\begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{pmatrix} = \begin{pmatrix} 7+32 & 14+40 & 21+48 \\ 9+40 & 18+50 & 27+60 \\ 11+48 & 22+60 & 33+72 \end{pmatrix} = \begin{pmatrix} 39 & 54 & 69 \\ 49 & 68 & 87 \\ 59 & 82 & 105 \end{pmatrix}$

Of course there exist matricies that do 'commute'. For example take the product of the identity matrix $\mathbf{I}$ with any other square matrix, of the same dimension, and these clearly commute.

Multiplication by a scalar is easier; you simply multiply the number by every element in the matrix. For example:

$3\begin{pmatrix} 7 & 8 \\ 9 & 10 \\ 11 & 12 \end{pmatrix} = \begin{pmatrix} 21 & 24 \\ 27 & 30 \\ 33 & 36 \end{pmatrix}$

### Dividing Matrices

Division of matrices is not defined. However we can multiply by the inverse matrix to achieve the same result. See below for how to find the inverse of a matrix.

## Identity Matrices

The identity matrix is the matrix which when multiplied by another matrix returns that matrix - in other words it is the equivalent of the real number 1. Because this can only happen with square matrices, an identity matrix is a square matrix which apart from a diagonal line of ones from top left to bottom right consists only of zeros. The three by three identity matrix known as $\mathbf{I_3}$is thus:

$\begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}$

## Zero Matrices

The zero matrix or null matrix is denoted $\mathbf{O}$, and it's simply a matrix populated exclusively by zeros.

Both of the following matrices are called $\mathbf{O}$.

$\begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}$

$\begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix}$

Naturally, for any matrix M,

$\mathbf{O}{M} = \mathbf{M}{O} = \mathbf{O}$ and $\mathbf{O}+\mathbf{M}=\mathbf{M}$

## Inverse Matrices

If you have two matrices such that $\mathbf{AB} = \mathbf{I}$ then you can think to yourself that A is equal to $\frac{I}{B}$, which is analogous to $A=\frac{1}{B}$. However, since we do not specifically define division for matrices, we must always use the notation B-1 instead of 1/B. So we have:

$\mathbf{A} = \mathbf{B^{-1}I} = \mathbf{B^{-1}}$

A matrix X-1 is called the inverse matrix of X - if you multiply the two together you get the identity matrix.

## 2x2 Matrices

### Inverse

For two by two matrices the process of finding an inverse is very simple:

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad-bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}$

This implies that not all square matrices do have an inverse, since if $ad-bc$ is zero then the inverse will be undefined. A matrix with no inverse is known as singular.

The formula above is derived as follows:

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}\begin{pmatrix} e & f \\ g & h \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$

$\Rightarrow \begin{cases} ae + bg = 1\\ af + bh = 0\\ ce + dg = 0\\ cf + dh = 1 \end{cases}$

$e = \tfrac{d}{ad - bc}$

$f = \tfrac{-b}{ad - bc}$

$g = \tfrac{-c}{ad - bc}$

$h = \tfrac{a}{ad - bc}$

Taking out a factor of $\tfrac{1}{ad - bc}$ gives:

$\frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}$

### Determinant

This part of the equation ($ad-bc$) is known as the determinant of the matrix and has many other uses which will be gone into later. It is written in several different ways including:

$det(\mathbf{M}) = |\mathbf{M}| = \begin{vmatrix} a & b \\ c & d \end{vmatrix}$

### Transpose

For the matrix $M = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$, its transpose is denoted $M^T$ and is equal to $\begin{pmatrix} a & c \\ b & d \end{pmatrix}$

## 3x3 matrices

For 3x3 matrices and upward, the process of finding the determinant and inverse is considerably more convoluted. We will take the following example matrix:

$\begin{pmatrix} 1 & -1 & 3 \\ 2 & -1 & 4 \\ 2 & 2 & 1 \end{pmatrix}$

### Determinant

1. Choose any row or column of the matrix. For the example, we'll choose the last row.
2. Take the first element in the row and imagine deleting the column and row it's in. This leaves you with a submatrix:
$\begin{pmatrix} -1 & 3 \\ -1 & 4 \end{pmatrix}$
3. Find the determinant of this submatrix, as above. In our case, the determinant of the submatrix is
$(-1*4)-(3*-1)=-4-(-3)=-1$
4. We now repeat steps 2 and 3 for the second and third elements of our chosen row:
• Deleting row 3 and column 2 we obtain the submatrix:
$\begin{pmatrix} 1 & 3 \\ 2 & 4 \end{pmatrix}$
• The determinant is -2.
• Deleting row 3 and column 3 we get:
$\begin{pmatrix} 1 & -1 \\ 2 & -1 \end{pmatrix}$
• The determinant of this is 1.
5. Now we have to change the signs of some of these determinants in order to obtain values known as the cofactors of the original matrix. To do this, we recall the following matrix:
$\begin{pmatrix} + & - & + \\ - & + & - \\ + & - & + \end{pmatrix}$
This tells us that if we chose the first or last row in step 1, we keep the sign of the first determinant we found; we reverse the sign of the second; and we keep the sign of the last. Our three determinants were -1, -2 and 1. The cofactors are therefore -1, 2 and 1.
6. The cofactor of -1 came from the element 2 in the bottom left; the cofactor 2 came from the element 2 at the bottom centre; and the cofactor 1 came from the element 1 at the bottom right. What we do now is to multiply each cofactor by the element from which we got it and add up the results:
$(-1*2)+(2*2)+(1*1) = -2+4+1 = 3$
7. The determinant is 3.

### Inverse

To find the inverse of a 3x3 matrix, we start off by following through our method above to find the cofactors for all of the elements in the matrix.

To reiterate, for every element of the matrix:

1. Delete the row it's in and delete the column it's in to obtain a 2x2 submatrix.
2. Find the determinant of the submatrix.
3. Change its sign as necessary.
The formal method of changing the sign is to multiply the determinant by -1i+j where i is the row number and j is the column number of the element you selected. For example, with the top-left element, we get the submatrix:
$\begin{pmatrix} -1 & 4 \\ 2 & 1 \end{pmatrix}$
The determinant of this matrix is -9. The row number was 1 and the column number was 1, so we do -9 x -11+1 = -9 x 1 = -9.

When you have found all of the cofactors, you can put them in a 3x3 matrix. For our example matrix, we get:

$\begin{pmatrix} -9 & 6 & 6 \\ 7 & -5 & -4 \\ -1 & 2 & 1 \end{pmatrix}$
4. To check that you have obtained the correct matrix of cofactors, you can take any row or column and multiply each element in it by the corresponding element in the original matrix, and add these up; you should get the determinant, regardless of which row or column you choose. Another property of the matrix of cofactors is that if you multiply each element in a row/column by the corresponding element in a different row/column, and add these numbers up, it will come out as zero.
5. This is helpful to us because remember that if we multiply the original matrix by its inverse, we get the identity matrix. If we transpose the matrix of cofactors then the rows become the columns and the columns become the rows:
$\begin{pmatrix} -9 & 7 & -1 \\ 6 & -5 & 2 \\ 6 & -4 & 1 \end{pmatrix}$
Notice where each of the elements have moved.
The resulting matrix is called the adjugate or adjoint of the original matrix. If we multiply this matrix by the original, notice what we get:
$\begin{pmatrix} -9 & 7 & -1 \\ 6 & -5 & 2 \\ 6 & -4 & 1 \end{pmatrix}\begin{pmatrix} 1 & -1 & 3 \\ 2 & -1 & 4 \\ 2 & 2 & 1 \end{pmatrix} = \begin{pmatrix} 3 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & 3 \end{pmatrix}$
As you can see, when we multiply the first row by the first column, as we do in matrix multiplication, we are doing the same that we were when we multiplied the first column of the matrix of cofactors by the first column of the original matrix - and remember that we obtained the determinant. When we multiply the first row of the adjugate by the second column of the original, we are doing the same as we were when we multiplied the first column of the matrix of cofactors by the second column of the original - i.e. multiplying by an alien column. Like before, we get zero.
Recall that if we multiply the inverse of a matrix by that matrix we should get the identity matrix. So far we have got a matrix similar to the identity matrix but 3 times large - that is, larger by a factor of the determinant. So now we can easily conclude the process and obtain the inverse.
6. The inverse of the original matrix is the adjugate multiplied by the inverse of the determinant. In our case, this is:
$\frac{1}{3}\begin{pmatrix} -9 & 7 & -1 \\ 6 & -5 & 2 \\ 6 & -4 & 1 \end{pmatrix}$

It is far more usual to keep the inverse of the determinant outside the matrix, since it would be less elegant if we carried through with the multiplication:

$\begin{pmatrix} -3 & \frac{7}{3} & \frac{-1}{3} \\ 2 & \frac{-5}{3} & \frac{2}{3} \\ 2 & \frac{-4}{3} & \frac{1}{3} \end{pmatrix}$

### Solving systems of equations

Suppose you are presented with the following simultaneous equations.

$x-y+3z = 11$

$2x-y+4z = 24$

$2x+2y+z = 39$

We can put the coefficients of the variables into a matrix, and represent the problem like this:

$\begin{pmatrix} 1 & -1 & 3 \\ 2 & -1 & 4 \\ 2 & 2 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \\ z \end{pmatrix}=\begin{pmatrix} 11 \\ 24 \\ 39 \end{pmatrix}$

If we call the matrix of coefficients M and the matrix of the variables X, then we can say:

$\mathbf{MX}=\begin{pmatrix} 11 \\ 24 \\ 39 \end{pmatrix}$

Rearranging for X:

$\mathbf{X}=\mathbf{M^{-1}}\begin{pmatrix} 11 \\ 24 \\ 39 \end{pmatrix}$

We can use the inverse matrix we found in the last section to solve these equations:

$\mathbf{X}=\frac{1}{3}\begin{pmatrix} -9 & 7 & -1 \\ 6 & -5 & 2 \\ 6 & -4 & 1 \end{pmatrix} \begin{pmatrix} 11 \\ 24 \\ 39 \end{pmatrix}=\begin{pmatrix} 10 \\ 8 \\ 3 \end{pmatrix}$

If the determinant of the matrix of coefficients is zero, then the matrix has no inverse for obvious reasons; the matrix is said to be singular if the determinant is zero. In this case, the equations have no unique solution - that is, there might be more than one solution or there might be no solutions at all. (If there is a solution or if there are many solutions, the system is said to be consistent.)

## Matrices as Transformations

Matrices represent linear transformations. For every linear transformation, there is exactly one equivalent matrix, and every matrix represents a unique linear transformation. To work out the matrix for a particular transformation, form and solve an equation as in the following example:

To find the matrix corresponding to the reflection in the x-axis, the point (x,y) will be transformed to (x,-y), thus:

$M\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x \\ -y \end{pmatrix}$

where M is the matrix we want to find. Assuming we are dealing with a two-dimensional plane, M must be of the form: $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ and so:

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x \\ -y \end{pmatrix} \Rightarrow \begin{cases} ax+by = x\\ cx+dy = -y \end{cases}$

As we want this to apply for all points (x,y), x and y must be independent of one another. This means that both b and c must be 0 and so we get:

$\begin{cases} ax = x\\ dy = -y \end{cases}$

a = 1 and d = -1, so the matrix for reflection in the x-axis is:

$\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$

An alternative to this method is as follows:

1. Find the transformation of the point (1,0). In this example, the reflection of (1,0) in the x-axis is just (1,0). Call this point (x1,y1).
2. Find the transformation of the point (0,1). In this example, it's (0,-1). We'll call this point (x2,y2).
3. The matrix you seek is then:
$\begin{pmatrix} x_1 & x_2 \\ y_1 & y_2 \end{pmatrix}$

### Invariance

An invariant point is one which is left unchanged by a transformation, i.e.:

$M\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix}$

Some transformation matrices only have one invariant point, whilst some will have a line of invariant points. It should be noted that under the identity matrix all points are invariant, and that the point (0,0) is invariant under all transformation matrices.

A line of invariant points is where all points on a certain straight line are invariant for a specific matrix, e.g.:

Find the equation of the line of invariant points for the transformation $\begin{pmatrix} 6 & 5 \\ 2 & 3 \end{pmatrix}$

For the point (x,y) to be invariant it must satisfy:

$\begin{pmatrix} 6 & 5 \\ 2 & 3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix}$
$\Rightarrow \begin{cases} x = 6x + 5y\\ y = 2x + 3y \end{cases}$
$\Rightarrow \begin{cases} 5x + 5y = 0\\ 2x + 2y = 0 \end{cases}$

Since these are the same equation, there must be a line of invariant points:

$\Rightarrow y = -x$

This shows that if y is equal to -x, then the point (x,y) will be invariant, so any point on the line $y = -x$ is an invariant point.

It is also possible to have a line which is unchanged by a transformation, but the points on the line may change positions, i.e. any point on a certain straight line will still be on the same straight line after the transformation even if the actual point has changed. For example: under the matrix representing reflection in the y-axis, any horizontal line will remain unchanged, but the points on the line will not, i.e. (1,0) will be mapped to (-1,0) but both points remain on the line y = 0.

An invariant line can be found like so:

$\begin{cases} M\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} X \\ Y \end{pmatrix}\\ y = mx + c\\ Y = mX + c \end{cases}$

Usually, the +c can be ignored, as the point (0,0) will always be mapped to (0,0) and so c must be 0. Example, if M = $\begin{pmatrix} 3 & 2 \\ 1 & 2 \end{pmatrix}$

$\begin{cases} X = 3x +2y\\ Y = x + 2y\\ Y = mX\\ y = mx \end{cases}$
$\Rightarrow x + 2y = m(3x + 2y)$
$\Rightarrow x + 2mx = 3mx + 2m^2x$
$\Rightarrow 2m^2x - x + mx = 0$
$\Rightarrow x(2m^2 + m - 1) = 0$

So either $x = 0$ (the origin is always invariant), or $2m^2 + m - 1 = 0$

$\Rightarrow (2m - 1)(m + 1) = 0$

So either $m = \tfrac{1}{2}$ or $m = -1$, thus there are two invariant lines:

$y = \tfrac{1}{2}x$
$y = -x\,\!$

This is part of the FP1 (Further Pure Mathematics 1) module of the A-level Mathematics text.