Section 4.4 Examples
Subsection 4.4.1 Basic matrix operations
Here are some basic examples of matrix addition, subtraction, and scalar multiplication. For subtraction, watch out for double negatives!
Example 4.4.1. Matrix addition.
\begin{equation*}
\left[\begin{array}{rr} 1 \amp -2 \\ 3 \amp 4 \\ -5 \amp 6 \end{array}\right]
+ \left[\begin{array}{rr} 0 \amp 1 \\ 1 \amp -2 \\ 11 \amp 0 \end{array}\right]
= \begin{bmatrix} 1+0 \amp -2+1 \\ 3+1 \amp 4+(-2) \\ -5+11 \amp 6+0 \end{bmatrix}
= \left[\begin{array}{rr} 1 \amp -1 \\ 4 \amp 2 \\ 6 \amp 6 \end{array}\right]
\end{equation*}
Example 4.4.2. Matrix subtraction.
\begin{align*}
\left[\begin{array}{rrr} 1 \amp -2 \amp 3 \\ 0 \amp -4 \amp -5 \end{array}\right]
- \left[\begin{array}{rrr} 0 \amp 1 \amp 1 \\ -2 \amp 11 \amp -1 \end{array}\right]
\amp = \begin{bmatrix} 1-0 \amp -2-1 \amp 3-1 \\ 0-(-2) \amp -4-11 \amp -5-(-1) \end{bmatrix}\\
\amp = \left[\begin{array}{rrr} 1 \amp -3 \amp 2 \\ 2 \amp -15 \amp -4 \end{array}\right]
\end{align*}
Example 4.4.3. Scalar multiplication of a matrix.
\begin{equation*}
(-5)\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
= \left[\begin{array}{rr} -5 \amp 10 \\ 15 \amp -20\end{array}\right]
\end{equation*}
Subsection 4.4.2 Matrix multiplication
Example 4.4.4. A detailed multiplication example.
Let’s compute the matrix product \(AB\text{,}\) for
\begin{align*}
A \amp = \left[\begin{array}{rr}
3 \amp -2 \\
1 \amp 0 \\
-4 \amp 5\
\end{array}\right],
\amp
B \amp = \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right].
\end{align*}
Notice that the sizes of \(A\) (\(3\times 2\)) and \(B\) (\(2\times 2\)) are compatible for multiplication in the order \(AB\text{,}\) and that the result will be size \(3\times 2\text{.}\) First let’s multiply \(A\) onto the columns of \(B\text{.}\)
\begin{align*}
\left[\begin{array}{rr} 3 \amp -2 \\ 1 \amp 0 \\ -4 \amp 5 \end{array}\right]
\left[\begin{array}{r} 1 \\ -3 \end{array}\right]
=
\begin{bmatrix}
3\cdot 1 + (-2)\cdot(-3) \\
1 \cdot 1 + 0\cdot(-3) \\
-4\cdot 1 + 5\cdot(-3)
\end{bmatrix}
= \left[\begin{array}{r} 9 \\ 1 \\ -19 \end{array}\right]\\
\left[\begin{array}{rr} 3 \amp -2 \\ 1 \amp 0 \\ -4 \amp 5 \end{array}\right]
\left[\begin{array}{r} -2 \\ 4 \end{array}\right]
=
\begin{bmatrix}
3\cdot (-2) + (-2)\cdot 4 \\
1 \cdot (-2) + 0\cdot 4 \\
-4\cdot (-2) + 5\cdot 4
\end{bmatrix}
= \left[\begin{array}{r} -14 \\ -2 \\ 28 \end{array}\right]
\end{align*}
Combining these two computations, we get
\begin{equation*}
A B =
\left[\begin{array}{rr} 3 \amp -2 \\ 1 \amp 0 \\ -4 \amp 5 \end{array}\right]
\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
=
\left[\begin{array}{rr} 9 \amp -14 \\ 1 \amp -2 \\ -19 \amp 28 \end{array}\right].
\end{equation*}
With some practise at matrix multiplication, you should be able to compute a product \(A B\) directly without doing separate computations for each column of the second matrix.
In this matrix multiplication example, notice that it does not make sense to even consider the possibility that \(B A = A B\) because the sizes of \(B\) and \(A\) are not compatible for multiplication in the order \(B A\text{,}\) and so \(B A\) is undefined!
Example 4.4.5. Matrix powers.
Since powers of matrices only work for square matrices, the power \(A^2\) is undefined for the \(3\times 2\) matrix \(A\) in the previous matrix multiplication example. But we can compute \(B^2\) for the \(2\times 2\) matrix \(B\) from that example.
\begin{align*}
B^2 = B B \amp =
\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]\\
\amp =
\left[\begin{array}{rr}
1\cdot 1 + (-2)(-3) \amp 1(-2) + (-2)\cdot 4 \\
-3\cdot 1 + 4(-3) \amp (-3)(-2) + 4\cdot 4
\end{array}\right]
= \left[\begin{array}{rr} 7 \amp -10 \\ -15 \amp 22 \end{array}\right]
\end{align*}
To compute \(B^3\text{,}\) we can compute either of
\begin{align*}
B^3 = B B B = (B B) B
\amp= B^2 B\\
\amp= \left[\begin{array}{rr} 7 \amp -10 \\ -15 \amp 22 \end{array}\right]
\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]\\
\amp=
\left[\begin{array}{rr}
7\cdot1 + (-10)(-3) \amp 7(-2) + (-10)\cdot 4 \\
-15\cdot 1 + 22(-3) \amp -15(-2) + 22\cdot 4
\end{array}\right]\\
\amp= \left[\begin{array}{rr} 37 \amp -54 \\ -81 \amp 118 \end{array}\right],\\
\end{align*}
or
\begin{align*} B^3 = B B B = B (B B) \amp= BB^2\\ \amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right] \left[\begin{array}{rr} 7 \amp -10 \\ -15 \amp 22 \end{array}\right]\\ \amp= \left[\begin{array}{rr} 1\cdot 7 + (-2)(-15) \amp 1(-10) + (-2)\cdot 22 \\ (-3)\cdot 7 + 4(-15) \amp -3(-10) + 4\cdot 22 \end{array}\right]\\ \amp= \left[\begin{array}{rr} 37 \amp -54 \\ -81 \amp 118 \end{array}\right], \end{align*}and the result is the same.
Subsection 4.4.3 Combining operations
Example 4.4.6. Computing matrix formulas involving a combination of operations.
Let’s compute both \(A (B + k C)\) and \(A B + k (A C)\text{,}\) for
\begin{align*}
A \amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right], \amp
B \amp= \left[\begin{array}{rr} 0 \amp 2 \\ 1 \amp -1 \end{array}\right], \amp
C \amp= \left[\begin{array}{rr} 5 \amp 5 \\ -2 \amp -2 \end{array}\right], \amp
k \amp= 3.
\end{align*}
Keep in mind that operations inside brackets should be performed first, and as usual multiplication (both matrix and scalar) should be performed before addition (unless there are brackets to tell us otherwise).
\begin{align*}
A (B + k C)
\amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left(
\left[\begin{array}{rr} 0 \amp 2 \\ 1 \amp -1 \end{array}\right]
+ 3\left[\begin{array}{rr} 5 \amp 5 \\ -2 \amp -2 \end{array}\right]
\right)\\
\amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left(
\left[\begin{array}{rr} 0 \amp 2 \\ 1 \amp -1 \end{array}\right]
+ \left[\begin{array}{rr} 15 \amp 15 \\ -6 \amp -6 \end{array}\right]
\right)\\
\amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left[\begin{array}{rr} 15 \amp 17 \\ -5 \amp -7 \end{array}\right]\\
\amp= \left[\begin{array}{rr} 25 \amp 31 \\ -65 \amp -79 \end{array}\right]
\end{align*}
\begin{align*}
A B + k (A C)
\amp= \left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left[\begin{array}{rr} 0 \amp 2 \\ 1 \amp -1 \end{array}\right]
+ 3\left(
\left[\begin{array}{rr} 1 \amp -2 \\ -3 \amp 4 \end{array}\right]
\left[\begin{array}{rr} 5 \amp 5 \\ -2 \amp -2 \end{array}\right]
\right)\\
\amp= \left[\begin{array}{rr} -2 \amp 4 \\ 4 \amp -10 \end{array}\right]
+ 3 \left[\begin{array}{rr} 9 \amp 9 \\ -23 \amp -23 \end{array}\right]\\
\amp= \left[\begin{array}{rr} -2 \amp 4 \\ 4 \amp -10 \end{array}\right]
+ \left[\begin{array}{rr} 27 \amp 27 \\ -69 \amp -69 \end{array}\right]\\
\amp= \left[\begin{array}{rr} 25 \amp 31 \\ -65 \amp -79 \end{array}\right]
\end{align*}
Hopefully you’re not surprised that we got the same final result for both the formulas \(A (B + k C)\) and \(A B + k (A C)\text{.}\) From our familiar rules of algebra, we expect to be able to multiply \(A\) inside the brackets in the first expression, and then rearrange the order of multiplication by \(A\) and by \(k\text{.}\) However, we need to be careful — our “familiar” rules of algebra come from operations with numbers, and matrix algebra involves operations with matrices: addition, subtraction, and two different kinds of multiplication, scalar and matrix. We should not blindly expect all of our “familiar” rules of algebra to apply to matrix operations. We’ve already seen that the matrix version of the familiar rule \(b a = a b\) is not true for matrix multiplication! In Subsection 4.5.1, we list the rules of algebra that are valid for matrix operations (which is most of our familiar rules from the algebra of numbers), and for some of the rules, in that same subsection we verify that they are indeed valid for matrices.
Subsection 4.4.4 Linear systems as matrix equations
Subsubsection 4.4.4.1 A first example
Example 4.4.7. A system as a matrix equation.
Let’s again consider the system from Task b of Discovery 4.5. To solve, we row reduce the associated augmented matrix to RREF as usual.
\begin{align*}
\amp
\left[\begin{array}{rrr|r}
1 \amp -3 \amp -1 \amp -4 \\
-2 \amp 7 \amp 2 \amp 9
\end{array}\right]
\amp\amp\rowredarrow\amp
\amp
\left[\begin{array}{rrr|r}
1 \amp 0 \amp -1 \amp -1 \\
0 \amp 1 \amp 0 \amp 1
\end{array}\right]
\end{align*}
Variable \(x_3\) is free, so assign a parameter \(x_3 = t\text{.}\) Then we can solve to obtain the general solution is parametric form,
\begin{align*}
x_1 \amp= -1 + t, \amp x_2 \amp= 1, \amp x_3 \amp= t.
\end{align*}
Let’s check a couple of particular solutions against the matrix equation \(A\uvec{x}=\uvec{b}\) that represents the system. Recall that for this system, \(\uvec{x}\) is the \(3\times 1\) column vector that contains the variables \(x_1,x_2,x_3\text{.}\) The particular solutions associated to parameter values \(t=0\) and \(t=3\) are
\begin{align*}
t = 0 \amp\colon \amp x_1 \amp= -1, \amp x_2 \amp= 1, \amp x_3 \amp= 0;\\
\end{align*}
and
\begin{align*} t = 3 \amp\colon \amp x_1 \amp= 2, \amp x_2 \amp= 1, \amp x_3 \amp= 3. \end{align*}Let’s collect the \(t=0\) solution values into the vector \(\uvec{x}\) and check \(A\uvec{x}\) versus \(\uvec{b}\text{:}\)
\begin{equation*}
\text{LHS}
= A\uvec{x}
= \left[\begin{array}{rrr}
1 \amp -3 \amp -1 \\
-2 \amp 7 \amp 2
\end{array}\right]
\left[\begin{array}{r} -1 \\ 1 \\ 0 \end{array}\right]
= \begin{bmatrix} -1 - 3 + 0 \\ 2 + 7 + 0 \end{bmatrix}
= \left[\begin{array}{r} -4 \\ 9 \end{array}\right]
= \uvec{b}
= \text{RHS}.
\end{equation*}
So the solution to the linear system we got by row reducing did indeed give us a vector solution \(\uvec{x}\) to the matrix equation \(A \uvec{x} = \uvec{b}\text{.}\) Let’s similarly check the \(t=3\) solution, as in Task f of Discovery 4.5:
\begin{equation*}
\text{LHS}
= A\uvec{x}
= \left[\begin{array}{rrr}
1 \amp -3 \amp -1 \\
-2 \amp 7 \amp 2
\end{array}\right]
\left[\begin{array}{r} 2 \\ 1 \\ 3 \end{array}\right]
= \begin{bmatrix} 2 - 3 - 3 \\ -4 + 7 + 6 \end{bmatrix}
= \left[\begin{array}{r} -4 \\ 9 \end{array}\right]
= \uvec{b}
= \text{RHS}.
\end{equation*}
Again, our system solution gives us a solution to the matrix equation.
Subsubsection 4.4.4.2 Expressing system solutions in vector form
We may use matrices and matrix algebra to express the solutions to solutions as column vectors. In particular, we can expand solutions involving parameters into a linear combination of column vectors. Expressing solutions this way allows us to see the effect of each parameter on the system.
Let’s re-examine the systems in the examples from Section 2.4 as matrix equations, and express their solutions in vector form.
Example 4.4.8. Solutions in vector form: one unique solution.
The system from Discovery 2.1 can be expressed in the form \(A\uvec{x} = \uvec{b}\) for
\begin{align*}
A \amp =
\left[\begin{array}{rrr}
2 \amp 0 \amp -2 \\
1 \amp -1 \amp 0 \\
4 \amp -2 \amp -3
\end{array}\right],
\amp
\uvec{x} \amp = \begin{bmatrix} x \\ y \\ z \end{bmatrix},
\amp
\uvec{b} \amp = \begin{bmatrix} 4 \\ 3 \\ 7 \end{bmatrix}.
\end{align*}
We solved this system in Example 2.4.1 and determined that it had one unique solution, \(x = 5\text{,}\) \(y = 2\text{,}\) and \(z = 3\text{.}\) In vector form, we write this solution as
\begin{equation*}
\uvec{x} = \begin{bmatrix} x \\ y \\ z \end{bmatrix}
= \left[\begin{array}{r} 5 \\ 2 \\ 3 \end{array}\right].
\end{equation*}
Example 4.4.9. Solutions in vector form: an infinite number of solutions.
The system from Discovery 2.2 can be expressed in the form \(A \uvec{x} = \uvec{b}\) for
\begin{align*}
A \amp =
\left[\begin{array}{rrr}
3 \amp 6 \amp 5 \\
2 \amp 4 \amp 3 \\
3 \amp 6 \amp 6
\end{array}\right],
\amp
\uvec{x} \amp = \begin{bmatrix} x \\ y \\ z \end{bmatrix},
\amp
\uvec{b} \amp = \left[\begin{array}{r} -9 \\ -5 \\ -12 \end{array}\right].
\end{align*}
We solved this system in Example 2.4.2, and determined that it had an infinite number of solutions. We expressed the general solution to the system using parametric equations
\begin{align*}
x \amp= 2-2t, \amp y \amp= t, \amp z = -3,
\end{align*}
In vector form, we expand this solution as
\begin{equation*}
\uvec{x} = \begin{bmatrix} x \\ y \\ z \end{bmatrix}
= \begin{bmatrix}2-2t\\t\\-3\end{bmatrix}
= \begin{bmatrix}2-2t\\0+t\\-3+0t\end{bmatrix}
= \left[\begin{array}{r}2\\0\\-3\end{array}\right]
+ \left[\begin{array}{r}-2t\\t\\0t\end{array}\right]
= \left[\begin{array}{r}2\\0\\-3\end{array}\right]
+ t\left[\begin{array}{r}-2\\1\\0\end{array}\right].
\end{equation*}
Notice how the solution is the sum of a constant part
\begin{equation*}
\left[\begin{array}{r}2\\0\\-3\end{array}\right]
\end{equation*}
and a variable part
\begin{equation*}
t\left[\begin{array}{r}-2\\1\\0\end{array}\right].
\end{equation*}
Further notice how the constant part is a particular solution to the system — it is the “initial” particular solution associated to the parameter value \(t=0\text{.}\)
Example 4.4.10. Solutions in vector form: a homogenous system.
The system from Discovery 2.4 is homogeneous, so it can be expressed in the form \(A\uvec{x} = \zerovec\) for
\begin{align*}
A \amp =
\left[\begin{array}{rrrr}
3 \amp 6 \amp -8 \amp 13 \\
1 \amp 2 \amp -2 \amp 3 \\
2 \amp 4 \amp -5 \amp 8
\end{array}\right],
\amp
\uvec{x} \amp = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \end{bmatrix},
\end{align*}
where \(\zerovec\) is the \(3 \times 1\) zero column vector. We solved this system in Example 2.4.4, and determined that it had an infinite number of solutions. We expressed the general solution to the system using parametric equations
\begin{align*}
x_1 \amp= -2s + t, \amp x_2 \amp= s, \amp x_3 \amp= 2t, \amp x_4 \amp= t \text{.}
\end{align*}
In vector form, we expand this solution as
\begin{equation*}
\uvec{x} = \begin{bmatrix}x_1\\x_2\\x_3\\x_4\end{bmatrix}
= \begin{bmatrix}-2s+t\\s\\2t\\t\end{bmatrix}
= \begin{bmatrix}-2s+t\\s+0t\\0s+2t\\0s+t\end{bmatrix}
= \left[\begin{array}{r}-2s\\s\\0s\\0s\end{array}\right]
+ \left[\begin{array}{r}t\\0t\\2t\\t\end{array}\right]
= s\left[\begin{array}{r}-2\\1\\0\\0\end{array}\right]
+ t\left[\begin{array}{r}1\\0\\2\\1\end{array}\right].
\end{equation*}
This time, the solution is a sum of two variables parts,
\begin{align*}
\amp s\left[\begin{array}{r}-2\\1\\0\\0\end{array}\right]
\amp \amp\text{and}\amp
\amp t\left[\begin{array}{r}1\\0\\2\\1\end{array}\right]\text{,}
\end{align*}
since there are two parameters. And there is no constant part to the general solution, because if we set both parameters to zero we obtain the trivial solution \(\uvec{x} = \zerovec\text{.}\) A homogeneous system will always work out this way. (So it would be more accurate to say that the general solution to the system from Discovery 2.4 has trivial constant part, instead of saying it has no constant part.)
Example 4.4.11. Solutions in vector form: patterns for homogeneous and nonhomogeneous systems with the same coefficient matrix.
In Example 2.4.5, we solved a homogenous system \(A\uvec{x} = \zerovec\) with
\begin{align*}
A \amp =
\left[\begin{array}{rrr}
3 \amp 6 \amp 5 \\
2 \amp 4 \amp 3 \\
3 \amp 6 \amp 6
\end{array}\right],
\amp
\uvec{x} \amp = \begin{bmatrix} x \\ y \\ z \end{bmatrix},
\end{align*}
and found an infinite number of solutions, with general solution expressed parametrically as
\begin{align*}
x \amp = -2t, \amp y \amp = t, \amp z \amp = 0.
\end{align*}
In vector form, we express this as
\begin{equation*}
\uvec{x} = \begin{bmatrix}x\\y\\z\end{bmatrix}
= \left[\begin{array}{r}-2t\\t\\0\end{array}\right]
= \left[\begin{array}{r}-2t\\t\\0t\end{array}\right]
= t\left[\begin{array}{r}-2\\1\\0\end{array}\right]\text{.}
\end{equation*}
This homogeneous system has the same coefficient matrix as in Example 4.4.9 above, so it is not surprising that their general solutions are related. In particular, notice that both systems have the same variable part, but that the nonhomogeneous system from Example 4.4.9 has a non-trivial constant part.
Subsection 4.4.5 Transpose
Example 4.4.12. Computing transposes.
Let’s compute some transposes.
\begin{align*}
A \amp = \begin{bmatrix} 1 \amp 2 \amp 3\\4 \amp 5 \amp 6 \end{bmatrix}
\amp
B \amp =
\left[\begin{array}{rrr}
-1 \amp 2 \amp 3 \\
5 \amp 0 \amp 4 \\
6 \amp 7 \amp 1
\end{array}\right]
\amp
C \amp =
\begin{bmatrix}
0 \amp 1 \amp 2 \\
1 \amp 0 \amp 3 \\
2 \amp 3 \amp 0
\end{bmatrix}\\
\utrans{A} \amp = \begin{bmatrix} 1 \amp 4\\2 \amp 5 \\ 3 \amp 6 \end{bmatrix} \amp
\utrans{B} \amp =\
\left[\begin{array}{rrr}
-1 \amp 5 \amp 6 \\
2 \amp 0 \amp 7 \\
3 \amp 4 \amp 1
\end{array}\right]
\amp
\utrans{C} \amp =
\begin{bmatrix}
0 \amp 1 \amp 2 \\
1 \amp 0 \amp 3 \\
2 \amp 3 \amp 0
\end{bmatrix}
\end{align*}
The matrix \(A\) is size \(2 \times 3\text{,}\) so when we turn rows into columns to compute \(\utrans{A}\text{,}\) we end up with a \(3\times 2\) result. Matrices \(B\) and \(C\) are square, so each of their transposes end up being the same size as the original matrix. But also, the numbers for the entries in \(B\) and \(C\) were chosen to emphasize some patterns in the transposes of square matrices. In interchanging rows and columns in \(B\text{,}\) notice how entries to the upper right of the main diagonal move to the “mirror image” position in the lower left of the main diagonal, and vice versa. So for square matrices, we might think of the transpose as “reflecting” entries in the main diagonal, while entries right on the main diagonal end up staying in place. Finally, we might consider this same “reflecting-in-the-diagonal” view of the transpose for \(C\text{,}\) except \(C\) has the same entries in corresponding “mirror image” entries on either side of the diagonal, and so we end up with \(\utrans{C} = C\text{.}\)