Computing Eigenvectors in R
In this exercise you'll find the eigenvectors of a matrix, and show that they satisfy the properties discussed in the lecture.
Este exercício faz parte do curso
Linear Algebra for Data Science in R
Instruções do exercício
- For the matrix
A
with the following R output:
[,1] [,2]
[1,] 1 2
[2,] 1 1
find eigenvectors corresponding to the two eigenvalues (recall that there are infinitely many of each, but R will only report one for each).
- Print both eigenvectors.
- Show that, for each eigenvalue/eigenvector pair, \(A\vec{v} = \lambda \vec{v}\).
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Find the eigenvectors of A and store them in Lambda
Lambda <- eigen(___)
# Print eigenvectors
print(Lambda$____[, 1])
print(Lambda$vectors[, ___])
# Verify that these eigenvectors & their associated eigenvalues satisfy Av - lambda v = 0
Lambda$values[1]*Lambda$vectors[, ___] - A%*%Lambda$vectors[, 1]
Lambda$values[2]*Lambda$vectors[, 2] - A%*%Lambda$vectors[, ___]