Jorge Valle

Jorge Valle

Jorge Valle is a front end developer with a particular passion for, and expertise in, JavaScript and user interfaces. Lately, he's also been diving into machine learning.

Finding the eigenvalues of a matrix

Finding the eigenvalues of a matrix can be done by solving the characteristic equation.

Matrix used

Here's the matrix I will be referring to.

$$ A = \begin{bmatrix} 2 & 3 \\ 3 & 2 \end{bmatrix} $$
Figure 1: The matrix we're using.

Solving the characteristic equation

To find the eigenvalues of the above A, we solve the characteristic equation, which is defined as follows.

$$ \det(A - \lambda I) = 0 $$
Figure 2: Definition of characteristic equation.

In this case, $I$ is simply the identity matrix. Swapping in $A$ and $I$ yields the following.

$$ \det( \begin{bmatrix} 2 & 3 \\ 3 & 2 \end{bmatrix} - \lambda \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} ) = 0 \\ $$
Figure 3: Let's swap in the identity matrix.

$1$ times $λ$ is just $λ$, so we can clarify further.

$$ \det( \begin{bmatrix} 2 & 3 \\ 3 & 2 \end{bmatrix} - \begin{bmatrix} \lambda & 0 \\ 0 & \lambda \end{bmatrix} ) = 0 $$
Figure 4: Further clarifying.

Then, we do the simple subtraction.

$$ \det( \begin{bmatrix} 2 - \lambda & 3 \\ 3 & 2 - \lambda \end{bmatrix} ) = 0 $$
Figure 5: We subtract.

Remembering how to find the determinant, we can then express this as follows.

$$ \begin{align} ((2 - \lambda) \times (2 - \lambda)) - (3 \times 3) & = 0 \\ 4 - 2\lambda - 2\lambda + \lambda^2 - 9 & = 0 \\ -5 - 4\lambda + \lambda^2 & = 0 \end{align} $$
Figure 6: Finding the determinant.

This can be rearranged to a tidier expression.

$$ \lambda^2 - 4\lambda - 5 = 0 $$
Figure 7: Cleaning up.

This is now the characteristic polynomial, with solutions at 5 and -1: these are the eigenvalues of $A$.

Numpy implementation

This is the method for returning eigenvalues in Numpy. Note that the similar numpy.linalg.eig() method returns both the eigenvalues and the eigenvectors.


Books, patrons and coffee in Caffè San Marco, Trieste