Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Linear Algebra for Data Science in R

Cursus bekijken

Oefeninstructies

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

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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[, ___]
Code bewerken en uitvoeren