Skip to content
DeepForgeby svx
All problems
MediumLinear Algebrala-128

Diagonalizability via Distinct Eigenvalues

Problem

Decide whether a 2x2 matrix A is diagonalizable over the reals.

If the eigenvalues are real and distinct (discriminant > 1e-9), return True. If the eigenvalue is repeated, A is diagonalizable only when A is that scalar multiple of the identity. Otherwise return False.

Hint

A repeated eigenvalue needs a full set of two independent eigenvectors.

Test cases

case 1
in: [[[2,0],[0,3]]]
expected: true
case 2
in: [[[1,1],[0,1]]]
expected: false
case 3
in: [[[2,0],[0,2]]]
expected: true
case 4
in: [[[1,1],[-1,1]]]
expected: false
Starter codePython
def is_diagonalizable_2x2(A):
    # Your code here
    pass

4 test cases · run your code against them in the editor