Matrix Algebra and Determinants
In this session, we study the core ideas of matrix algebra. We begin with special matrices such as diagonal, zero, and identity matrices, and learn scalar multiplication, matrix addition, and matrix multiplication using both the definition and the row-column rule. We also cover matrix powers and transposes, and explore properties summarised by the Invertible Matrix Theorem.
The exercises focus on computing inverses, solving systems using \(A^{-1}\), reasoning about invertibility and pivots, and working with determinants of \(2\times2\) matrices. Together, these tools provide the algebraic foundation needed for the linear algebra applications encountered later in the course and in software engineering.
Key Concepts¶
- Matrix addition, scalar multiplication, and multiplication
- Transpose and matrix powers
- Invertible matrices and the Invertible Matrix Theorem
- Determinants of \(2\times2\) matrices
Learning Objectives
- Perform matrix arithmetic using correct dimensions and rules.
- Compute transposes and matrix products.
- Determine whether a matrix is invertible and find its inverse when possible.
- Use determinants and inverses to solve matrix equations.
- Apply matrix algebra to solve systems of linear equations.
Session Preparation¶
Chapter 9 (English)
Kapitel 9 (Dansk)
Some of the exercises may require you to use Python. You may also need to install the numpy and sympy libraries if you haven't already.
Resources¶
Exercises¶
Python solutions will be available after the session. [Python] Means that you are advised to use Python to solve the exercise. You can find the Python solutions here or download them here
Exercise 1¶
-
Determine by inspection whether the following sets of vectors are linearly independent or dependent. Justify each answer.
i. \(\left[\begin{array}{l}5 \\ 1\end{array}\right],\left[\begin{array}{l}2 \\ 8\end{array}\right],\left[\begin{array}{l}1 \\ 3\end{array}\right],\left[\begin{array}{r}-1 \\ 7\end{array}\right]\) (1)
- Dependent
ii. \(\left[\begin{array}{r}2 \\ -4 \\ 8\end{array}\right],\left[\begin{array}{r}-3 \\ 6 \\ -12\end{array}\right]\) (1)
- Dependent
iii. \(\left[\begin{array}{r}5 \\ -3 \\ -1\end{array}\right],\left[\begin{array}{l}0 \\ 0 \\ 0\end{array}\right],\left[\begin{array}{r}-7 \\ 2 \\ 4\end{array}\right]\) (1)
- Dependent
iv. \(\left[\begin{array}{l}3 \\ 4\end{array}\right],\left[\begin{array}{r}-1 \\ 5\end{array}\right],\left[\begin{array}{l}3 \\ 5\end{array}\right],\left[\begin{array}{l}7 \\ 1\end{array}\right]\) (1)
- Dependent
v. \(\left[\begin{array}{r}-8 \\ 12 \\ -4\end{array}\right],\left[\begin{array}{r}2 \\ -3 \\ -1\end{array}\right]\) (1)
- Independent
vi. \(\left[\begin{array}{r}1 \\ 4 \\ -7\end{array}\right],\left[\begin{array}{r}-2 \\ 5 \\ 3\end{array}\right],\left[\begin{array}{l}0 \\ 0 \\ 0\end{array}\right]\) (1)
- Dependent
-
Let \(A = \left[\begin{array}{cccccc}1 & -4 & -2 & 0 & 3 & -5 \\ 0 & 0 & 1 & 0 & 0 & -1 \\ 0 & 0 & 0 & 0 & 1 & -4 \\ 0 & 0 & 0 & 0 & 0 & 0\end{array}\right]\)
Describe all solutions to \(A \mathbf{x}=\mathbf{0}\) in parametric form.
The solution in parametric form is:
\[ \mathbf{x} = \left[\begin{array}{c} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ x_6 \end{array}\right] = x_2 \left[\begin{array}{c} 4 \\ 1 \\ 0 \\ 0 \\ 0 \\ 0 \end{array}\right] + x_4 \left[\begin{array}{c} 0 \\ 0 \\ 0 \\ 1 \\ 0 \\ 0 \end{array}\right] + x_6 \left[\begin{array}{c} -5 \\ 0 \\ 1 \\ 0 \\ 4 \\ 1 \end{array}\right] \]where \(x_2\), \(x_4\), and \(x_6\) are free variables.
-
[Python] Use as many columns of \(A\) as possible to construct a matrix \(B\) with the property that the equation \(B \mathbf{x}=\mathbf{0}\) has only the trivial solution. Solve \(B \mathbf{x}=\mathbf{0}\) to verify your work.
\(A=\left[\begin{array}{rrrrr}3 & -4 & 10 & 7 & -4 \\ -5 & -3 & -7 & -11 & 15 \\ 4 & 3 & 5 & 2 & 1 \\ 8 & -7 & 23 & 4 & 15\end{array}\right]\)
\(\left[\begin{array}{ccc}3 & -4 & 7 \\ -5 & -3 & -11 \\ 4 & 3 & 2 \\ 8 & -7 & 4\end{array}\right]\)
Exercise 2¶
In (a) and (b) compute each matrix sum or product if it is defined. If an expression is undefined, explain why. Let
-
\(-2 A, \; B-2 A, \; A C, \; C D\)
\[-2 A=\left[\begin{array}{rrr}-4 & 0 & 2 \\ -8 & 10 & -4\end{array}\right]\]\[ B-2 A=\left[\begin{array}{rrr} 3 & -5 & 3 \\ -7 & 6 & -7 \end{array}\right] \]\(A C\) is not defined.
\[C D=\left[\begin{array}{rr}1 & 13 \\ -7 & -6\end{array}\right]\] -
[Python] \(A+3 B, \; 2 C-3 E, \; D B, \; E C\)
\[ A+3 B=\left[\begin{array}{rrr} 23 & -15 & 2 \\ 7 & -17 & -7 \end{array}\right] \]\(2 C-3 E\) is not defined.
\[ D B=\left[\begin{array}{rrr} 26 & -35 & -12 \\ -3 & -11 & -13 \end{array}\right] \]\(E C\) is not defined.
-
[Python] Let \(A=\left[\begin{array}{rr}3 & -6 \\ -1 & 2\end{array}\right], B=\left[\begin{array}{rr}-1 & 1 \\ 3 & 4\end{array}\right]\), and \(C= \left[\begin{array}{rr}-3 & -5 \\ 2 & 1\end{array}\right]\). Verify that \(A B=A C\) and yet \(B \neq C\).
Since \( AB = \left[\begin{array}{rr} -21 & -21 \\ 7 & 7 \end{array}\right] = AC \), we conclude \( AB = AC \).
Thus, \( AB = AC \) but \( B \neq C \).
-
[Python] If \(A=\left[\begin{array}{rr}1 & -3 \\ -3 & 5\end{array}\right]\) and \(A B=\left[\begin{array}{rr}-3 & -11 \\ 1 & 17\end{array}\right]\), determine the matrix \(B\).
\(\left[\begin{array}{ll}3 & 1 \\ 2 & 4\end{array}\right]\)
Exercise 3¶
-
Find the inverses of \(\begin{array}{cc}{\left[\begin{array}{l}8 \\ 5\end{array}\right.} & \left.\begin{array}{c}6 \\ 4\end{array}\right]\end{array}\) and \(\begin{array}{cc}{\left[\begin{array}{l}3 \\ 8\end{array}\right.} & \left.\begin{array}{c}2 \\ 5\end{array}\right]\end{array}\).
\(\left[\begin{array}{ll}8 & 6 \\ 5 & 4\end{array}\right]^{-1}=\frac{1}{32-30}\left[\begin{array}{rr}4 & -6 \\ -5 & 8\end{array}\right]=\left[\begin{array}{cr}2 & -3 \\ -5 / 2 & 4\end{array}\right]\)
\(\left[\begin{array}{ll}3 & 2 \\ 8 & 5\end{array}\right]^{-1}=\frac{1}{15-16}\left[\begin{array}{rr}5 & -2 \\ -8 & 3\end{array}\right]=\left[\begin{array}{cc}-5 & 2 \\ 8 & -3\end{array}\right]\)
-
[Python] Use the inverse found in Exercise 3.a to solve the system
\(\begin{aligned} & 8 x_1+6 x_2=2 \\ & 5 x_1+4 x_2=-1 \end{aligned}\)
Solution: \(x_1=7\) and \(x_2=-9\).
-
[Python] Find the inverse of the matrix. Use the algorithm for finding the inverse of a \(n \times n\) matrix.
\(\left[\begin{array}{rrr} 1 & 0 & -2 \\ -3 & 1 & 4 \\ 2 & -3 & 4 \end{array}\right]\)
\[\left[\begin{array}{ccc} 8 & 3 & 1 \\ 10 & 4 & 1 \\ 7 / 2 & 3 / 2 & 1 / 2 \end{array}\right] \]
Exercise 4¶
In this exercise the matrices are all \(n \times n\). Each part of the exercise is an implication of the form "If (statement l), then (statement 2)." Mark an implication as True if the truth of (statement 2) always follows whenever ( statement 1) happens to be true. An implication is False if there is an instance in which ( statement 2) is false but (statement l) is true. Justify each answer.
-
If the equation \(A \mathbf{x}=\mathbf{0}\) has only the trivial solution, then \(A\) is row equivalent to the \(n \times n\) identity matrix. (1)
- True
-
If the columns of \(A\) span \(\mathbb{R}^n\), then the columns are linearly independent. (1)
- True
-
If \(A\) is an \(n \times n\) matrix, then the equation \(A \mathbf{x}=\mathbf{b}\) has at least one solution for each \(\mathbf{b}\) in \(\mathbb{R}^n\). (1)
- False
-
If the equation \(A \mathbf{x}=\mathbf{0}\) has a nontrivial solution, then \(A\) has fewer than \(n\) pivot positions. (1)
- True
-
If \(A^T\) is not invertible, then \(A\) is not invertibl5. (1)
- True
Exercise 5¶
[Python] Given
\(A=\left[\begin{array}{ccc}1 & 0 & 0 \\ 0 & 3 & 0 \\ 0 & 0 & -3\end{array}\right]\) and \(B=\left[\begin{array}{ccc}1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1\end{array}\right]\).
Solve the matrix equation \(X+A=2(X-B)\).
\(X=\left[\begin{array}{ccc}3 & 2 & 2 \\ 2 & 5 & 2 \\ 2 & 2 & -1\end{array}\right]\)
Exercise 6¶
[Python] Let the matrix \(A\) be given by
\(A=\left[\begin{array}{cc} 3-2 q & 1 \\ 4 & 3+2 q \end{array}\right]\)
where \(q\) is a scalar. Calculate \(q\) so that
\(A^2=\left[\begin{array}{cc} 29 & 6 \\ 24 & 125 \end{array}\right]\)
\(q=4\)