11 Matrices exercises - Solutions
This section contains solutions to the bonus exercises to accompany the Introduction to Matrices chapter. Each chapter contained embedded examples and exercises, often with explanations.
These solutions are provided with fewer explanations, generally just with the basic answers provided later. Of course, you can ask questions of the course lecturer about any problems here too.
11.1 Matrix algebra
- Consider the following matrices:
\[\begin{equation*}
A = \begin{pmatrix}1 & 0 & -3 \end{pmatrix}, \quad B=\begin{pmatrix}4 & -1 & 2 \end{pmatrix}, \quad C = \begin{pmatrix}1 & 2 \\ 4 & 3 \end{pmatrix}
\end{equation*}\]
\[\begin{equation*}
D = \begin{pmatrix}-3 & 1 \\ 6 & 5 \end{pmatrix}, \quad E=\begin{pmatrix}-2 & 6 & 3 \\ 1 & 0 & -1 \\ 5 & 8 & 4 \end{pmatrix}, \quad F = \begin{pmatrix}9& 0 & 7 \\ 2 & -2 & 0 \\ 1 & 6 & 5 \end{pmatrix}
\end{equation*}\]
\[\begin{equation*}
G = \begin{pmatrix}2 & 6 \\ 1 & 3 \\ -1 & 5 \end{pmatrix}, \quad H=\begin{pmatrix}0 & -6 \\ -1 & 0 \\ 3 & 8 \end{pmatrix}
\end{equation*}\]
\[\begin{equation*}
J = \begin{pmatrix}2 \\ -1 \\ 4 \end{pmatrix}, \quad K = \begin{pmatrix}-1 \\ 2 \\ 0 \end{pmatrix}
\end{equation*}\]
- State the shape of each matrix.
- \(1\)-by-\(3\)
- \(1\)-by-\(3\)
- \(2\)-by-\(2\)
- \(2\)-by-\(2\)
- \(3\)-by-\(3\)
- \(3\)-by-\(3\)
- \(3\)-by-\(2\)
- \(3\)-by-\(2\)
- \(3\)-by-\(1\)
- \(3\)-by-\(1\)
- Determine the following algebraic combinations (not all may be possible!)
- \(A+B = \begin{pmatrix}5&-1&-1 \end{pmatrix}\)
- \(C-D = \begin{pmatrix}4&1 \\ -2 & -2\end{pmatrix}\)
- \(E+F = \begin{pmatrix}7&6&10 \\ 3& -2 & -1 \\ 6 & 14 & 9 \end{pmatrix}\)
- \(E-F = \begin{pmatrix}-11 & 6 & -4 \\ -1 & 2 & -1 \\ 4 & 2 & -1 \end{pmatrix}\)
- \(2G+3H = \begin{pmatrix}4&-6 \\ -1&6 \\ 7&34 \end{pmatrix}\)
- \(3C-D = \begin{pmatrix}6&5 \\ 6&4 \end{pmatrix}\)
- \(GC = \begin{pmatrix}26 & 22 \\ 13&11 \\ 19&13 \end{pmatrix}\)
- \(EJ = \begin{pmatrix}2 \\ -2 \\ 18 \end{pmatrix}\)
- \(JE =\) Not possible, not correct shapes.
- \(CD = \begin{pmatrix}9 & 11 \\ 6 & 19 \end{pmatrix}\)
- \(DC = \begin{pmatrix}1 & -3 \\ 26 & 27 \end{pmatrix}\)
- \(EF = \begin{pmatrix}-3 & 6 & 1 \\ 8 & -6 & 2 \\ 65 & 8 & 55 \end{pmatrix}\)
- \(HE\) Not possible, not correct shapes.
- \(AK = \begin{pmatrix}-1 \end{pmatrix}\). This one is weird, but it’s a \(1\)-by-\(1\) matrix!
- \(KA = \begin{pmatrix}-1 & 0 & 3 \\ 2 & 0 & -6 \\ 0 &0&0 \end{pmatrix}\). This is extremely weird, every Scalar Product was a product of just two numbers. You rarely do this kind of product.
- State the shape of each matrix.
- Simplify the following linear combinations:
- \(\begin{pmatrix}1 & 0 \\ 2 & 1 \end{pmatrix}+ \begin{pmatrix}-1 & -2 \\ 2 & 1 \end{pmatrix}= \begin{pmatrix}0 & -2 \\ 4 & 2 \end{pmatrix}\)
- \(\begin{pmatrix}1 & 3 \\ \frac{1}{2} & -2 \end{pmatrix}+ \begin{pmatrix}-\frac{1}{2} & 0 \\ \frac{3}{2} & 1 \end{pmatrix}= \begin{pmatrix}\frac{1}{2} & 3 \\ 2 & -1 \end{pmatrix}\)
- \(3\begin{pmatrix}1 & -1 \\ 0 & 2 \end{pmatrix}= \begin{pmatrix}3 & -3 \\ 0 & 6 \end{pmatrix}\)
- \(2\begin{pmatrix}1 & 4 \\ -1 & 6 \end{pmatrix}+ 3\begin{pmatrix}0 & -2 \\ 4 & 1 \end{pmatrix}= \begin{pmatrix}2 & 14 \\ 10 & 15 \end{pmatrix}\)
- Calculate the following matrix products:
- \(\begin{pmatrix}1 & 0 \\ 2 & 1 \end{pmatrix}\begin{pmatrix}-1 & -2 \\ 2 & 1 \end{pmatrix}= \begin{pmatrix}-1 & -2 \\ 0 & -3 \end{pmatrix}\)
- \(\begin{pmatrix}1 & 3 \\ 2 & 1 \end{pmatrix}\begin{pmatrix}1 & 0 & -3 \\ 1 & 2 & -2 \end{pmatrix}= \begin{pmatrix}4 & 6 & -9 \\ 3 & 2 & -8 \end{pmatrix}\)
- \(\begin{pmatrix}1 & \frac{1}{2} & 3 \end{pmatrix}\begin{pmatrix}1 & 4 \\ -1 & \frac{1}{2} \\ 0 & 1 \end{pmatrix}= \begin{pmatrix}\frac{1}{2} & \frac{29}{4} \end{pmatrix}\)
- \(\begin{pmatrix}3 & -2 & 5 \end{pmatrix}\begin{pmatrix}2 \\ 0 \\ 7 \end{pmatrix}= \begin{pmatrix}41 \end{pmatrix}\)
11.2 Matrix properties
- Calculate the following products:
- \(\begin{pmatrix}1 & 0 \\ 2 & 1 \end{pmatrix}\left[ \begin{pmatrix}1 & 0 \\ 2&1 \end{pmatrix}\begin{pmatrix}-1 & -2 \\ 2 & 1 \end{pmatrix}\right] = \begin{pmatrix}0 & -2 \\ 4 & -2 \end{pmatrix}\)
- \(\left[\begin{pmatrix}1 & 0 \\ 2&1 \end{pmatrix}\begin{pmatrix}-1 & -2 \\ 2 & 1 \end{pmatrix}\right]\begin{pmatrix}1 & 0 \\ 2 & 1 \end{pmatrix}= \begin{pmatrix}-4 & -2 \\ 8 & 2 \end{pmatrix}\)
- One product was \(\begin{pmatrix}1&0 \\ 2 & 1 \end{pmatrix}\begin{pmatrix}0&-2 \\ 4 & 2 \end{pmatrix}\) and the other was \(\begin{pmatrix}0&-2 \\ 4 & 2 \end{pmatrix}\begin{pmatrix}1&0 \\ 2 & 1 \end{pmatrix}\). Notice that one is \(AB\) and the other is \(BA\), the order has been swapped. However, the answers are different. This illustrates the general rule that if you swap the order of multiplication you get a different answer. There are special cases where the result is the same but they are rare.
- Answer the following two questions about squaring matrices:
- Which of the following matrices can be squared? \(A=\begin{pmatrix}1 & 0 \\ 2& 1 \end{pmatrix}\) and \(M=\begin{pmatrix}1 &0&-3 \\ 1 & 2 & -2\end{pmatrix}\) Squaring means to multiply by itself, so we’re being asked if \(AA\) and \(MM\) are allowed. Only \(AA\) meets the shape conditions.
- In general, considering all possible matrices, which matrices can be squared? In general, it is hopefully clear from the previous example that only matrices whose number of rows match their number of columns can be multiplied by themselves, i.e. matrices we call square matrices. i.e. \(m\)-by-\(n\) matrices where \(m=n\).
- For the matrix \(A=\begin{pmatrix}a & b & c \\ d & e & f \end{pmatrix}\),
- Calculate \(A^T\) and \((A^T)^T\). \(A^T = \begin{pmatrix}a&d \\ b&e \\ c&f \end{pmatrix}\) and \((A^T)^T = \begin{pmatrix}a & b & c \\ d & e & f \end{pmatrix}\).
- How does \((A^T)^T\) compare to \(A\)? \((A^T)^T = A\) as is always the case for all matrices.
- Let \(A=\begin{pmatrix}a&b&c \\ d&e&f \end{pmatrix}\) and \(B=\begin{pmatrix}u&v&w \\ x&y&z \end{pmatrix}\).
- Evaluate \(A^T+B^T\) and \(\left(A+B\right)^T\). \(A^T+B^T = \begin{pmatrix}a+u & d+x \\ b+v & e&y\\ c+w & f&z \end{pmatrix}\)
- Comment on your answer. These two calculations give the same answer. One adds before flipping the matrix, the other flips them both first then adds them. They both end up in the same place.
11.3 Matrix determinants and inverses
-
Calculate the determinants of each of the following matrices:
- \(\begin{pmatrix}1&1 \\ 0 & 1 \end{pmatrix}\), Det \(= 1\times 1 - 1 \times 0 = 1.\)
- \(\begin{pmatrix}3&-2\\4&5 \end{pmatrix}\), Det \(= 3 \times 5 - 4\times (-2) = 23.\)
- \(\begin{pmatrix}6&-3\\-4&2 \end{pmatrix}\), Det \(= 6 \times 2 -(-3)\times (-4) = 0\)
- \(\begin{pmatrix}1&1&0\\0&1&1\\1&0&1 \end{pmatrix}\), Determinant equals… \(1\det\begin{pmatrix}1&1 \\ 0 & 1 \end{pmatrix}-1\det\begin{pmatrix}0 & 1 \\ 1 & 1 \end{pmatrix}+ 0 \det\begin{pmatrix}0 & 1 \\ 1 & 0 \end{pmatrix}=2\)
- \(\begin{pmatrix}1&2&1\\3&2&1\\2&3&2 \end{pmatrix}\), Determinant equals… \(1\det\begin{pmatrix}2&1 \\ 3 & 2 \end{pmatrix}-2\det\begin{pmatrix}3 & 1 \\ 2 & 2 \end{pmatrix}+ 1 \det\begin{pmatrix}3 & 2 \\ 2 & 3 \end{pmatrix}=-2\)
- \(\begin{pmatrix}2&1&1\\1&2&2\\2&4&4 \end{pmatrix}\), Determinant equals… \(2\det\begin{pmatrix}2&2 \\ 4 & 4 \end{pmatrix}-1\det\begin{pmatrix}1 & 2 \\ 2 & 4 \end{pmatrix}+ 1 \det\begin{pmatrix}1 & 2 \\ 2 & 4 \end{pmatrix}=0\)
-
For each matrix in the previous question, determine its inverse or explain why you know it doesn’t have an inverse. (You may use a computer for \(3\)-by-\(3\) matrix inverses)
Matrices (c) and (f) have determinants equal to zero. That means these are the ones which cannot be inverted (i.e. have no inverse). The inverses of the others (a), (b), (d) and (e) are: \[\begin{pmatrix}1 & -1 \\ 0 & 1 \end{pmatrix}\] \[\frac{1}{23}\begin{pmatrix}5 & 2 \\ -4 & 3 \end{pmatrix}\] \[\frac{1}{2}\begin{pmatrix}1&-1&1 \\ 1&1&-1\\ -1&1&1 \end{pmatrix}\] \[\frac{1}{2}\begin{pmatrix}-1&1&0 \\ 4&0&-2\\ -5&-1&4 \end{pmatrix}\]
For the matrix \(A=\begin{pmatrix}4 &5 \\ 2 & 3 \end{pmatrix}\), use the standard formula to determine its inverse (written \(A^{-1}\)) and calculate the two products \(AA^{-1}\) and \(A^{-1}A\). Comment on your results. \(\det(A)=4\times 3 - 5\times 2 = 12-10=2\neq 0\) so there is an inverse. And \[ A^{-1} = \frac{1}{2}\begin{pmatrix}3 & -5 \\ -2 & 4 \end{pmatrix}\] Both \(AA^{-1}\) and \(A^{-1}A\) are equal to \(I_2=\begin{pmatrix}1&0\\ 0&1 \end{pmatrix}\). A matrix multiplied by its own inverse (either way around) always equals an identity matrix, of the right shape.
For the matrix \(A=\begin{pmatrix}4&1&3 \\ 2&1&2 \end{pmatrix}\) calculate the product \(AA^T\). Can you always multiply a matrix by its own transpose? \(A^T = \begin{pmatrix}4 & 2 \\ 1& 1 \\ 3 & 2 \end{pmatrix}\) so \[ AA^T = \begin{pmatrix}4&1&3 \\ 2&1&2 \end{pmatrix}\begin{pmatrix}4 & 2 \\ 1& 1 \\ 3 & 2 \end{pmatrix}=\begin{pmatrix}26 & 15 \\ 15 & 9 \end{pmatrix}\] Yes! This is always possible, because each row length of \(A\) matches the column length in \(A^T\) because they are started life as the same rows!
-
Let \(A=\begin{pmatrix}2&5\\1&4\end{pmatrix}\) and \(B=\begin{pmatrix}4&-5\\0&3\end{pmatrix}\).
-
First calculate \(A^{-1}\) and \(B^{-1}\).
\(A^{-1}=\frac{1}{3}\begin{pmatrix}4 & -5 \\ -1 & 2 \end{pmatrix}\) and \(B^{-1}=\frac{1}{12}\begin{pmatrix}3&5 \\ 0 & 4 \end{pmatrix}\)
-
Next evaluate, by hand, \(AB, \left(AB\right)^{-1}\) and \(B^{-1}A^{-1}\)
\(AB = \begin{pmatrix}8&5 \\ 4&7 \end{pmatrix}\) and so \((AB)^{-1}=\frac{1}{36}\begin{pmatrix}7 & -5 \\ -4 & 8 \end{pmatrix}\)
What about \(B^{-1}A^{-1}\)? That turns out to match \((AB)^{-1}\) exactly.
-
Comment on whether you were expecting these final two evaluations to be equal.
Yes we were, because one of the always true equations for matrix inverses is as follows: \[ (AB)^{-1} = B^{-1}A^{-1} \]
-
-
Consider the following matrix \(A=\begin{pmatrix}1&2\\ k&3 \end{pmatrix}\) where \(k\) is a constant.
-
Determine which value(s) of \(k\) allow \(A\) to be invertible.
\(\det(A)=3-2k\), and the matrix is invertible as long as \(\det(A)\neq 0\). So, as long as \(k \neq \frac{3}{2}\).
-
Calculate the inverse of \(A\) (note your answer will contain \(k\))
Assuming \(3-2k\) isn’t zero, i.e. that \(k\neq \frac{3}{2}\) then \[A^{-1}=\frac{1}{3-2k}\begin{pmatrix}3 & -2 \\ -k & 1 \end{pmatrix}. \]
-
-
Let \(A=\begin{pmatrix}1&-2&1\\-3&2&-1\\2&-1&0\end{pmatrix}\).
-
Calculate the determinant of \(A\).
\(\det(A)=2\)
-
Find the inverse of \(A\) (using your computer).
\(A^{-1} = -\frac{1}{2}\begin{pmatrix}1&1&0\\2&2&2\\1&3&4 \end{pmatrix}\)
-
By hand, calculate the matrix products \(AA^{-1}\) and \(A^{-1}A\).
Both of these will equal \(I_3\).
-
Did your results agree with what you were expecting?
Hopefully you realized that the answer was going to be \(I_3\) before you finished the by-hand calculation. Ideally, before you even started.
-
Given that \(D=\begin{pmatrix}2&0&0\\0&5&0\\0&0&4 \end{pmatrix}\), find the inverse matrix \(D^{-1}\) without using a computer. \[D^{-1} = \begin{pmatrix}\frac{1}{2} &0&0 \\ 0 & \frac{1}{5} & 0 \\ 0 & 0 & \frac{1}{4} \end{pmatrix}\] The method for this is often called by inspection, because it’s possible to ‘spot’ that this is a matrix which multiplied by the original to give \(I_3\). Though you probably won’t spot it unless you’ve seen the pattern before!
-
(Hardest) Let \(A=\begin{pmatrix}4&0&9\\ 0 & 5+k & -3 \\ 0 & 2 & k \end{pmatrix}\) be a matrix, where \(k\) is a constant.
-
Calculate the determinant of \(A\) (your answer will contain \(k\)).
\[\det(A)=4 \det\begin{pmatrix}5+k & -3 \\ 2 & k \end{pmatrix}-0\det\begin{pmatrix}0&-3\\0 & k \end{pmatrix}+ 9\det\begin{pmatrix}0&5+k \\0 & 2 \end{pmatrix}\] But only the first term here isn’t zero, so the answer is \(\det(A)=4\left(\left(5+k\right)\left(k\right)+6\right)\) which simplifies into \[\det(A)=4\left(k^2+5k+6\right)=4(k+2)(k+3).\]
-
Use your determinant formula to determine all values of \(k\) when the matrix is invertible.
By factorizing the determinant it becomes easy to see when the matrix will be invertible, as we just need to solve to find when \(\det(A)=0\) and all the other cases will be invertible. In this case we can easily spot that \(k=-2\) or \(k=-3\) both cause non-invertibility. Hence all \(k\) except for \(-3\) and \(-2\) allow \(A\) to be inverted.
-
11.4 Solving simultaneous of equations
-
Consider the following system of simultaneous equations: \[\begin{alignat*}{3} 2x & {}-{} & 5y & {}={} & 2 \\ 3x & {}-{} & 7y & {}={} & 1 \end{alignat*}\]
-
Express these simultaneous equations in matrix form, i.e. as \(A\underline{x}=\underline{b}\), where \(A\) is a square matrix, and both \(\underline{b}\) and \(\underline{x}\) are single column matrices.
\[\begin{pmatrix}2 & -5 \\ 3 & -7 \end{pmatrix}\begin{pmatrix}x \\ y \end{pmatrix}= \begin{pmatrix}2 \\ 1 \end{pmatrix}\] so to fit with \(A\underline{x}=\underline{b}\) we use \[ A = \begin{pmatrix}2 & -5 \\ 3 & -7 \end{pmatrix}, \underline{b} = \begin{pmatrix}2 \\ 1 \end{pmatrix}\] and, as usual, we use the somewhat awkward notation of \(\underline{x}=\begin{pmatrix}x \\ y \end{pmatrix}\) (Note that are two different \(x\)’s, one the name of a column vector/matrix, \(\underline{x}\), and the other the first unknown variable, \(x\).
-
Determine the inverse, \(A^{-1}\), of your matrix \(A\).
\[ A^{-1} = \begin{pmatrix}-7 & 5 \\ -3 & 2 \end{pmatrix}\]
Use \(A^{-1}\) to find the solution to the simultaneous equations.
The solution is always \(\underline{x}=A^{-1}\underline{b}\) so \[ \begin{pmatrix}x\\y \end{pmatrix}= \begin{pmatrix}-7 & 5 \\ -3 & 2 \end{pmatrix}\begin{pmatrix}2 \\ 1 \end{pmatrix}= \begin{pmatrix}-9 \\ -4 \end{pmatrix}\] so \(x=-9, y=-4\).
-
-
A system of equations is given by \[\begin{alignat*}{4} 2x & {}-{} & y & {}+{} & 3z & {}={} & 13 \\ x & {}-{} & 2y & {}-{} & 3z & {}={} & -4 \\ 4x & {}-{} & 2y & {}-{} & 3z & {}={} & 8 \end{alignat*}\]
-
Express these simultaneous equations in the matrix form \[ A\underline{x}=\underline{b}.\]
\[A=\begin{pmatrix}2 & -1 & 3 \\ 1 & -2 & -3 \\ 4 & -2 & -3 \end{pmatrix}\] \[\underline{x}=\begin{pmatrix}x \\ y \\ z \end{pmatrix}, \qquad \underline{b}=\begin{pmatrix}13\\ -4\\ 8 \end{pmatrix}. \]
-
Determine the matrix \(A^{-1}\) (use a computer, it will exist in this case).
\[A^{-1} = \frac{1}{27}\begin{pmatrix}0&-9&9\\ -9&-18&9 \\ 6&0&-3 \end{pmatrix}.\]
Use your result in the previous part to solve this system of equations for \(x,y,z\).
As usual \(\underline{x}=A^{-1}\underline{b}\) so \[ \begin{pmatrix}x\\y\\z \end{pmatrix}= \frac{1}{27} \begin{pmatrix}0&-9&9\\ -9&-18&9 \\ 6&0&-3 \end{pmatrix}\begin{pmatrix}13 \\ -4 \\ 8 \end{pmatrix}= \begin{pmatrix}4 \\ 1 \\ 2 \end{pmatrix}. \]
-