Unable to verify `eigen(A)`

I haven’t had my coffee yet, but it seems like following should return true. Where did I get turned around?

using LinearAlgebra

A = rand(5, 5)
Λ, Y = eigen(A)
Λ = Diagonal(Λ)
A * Y ≈ Λ * Y

Figured it out: You need to right-multiply by Λ:

A = rand(5, 5)
Λ, Y = eigen(A)
Λ = Diagonal(Λ)
A * Y ≈ Y * Λ  # true

If anyone else makes this mistake and needs a good excuse, you can point out that the following works in Python :wink:

import numpy as np

A = np.random.rand(5, 5)
Λ, Y = np.linalg.eig(A)
np.allclose(A @ Y, Λ * Y)
4 Likes