Get startedGet started for free

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.

This exercise is part of the course

Linear Algebra for Data Science in R

View Course

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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[, ___]
Edit and Run Code