PIXELBANKv8.2.1
Menu

2x2 Eigenvalues

Implement a solution to compute the eigenvalues of a 2×2 matrix using the characteristic equation. This task involves finding the scalar values, λ, that represent how much change occurs in a linear transformation.

The concept of eigenvalues and eigenvectors is crucial in linear algebra, as it helps describe the properties of linear transformations. For a 2×2 matrix A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}, the eigenvalues satisfy the equation det(AλI)=0\det(A - \lambda I) = 0, where II is the identity matrix.

  1. Start with the matrix AA and the identity matrix II.
  2. Construct the matrix AλIA - \lambda I.
  3. Compute the determinant of AλIA - \lambda I and set it equal to zero.
λ2(a+d)λ+(adbc)=0\lambda^2 - (a+d)\lambda + (ad-bc) = 0

This technique is widely used in computer vision for image processing and analysis.

Example:

Input:
A = [[4, 1], [2, 3]]
Output:
eigenvalues = [5.0, 2.0]
Reasoning:

Finding eigenvalues of a 2×2 matrix using the characteristic equation:

For matrix A = [[a, b], [c, d]], eigenvalues satisfy: det(AλI)=0\det(A - \lambda I) = 0

  1. Set up the characteristic equation: For A = [[4, 1], [2, 3]]: det(4λ123λ)=0\det\begin{pmatrix} 4-\lambda & 1 \\ 2 & 3-\lambda \end{pmatrix} = 0

  2. Expand the determinant: (4λ)(3λ)(1)(2)=0(4-\lambda)(3-\lambda) - (1)(2) = 0 124λ3λ+λ22=012 - 4\lambda - 3\lambda + \lambda^2 - 2 = 0 λ27λ+10=0\lambda^2 - 7\lambda + 10 = 0

  3. Apply the quadratic formula: λ=7±49402=7±32\lambda = \frac{7 \pm \sqrt{49 - 40}}{2} = \frac{7 \pm 3}{2}

  4. Solve for both eigenvalues: λ1=7+32=5\lambda_1 = \frac{7 + 3}{2} = 5 λ2=732=2\lambda_2 = \frac{7 - 3}{2} = 2

  5. Result: eigenvalues = [5.0, 2.0]

The trace (sum of diagonal) equals 4+3=7=5+24 + 3 = 7 = 5 + 2, and determinant equals 122=10=5×212 - 2 = 10 = 5 \times 2. ✓

Constraints:

  • A is a 2×2 real matrix
  • Return eigenvalues sorted in descending order
  • Round to 4 decimal places
  • Assume real eigenvalues (discriminant ≥ 0)
Editor

Test Results

0/0
Run code to see test results.