Problems
Bases, Linear Maps, Matrix Representations, and Eigenvalues and Eigenvectors
For the problems in the section we consider the following bases of \(\mathbb{R}^3\):
\(S_1 = \left\{\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}\right\}\)
\(S_2 = \left\{\begin{pmatrix} 1 \\ 2 \\ -4 \end{pmatrix}, \begin{pmatrix} -3 \\ -3 \\ 4 \end{pmatrix}, \begin{pmatrix} 1 \\ 1 \\ -1 \end{pmatrix}\right\}\)
\(S_3 = \left\{\begin{pmatrix} \sqrt{3}/3 \\ \sqrt{3}/3 \\ \sqrt{3}/3 \end{pmatrix}, \begin{pmatrix} \sqrt{2}/2 \\ 0 \\ -\sqrt{2}/2 \end{pmatrix}, \begin{pmatrix} -\sqrt{6}/6 \\ \sqrt{6}/3 \\ -\sqrt{6}/6 \end{pmatrix}\right\}\)
And the following bases of \(\mathbb{R}^4\):
\(S_4 = \left\{\begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix}, \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix}\right\}\)
\(S_5 = \left\{\begin{pmatrix} 1 \\ 0 \\ 0 \\ -1 \end{pmatrix}, \begin{pmatrix} 2 \\ -2 \\ -1 \\ 1 \end{pmatrix}, \begin{pmatrix} 3 \\ 1 \\ 0 \\ -2 \end{pmatrix}, \begin{pmatrix} 4 \\ -4 \\ -1 \\ -2 \end{pmatrix}\right\}\)
\(S_6 = \left\{\begin{pmatrix} 1/2 \\ 1/2 \\ 1/2 \\ 1/2 \end{pmatrix}, \begin{pmatrix} 1/2 \\ 1/2 \\ -1/2 \\ -1/2 \end{pmatrix}, \begin{pmatrix} 1/2 \\ -1/2 \\ 1/2 \\ -1/2 \end{pmatrix}, \begin{pmatrix} 1/2 \\ -1/2 \\ -1/2 \\ 1/2 \end{pmatrix}\right\}\)
Bases in NumPy
import numpy as np
# Bases for R^3
= [
S1 1, 0, 0]),
np.array([0, 1, 0]),
np.array([0, 0, 1])
np.array([
]
= [
S2 1, 2, -4]),
np.array([-3, -3, 4]),
np.array([1, 1, -1])
np.array([
]
= [
S3 3)/3, np.sqrt(3)/3, np.sqrt(3)/3]),
np.array([np.sqrt(2)/2, 0, -np.sqrt(2)/2]),
np.array([np.sqrt(-np.sqrt(6)/6, np.sqrt(6)/3, -np.sqrt(6)/6])
np.array([
]
# Bases for R^4
= [
S4 1, 0, 0, 0]),
np.array([0, 1, 0, 0]),
np.array([0, 0, 1, 0]),
np.array([0, 0, 0, 1])
np.array([
]
= [
S5 1, 0, 0, -1]),
np.array([2, -2, -1, 1]),
np.array([3, 1, 0, -2]),
np.array([4, -4, -1, -2])
np.array([
]
= [
S6 1/2, 1/2, 1/2, 1/2]),
np.array([1/2, 1/2, -1/2, -1/2]),
np.array([1/2, -1/2, 1/2, -1/2]),
np.array([1/2, -1/2, -1/2, 1/2])
np.array([
]
# You can also define these as matrices (each column is a basis vector)
= np.column_stack(S1) # Standard basis as a matrix
S1_matrix = np.column_stack(S2) # S2 as a matrix
S2_matrix = np.column_stack(S3) # S3 as a matrix
S3_matrix = np.column_stack(S4) # Standard basis for R^4 as a matrix
S4_matrix = np.column_stack(S5) # S5 as a matrix
S5_matrix = np.column_stack(S6) # S6 as a matrix S6_matrix
Bases in SymPy
from sympy import *
init_printing()
# Bases for R^3
= [
S1_sp 1, 0, 0]),
Matrix([0, 1, 0]),
Matrix([0, 0, 1])
Matrix([
]= [
S2_sp 1, 2, -4]),
Matrix([-3, -3, 4]),
Matrix([1, 1, -1])
Matrix([
]= [
S3_sp 3)/3, sqrt(3)/3, sqrt(3)/3]),
Matrix([sqrt(2)/2, 0, -sqrt(2)/2]),
Matrix([sqrt(-sqrt(6)/6, sqrt(6)/3, -sqrt(6)/6])
Matrix([
]# Bases for R^4
= [
S4_sp 1, 0, 0, 0]),
Matrix([0, 1, 0, 0]),
Matrix([0, 0, 1, 0]),
Matrix([0, 0, 0, 1])
Matrix([
]= [
S5_sp 1, 0, 0, -1]),
Matrix([2, -2, -1, 1]),
Matrix([3, 1, 0, -2]),
Matrix([4, -4, -1, -2])
Matrix([
]= [
S6_sp 1/2, 1/2, 1/2, 1/2]),
Matrix([1/2, 1/2, -1/2, -1/2]),
Matrix([1/2, -1/2, 1/2, -1/2]),
Matrix([1/2, -1/2, -1/2, 1/2])
Matrix([
]
# Converting lists of vectors to matrices (each column is a basis vector)
= Matrix.hstack(*S1_sp)
S1_matrix_sp = Matrix.hstack(*S2_sp)
S2_matrix_sp = Matrix.hstack(*S3_sp)
S3_matrix_sp = Matrix.hstack(*S4_sp)
S4_matrix_sp = Matrix.hstack(*S5_sp)
S5_matrix_sp = Matrix.hstack(*S6_sp) S6_matrix_sp
Part I: Bases and Coordinates
If \(S = \{\mathbf{v}_1, \ldots, \mathbf{v}_n\}\) is a basis of \(\mathbb{R}^n\) and \(\mathbf{v} \in \mathbb{R}^n\), then there exists a unique vector \(\mathbf{x} = (x_1, \ldots, x_n) \in \mathbb{R}^n\) such that \(x_1\mathbf{v}_1 + x_2\mathbf{v}_2 + \cdots + x_n\mathbf{v}_n = \mathbf{v}\). The vector \(\mathbf{x}\) is denoted by \([\mathbf{v}]_S\) and represents the vector of coordinates of \(\mathbf{v}\) with respect to \(S\).
Problem 1
Skip Problem 1 if you know how to do its problems
Find the vector \(\mathbf{v}\) if:
- \([\mathbf{v}]_{S_2} = (1,0,-1)\).
- \([\mathbf{v}]_{S_3} = (0,-1,0)\).
- \([\mathbf{v}]_{S_5} = (1,0,-1,0)\).
- \([\mathbf{v}]_{S_5} = (1,1,1,1)\).
Problem 2
If you know how to do Problem 2, do only one of its problems
For each of the following, find \([\mathbf{v}]_S\) by:
- Writing the vector equation \(\mathbf{v} = x_1\mathbf{v}_1 + x_2\mathbf{v}_2 + \cdots + x_k\mathbf{v}_k\)
- Writing it as a matrix equation or augmented matrix
- Solve it (if it is too complicated, use SymPy)
- Finding \([\mathbf{v}]_S\)
- \(\mathbf{v} = (1,1,1)\) with basis \(S_2\)
- \(\mathbf{v} = (1,1,-1)\) with basis \(S_3\)
- \(\mathbf{v} = (1,1,1,1)\) with basis \(S_5\)
- \(\mathbf{v} = (1,1,0,0)\) with basis \(S_6\)
Problem 3
Find coordinates of more than one vector in one step:
- For \(S = S_2\), find \([\mathbf{v}_1]_S\) and \([\mathbf{v}_2]_S\) where \(\mathbf{v}_1 = (1,1,0)\) and \(\mathbf{v}_2 = (0,1,1)\)
- For \(S = S_6\), find coordinates of \(\mathbf{v}_1 = (1,1,0,-1)\), \(\mathbf{v}_2 = (0,1,1,-2)\), and \(\mathbf{v}_3 = (1,0,1,0)\)
Part II: Change of Basis Matrices
If \(B_1 = \{\mathbf{v}_1, \ldots, \mathbf{v}_n\}\) and \(B_2 = \{\mathbf{w}_1, \ldots, \mathbf{w}_n\}\) are bases of \(\mathbb{R}^n\), then there exists an invertible \(n \times n\) matrix \(P = P_{B_1\leftarrow B_2}\) such that for every \(\mathbf{v} \in \mathbb{R}^n\): \[[\mathbf{v}]_{B_1} = P[\mathbf{v}]_{B_2}.\] Moreover, \(P = \begin{bmatrix} [\mathbf{w}_1]_{B_1} & [\mathbf{w}_2]_{B_1} & \cdots & [\mathbf{w}_n]_{B_1} \end{bmatrix}\)
Problem 4
- Find the change of basis matrix from \(S_2\) to \(S_1\)
- Find the change of basis matrix from \(S_1\) to \(S_3\)
- Find the change of basis matrix from \(S_2\) to \(S_3\)
- Suppose that \(S=\{\mathbf{w}_1, \mathbf{w}_2, \mathbf{w}_3\}\) is a basis for \(\mathbb{R}^3\) and that \(P = \begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 1 \end{bmatrix}\) is the change of basis matrix from \(S\) to \(S_2\). Find \(\mathbf{w}_1\), \(\mathbf{w}_2\), and \(\mathbf{w}_3\).
- Suppose that \(S=\{\mathbf{w}_1, \mathbf{w}_2, \mathbf{w}_3,\mathbf{w}_4\}\) is a basis for \(\mathbb{R}^4\) and that \(P = \begin{bmatrix} 1 & -1 & 1 & 0 \\ 0 & -2 & 1 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & -2 \end{bmatrix}\) is the change of basis matrix from \(S_5\) to \(S\). Find \(\mathbf{w}_1\), \(\mathbf{w}_2\), \(\mathbf{w}_3\), and \(\mathbf{w}_4\).
Part III: Matrix Representation of Linear Maps
Recall that for a linear map \(T: \mathbb{R}^n \rightarrow \mathbb{R}^n\) and a basis \(S = \{\mathbf{v}_1, \ldots, \mathbf{v}_n\}\), there exists a unique matrix \(A\) such that \[[T(\mathbf{v})]_S = A[\mathbf{v}]_S.\] Moreover \(A = \begin{bmatrix} [T(\mathbf{v}_1)]_S & [T(\mathbf{v}_2)]_S & \cdots & [T(\mathbf{v}_n)]_S \end{bmatrix}\)
Problem 5
Suppose that \(S=\{\mathbf{v}_1,\mathbf{v}_2,\mathbf{v}_3\}\) is a basis of \(\mathbb{R}^3\) and that \(T:\mathbb{R}^3\to\mathbb{R}^3\) is a linear map satisfying \(T(\mathbf{v}_1) = -2\mathbf{v}_1\), \(T(\mathbf{v}_2) = 8\mathbf{v}_2\), \(T(\mathbf{v}_3) = \mathbf{v}_3\). Find the matrix representation of \(T\) with respect to \(S\). Notice that \(S\) is a basis of eigenvectors.
Suppose that \(S=\{\mathbf{v}_1,\mathbf{v}_2\}\) is a basis of \(\mathbb{R}^2\) and that the matrix representation of the linear map \(T:\mathbb{R}^2\to\mathbb{R}^2\) is \(\begin{bmatrix} -2 & 0 \\ 0 & 8 \end{bmatrix}\). Find \(T(\mathbf{v}_1)\) and \(T(\mathbf{v}_2)\). Can you find the eigenvalues and eigenvectors of \(T\)?
Let \(T:\mathbb{R}^3\to\mathbb{R}^3\) be defined by \(T(x,y,z) = (x+y, 2x-y+z, z-3x)\):
- Prove \(T\) is linear
- Find the matrix representation of \(T\) with respect to \(S_1\)
- Find the matrix representation of \(T\) with respect to \(S_2\)
Suppose that the matrix representation of \(T:\mathbb{R}^3\to\mathbb{R}^3\) with respect to \(S_2\) is \(A = \begin{bmatrix} 1 & 2 & 0 \\ -1 & 2 & -1 \\ 0 & 0 & 1 \end{bmatrix}\).
- Find \(T((1,1,-1))\)
- Find \(T((1,1,1))\)
- Find \(\mathbf{v}\) such that \(T(\mathbf{v}) = (-3,-3,4)\)
- Find the matrix representation with respect to \(S_1\)
Suppose that the matrix representation of \(T:\mathbb{R}^4\to\mathbb{R}^4\) with respect to \(S_6\) is \(A = \begin{bmatrix} 1 & 2 & 0 & 0 \\ -1 & 2 & -1 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 4 & 0 & 1 \end{bmatrix}\).
- Find \(T((1/2,1/2,1/2,1/2))\)
- Find \(T((1,0,0,0))\)
- Find \(T((0,1,0,0))\)
- Find a basis for \(\text{nul}(A)\) and use it to find a non-zero \(\mathbf{v}\) such that \(T(\mathbf{v})=\mathbf{0}\)
Part IV: Matrix Representations with Respect to Two Bases
Let \(\mathcal{B}_1=\{\mathbf{v}_1,\dots,\mathbf{v}_n\}\) and \(\mathcal{B}_2=\{\mathbf{w}_1,\dots,\mathbf{w}_n\}\) be bases of \(\mathbb{R}^n\) and let \(T:\mathbb{R}^n\to\mathbb{R}^n\) be a linear map. Recall that there exist unique \(n\times n\) matrices \(A\) and \(B\) such that for every \(\mathbf{v}\in\mathbb{R}^n\), \[ [T\mathbf{v}]_{\mathcal{B}_1}=A[\mathbf{v}]_{\mathcal{B}_1}\quad\text{ and }\quad[T\mathbf{v}]_{\mathcal{B}_2}=B[\mathbf{v}]_{\mathcal{B}_2} \]
Let \(P=P_{\mathcal{B}_1\leftarrow\mathcal{B}_2}\) be the change of basis matrix from \(\mathcal{B}_2\) to \(\mathcal{B}_1\). Then for every \(\mathbf{v}\in\mathbb{R}^n\), \([\mathbf{v}]_{\mathcal{B}_1}=P[\mathbf{v}]_{\mathcal{B}_2}\). Then using this on the previous equation, we get that \[B = P^{-1}AP\quad\text{ and equivalently }\quad A=PBP^{-1}\]
Problem 6
- Suppose that the matrix representation of the linear map \(T:\mathbb{R}^4\to\mathbb{R}^4\) with respect \(S_6\) is a diagonal matrix with entries \((-1,2,0,4)\).
- Find the eigenvalues and eigenvectors of \(T\).
- Find the matrix representation of \(T\) with respect to \(S_4\).
- In Problem 5 (4) you found the matrix representations of a linear map \(T:\mathbb{R}^3\to\mathbb{R}^3\) with respect to the basis \(S_1\). The matrix representation of \(T\) with respect to the basis \(S_2\) was given. Call these matrics \(B\) and \(A\) respectively. Then find the change of basis matrix between the bases and verify they satisfy the formulas \(PAP^{-1}=B\) or \(P^{-1}AP=B\), depending if \(P\) is the change of basis from \(S_2\) to \(S_1\) or from \(S_1\) to \(S_2\).
Part V: Finding Diagonal Representations (if they exist)
Let \(T:\mathbb{R}^n\to\mathbb{R}^n\) be a linear map. Suppose that there exists a basis \(S=\{\mathbf{v}_1,\dots,\mathbf{v}_n\}\) such that the matrix representation of \(T\) with respect to \(S\) is diagonal. That is, there exist \(\lambda_1,\dots\lambda_n\in\mathbb{R}\) such that for every \(\mathbf{v}\in\mathbb{R}^n\), \[ [T\mathbf{v}]_S=\begin{bmatrix}\lambda_1&0&\cdots&0\\0&\lambda_2&\cdots&0\\\vdots&\vdots&\ddots&0\\0&0&\cdots&\lambda_n\end{bmatrix}[\mathbf{v}]_S \] Then we can check that for every \(i\leq n\), \(T\mathbf{v}_i=\lambda_i\mathbf{v}_i\), showing that \(\mathbf{v}_i\) is an eigenvector with eigenvalue \(\lambda_i.\)
On the other hand, suppose that \(S=\{\mathbf{v}_1,\dots,\mathbf{v}_n\}\) is a basis of eigenvectors of \(T:\mathbb{R}^n\to\mathbb{R}^n\). That is, for every \(i\leq n\), there exists \(\lambda_i\in\mathbb{R}\) such that \(T\mathbf{v}_i=\lambda_i\mathbf{v}_i\). When we find the matrix representation of \(T\) with respect to \(S\) we obtain the diagonal matrix.
We now look at the same problem using matrices.
Let \(A\) be an \(n\times n\) matrix. And suppose that \(A\) has \(n\) linearly independent eigenvectors \(\mathbf{v}_1,\dots,\mathbf{v}_n.\) That is, for every \(i\leq n\), there exists \(\lambda_i\in\mathbb{R}\) such that \(A\mathbf{v}_i=\lambda_i\mathbf{v}_i\). Let \(P=\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix}\). Since \(P\) is \(n\times n\) and the columns are linearly independent, \(P\) is invertible. Then \[AP=A\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix} =\begin{bmatrix}A\mathbf{v}_1&\cdots&A\mathbf{v}_n\end{bmatrix} =\begin{bmatrix}\lambda_1\mathbf{v}_1&\cdots&\lambda_n\mathbf{v}_n\end{bmatrix} =\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix}\Lambda=P\Lambda,\] where \(\Lambda = \begin{bmatrix}\lambda_1&0&\cdots&0\\0&\lambda_2&\cdots&0\\\vdots&\vdots&\ddots&0\\0&0&\cdots&\lambda_n\end{bmatrix}\). Since \(P\) is invertible, we can solve for \(A\) and for \(\Lambda\) to get the following equations:
\[AP=P\Lambda,\quad P^{-1}AP=\Lambda,\quad A=P\Lambda P^{-1} \quad\text{ where }\quad P=\begin{bmatrix}\mathbf{v}_1&\cdots&\mathbf{v}_n\end{bmatrix}.\]
Conversely, if the matrix \(A\), \(P\) and \(\Lambda\) satisfy the previous equations, the columns of \(P\) are the eigenvectors of \(A\) and the diagonal terms of \(\Lambda\) are the eigenvalues. Finally, if \(A\) is symmetric, one can choose \(P\) to be orthogonal.
Problem 7
The matrix \(A\) is factored in the following way: \(A = \begin{bmatrix} -2 & 12 \\ -1 & 5 \end{bmatrix} = \begin{bmatrix} 3 & 4 \\ 1 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} -1 & 4 \\ 1 & -3 \end{bmatrix}\). Read the eigenvalues and eigenvectors of \(A\) from the factorization and check that they satisfy \(A\mathbf{v}=\lambda\mathbf{v}\). Find \(P\), compute \(P^{-1}\) and verify the product.
Let \(A = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & -2 \end{bmatrix}\):
- Without doing any computation find the eigenvalues of \(A\) and explain why \(A\) can de diagonalized.
- Find the eigenvectors of \(A\), write them in the form of \(P\) and \(\Lambda\) and check that \(P\) is invertible and that \(AP=P\Lambda\).
Let \(A = \begin{bmatrix} -3 & -5 & -2 \\ -5 & 0 & -5 \\ -2 & -5 & -3 \end{bmatrix}\):
- Use sympy to find the eigenvalues and eigenvectors of \(A\), using the command
A.eigenvects()
. Then find \(P\) and \(\Lambda\) and factor \(A\) as before. Check that the product gives you \(A\) and check that the eigenvectors are orthogonal. - Use numpy to find the eigenvalues and eigenvectors of \(A\). Since \(A\) is symmetric, use the command
np.linalg.eigh(A)
. Make sure that \(A\) is a numpy array and that the type is float (A.astype(float)
converts the entries of \(A\) to floats). Numpy returns a array of eigenvalues and an orthogonal matrix. Check that the matrix is orthogonal, find \(P\) and \(\Lambda\) and factor \(A\) as before.
- Use sympy to find the eigenvalues and eigenvectors of \(A\), using the command
Repeat for \(A = \begin{bmatrix} -2 & 1 & 2 \\ 1 & 2 & 0 \\ 2 & 0 & 2 \end{bmatrix}\)
Find the eigenvalues and eigenvectors of \(A=\begin{bmatrix} 0 & 1 &-1\\ 1 & 0 & 1\\ 1 & 1 & -1\end{bmatrix}\). Do we enough linearly independent eigenvectors to diagonalize \(A\)? If you do, find \(P\), \(\Lambda\) and factor \(A\) as before.
Repeat for \(A = \begin{bmatrix} -1 & 0 & 0 \\ -2 & -1 & 2 \\ -2 & 0 & 1 \end{bmatrix}\)