CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Linear Algebra for Data Science in R

Afficher le cours

Instructions

  • 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}\).

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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[, ___]
Modifier et exécuter le code