📘
Verify Eigenvector
EasyLinear Algebra
Implement a function to verify if a given vector is an eigenvector of a matrix with a specified eigenvalue. This concept is crucial in linear algebra as eigenvectors represent directions in which a matrix transformation scales a vector by a factor, known as the eigenvalue. The equation Av=λv represents this relationship, where A is the matrix, v is the eigenvector, and λ is the eigenvalue.
To verify if v is an eigenvector of A with eigenvalue λ, we need to check if the matrix A transforms v into a scaled version of itself. Here are the steps:
- Compute the product of A and v.
- Compute the product of λ and v.
- Compare the results to determine if they are equal.
This technique is widely used in computer vision for image compression and dimensionality reduction.
Example:
Input:
is_eigenvector([[2, 0], [0, 3]], [1, 0], 2)
Output:
True
Reasoning:
A @ [1, 0] = [2, 0] = 2 × [1, 0]
Constraints:
- A is a square matrix (n×n) where 1 ≤ n ≤ 10
- v is a non-zero vector of length n
- λ is a scalar
- Use tolerance of 1e-6 for floating-point comparison
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.