v9.1.1
Menu

Verify Eigenvector

easyFREEEigenvalues & EigenvectorsLinear AlgebraCV: Mathematical Foundations

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=λvA\mathbf{v} = \lambda\mathbf{v} represents this relationship, where AA is the matrix, v\mathbf{v} is the eigenvector, and λ\lambda is the eigenvalue.

To verify if v\mathbf{v} is an eigenvector of AA with eigenvalue λ\lambda, we need to check if the matrix AA transforms v\mathbf{v} into a scaled version of itself. Here are the steps:

  1. Compute the product of AA and v\mathbf{v}.
  2. Compute the product of λ\lambda and v\mathbf{v}.
  3. Compare the results to determine if they are equal.
Av=λvA\mathbf{v} = \lambda\mathbf{v}

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
  • Inputs: A=(2003)A = \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix} is a 2×22 \times 2 matrix, v=(1,0)\mathbf{v} = (1, 0) is the candidate, and λ=2\lambda = 2 is the claimed scale factor.
  • Left side, AvA\mathbf{v}: each entry is a row of AA dotted with v\mathbf{v}. Row 1: 2⋅1+0⋅0=22 \cdot 1 + 0 \cdot 0 = 2. Row 2: 0⋅1+3⋅0=00 \cdot 1 + 3 \cdot 0 = 0. So Av=(2,0)A\mathbf{v} = (2, 0).
  • Right side, λv\lambda\mathbf{v}: scaling every entry by 2 gives (2,0)(2, 0).
  • Compare: the entry-wise differences are ∣2−2∣=0|2 - 2| = 0 and ∣0−0∣=0|0 - 0| = 0, both below 10−610^{-6}, so the answer is True.
  • Output: a single boolean. True only if every entry matches within the tolerance.
  • Notice: with v=(1,1)\mathbf{v} = (1, 1) and λ=2\lambda = 2, Av=(2,3)A\mathbf{v} = (2, 3) but λv=(2,2)\lambda\mathbf{v} = (2, 2). The second entry is off by 1, so the result is False: AA stretches the two axes by different amounts, so (1,1)(1, 1) leaves its own line.

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

Learn this in

More from CV: Mathematical Foundations

solution.py

Test results

Sign in to run your code against the test cases.