Exercises — Lesson 4: Matrices and Linear Maps

Exercise 4.1. [Hand] Write down the \(2 \times 2\) matrices of: (a) reflection through the line \(x_2 = x_1\); (b) scaling by 3 in the \(x_1\) direction only; (c) rotation by \(180^\circ\). (Use the columns-are-images-of-\(e_k\) principle; no formulas to memorize.)

Solution.

(a) Reflection through the line \(x_2 = x_1\), i.e. \(x_1 - x_2 = 0\):

\[ R = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \]

(b) Scaling by 3 in the \(x_1\) direction:

\[ S = \begin{pmatrix} 3 & 0 \\ 0 & 1 \end{pmatrix} \]

(c) Rotation by \(180^\circ\):

\[ R_{180^\circ} = \begin{pmatrix} -1 & 0 \\ 0 & -1 \end{pmatrix} = \begin{pmatrix} \cos\pi & -\sin\pi \\ \sin\pi & \cos\pi \end{pmatrix} \]


Exercise 4.2. [Hand] With \(A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}\) (a shear) and \(B = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}\), compute \(AB\), \(BA\), and \(A^\mathsf{T} B^\mathsf{T}\). Check \((BA)^\mathsf{T} = A^\mathsf{T} B^\mathsf{T}\).

Solution. With

\[ A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}, \quad B = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}, \quad e_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad e_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}, \quad A^\mathsf{T} = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}, \quad B^\mathsf{T} = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}, \]

the images of the basis vectors are

\[ \begin{aligned} A e_1 &= \begin{pmatrix} 1 \\ 0 \end{pmatrix} & A e_2 &= \begin{pmatrix} 1 \\ 1 \end{pmatrix} & A^\mathsf{T} e_1 &= \begin{pmatrix} 1 \\ 1 \end{pmatrix} & A^\mathsf{T} e_2 &= \begin{pmatrix} 0 \\ 1 \end{pmatrix} \\[4pt] B e_1 &= \begin{pmatrix} 2 \\ 0 \end{pmatrix} & B e_2 &= \begin{pmatrix} 0 \\ 1 \end{pmatrix} & B^\mathsf{T} e_1 &= \begin{pmatrix} 2 \\ 0 \end{pmatrix} & B^\mathsf{T} e_2 &= \begin{pmatrix} 0 \\ 1 \end{pmatrix} \end{aligned} \]

and the products are

\[ \begin{aligned} AB &= \begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix} & (AB) e_1 &= \begin{pmatrix} 2 \\ 0 \end{pmatrix} & (AB) e_2 &= \begin{pmatrix} 1 \\ 1 \end{pmatrix} \\[4pt] BA &= \begin{pmatrix} 2 & 2 \\ 0 & 1 \end{pmatrix} & (BA) e_1 &= \begin{pmatrix} 2 \\ 0 \end{pmatrix} & (BA) e_2 &= \begin{pmatrix} 2 \\ 1 \end{pmatrix} \\[4pt] A^\mathsf{T} B^\mathsf{T} &= \begin{pmatrix} 2 & 0 \\ 2 & 1 \end{pmatrix} & (A^\mathsf{T} B^\mathsf{T}) e_1 &= \begin{pmatrix} 2 \\ 2 \end{pmatrix} & (A^\mathsf{T} B^\mathsf{T}) e_2 &= \begin{pmatrix} 0 \\ 1 \end{pmatrix} \\[4pt] B^\mathsf{T} A^\mathsf{T} &= \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix} & (B^\mathsf{T} A^\mathsf{T}) e_1 &= \begin{pmatrix} 2 \\ 1 \end{pmatrix} & (B^\mathsf{T} A^\mathsf{T}) e_2 &= \begin{pmatrix} 0 \\ 1 \end{pmatrix} \end{aligned} \]

The transpose checks:

\[ (AB)^\mathsf{T} = \begin{pmatrix} 2 & 0 \\ 1 & 1 \end{pmatrix} = B^\mathsf{T} A^\mathsf{T}, \qquad (BA)^\mathsf{T} = \begin{pmatrix} 2 & 0 \\ 2 & 1 \end{pmatrix} = A^\mathsf{T} B^\mathsf{T}. \quad\checkmark \]


Exercise 4.3. [Proof, \(\star\)] Prove that the composition of linear maps is linear, and that \(\langle Ax, y \rangle = \langle x, A^\mathsf{T} y \rangle\) for all \(x, y\) by expanding both sides in coordinates.

Proof. Let \(S : \mathbb{R}^n \to \mathbb{R}^m\) and \(T : \mathbb{R}^p \to \mathbb{R}^n\); \(S, T\) linear. Prove \(S \circ T : \mathbb{R}^p \to \mathbb{R}^m\) is linear.

Let \(x, y \in \mathbb{R}^p\) and \(\alpha, \lambda \in \mathbb{R}\). Then

\[ \begin{aligned} (S \circ T)(\alpha x + \lambda y) &= S\bigl(T(\alpha x + \lambda y)\bigr) \\ &= S\bigl(T(\alpha x) + T(\lambda y)\bigr) && \text{[$T$ linear]} \\ &= S(\alpha Tx + \lambda Ty) \\ &= S(\alpha Tx) + S(\lambda Ty) && \text{[$S$ linear]} \\ &= \alpha S T x + \lambda S T y. \qquad\square \end{aligned} \]

For the adjoint identity, let \(A\) be the matrix of \(S\) and \(B\) be the matrix of \(T\). Note

\[ (Ax)_k = \sum_{\ell = 1}^{n} A_{k,\ell}\, x_\ell \qquad \text{and} \qquad (A^\mathsf{T} y)_\ell = \sum_{k = 1}^{m} A^\mathsf{T}_{\ell,k}\, y_k . \]

Expanding both sides in coordinates:

\[ \begin{aligned} \langle Ax, y \rangle &= \sum_{k=1}^{m} (Ax)_k\, y_k = \sum_{k=1}^{m} \left( \sum_{\ell=1}^{n} A_{k,\ell}\, x_\ell \right) y_k = \sum_{k} \sum_{\ell} A_{k,\ell}\, x_\ell\, y_k \\[6pt] \langle x, A^\mathsf{T} y \rangle &= \sum_{\ell=1}^{n} x_\ell\, (A^\mathsf{T} y)_\ell = \sum_{\ell=1}^{n} x_\ell \left( \sum_{k=1}^{m} A^\mathsf{T}_{\ell,k}\, y_k \right) = \sum_{k=1}^{m} \sum_{\ell=1}^{n} A^\mathsf{T}_{\ell,k}\, x_\ell\, y_k = \sum_{k} \sum_{\ell} A_{k,\ell}\, x_\ell\, y_k \end{aligned} \]

The two double sums agree. \(\square\)


Exercise 4.4. [Proof] Using Theorem 4.3 (a linear map is determined by its values on a basis), prove: if two linear maps \(S, T : \mathbb{R}^n \to \mathbb{R}^m\) agree on a basis, they are equal. Then explain in one sentence why an \(m \times n\) matrix and a linear map \(\mathbb{R}^n \to \mathbb{R}^m\) carry exactly the same information.

Proof. If \(S, T : \mathbb{R}^n \to \mathbb{R}^m\) agree on a basis, they are equal.

Theorem 4.3 states a linear map is uniquely determined by its values on a basis. Thus if \(S, T\) agree on a basis — that is, if they map a basis in \(\mathbb{R}^n\) to the exact same set of vectors in \(\mathbb{R}^m\) — then by uniqueness they must be equal. \(\square\)

The definition of the matrix–vector product is the same operation of applying the linear map representing that matrix to a vector.