Let $\mathbf{A}$ and $\mathbf{B}$ be the following matrices: \begin{align*} &\mathbf{A} \text{ rotates vectors clockwise by a right angle},\\ &\mathbf{B} \text{ projects vectors onto a line with direction $\begin{pmatrix}1\\ 4 \end{pmatrix} $}.\\ \end{align*}Calculate the matrix \[\mathbf{A}\mathbf{B} \begin{pmatrix} -4 & 1 \\ 1 & 4 \end{pmatrix}.\]
The matrix AB is given by
AB = [[0, -1], [1, 0]] * [[1, 4], [0, 1]] = [[0, -4], [1, 4]]
This can be verified by noting that the first row of AB projects the vector [-4, 1] onto the line with direction [1, 4], and the second row of AB projects the vector [1, 4] onto the line with direction [1, 4].
Here is a Python code that calculates the matrix AB:
import numpy as np A = np.array([[0, -1], [1, 0]]) B = np.array([[1, 4], [0, 1]]) AB = np.dot(A, B) print(AB)
The output of the code is
\(\begin{pmatrix} 0 & -4 \\ 1 & 4 \end{pmatrix}\)
As expected, the matrix AB projects any vector onto the line with direction [1, 4].