Dhruv On Math     About     All Posts     Feed

Interactive Visualization of Why Eigenvectors Matter

You’ve probably heard the word eigenvectors hundreds of times in class and have been asked to calculate it hundreds more. But why is this concept so central in Linear Algebra? Why is it that we study the eigenvector of a matrix so often?

In this post, we’ll see how Eigenvectors help us immediately understand what a linear function will do to an input. We’ll do so by playing with an interactive visualization that allows us to see just that.

Quick Refresher

Here, applying AA on its eigenvector vv leades to a new vector λv\lambda v is in the same direction as vv. Image Source: Wikipedia.

Let’s do a quick refresher to begin with. The eigenvector of a linear function AA is just the vector vv s.t. Av=λvAv = \lambda v for some constant λ\lambda which we call the eigenvalue. At a high level, the eigenvector is just a dimension along which the linear function only stretches its input (for real valued eigenvalues).

This is great and all but what can we do once we find an Eigenvector? What does it tell us about the underlying Matrix?

Linear Functions Pull Inputs Towards the Dominant Eigenvector

Let’s start with an example. Take the following linear function:

A=[3214]A = \begin{bmatrix}3 & 2 \\ 1 & 4\end{bmatrix}

Let’s see what happens when we apply AA repeatedly on the input [01]\begin{bmatrix} 0 \\ 1\end{bmatrix}.

To play with this visualization, do the following:

  1. Drag the slider to increase the number of times we apply AA.
  2. Notice how the output vector tilts towards v1v_1, an eigenvector of AA.

So just by knowing an eigenvector of AA (namely the dominant eigenvector), we can get a sense of what AA does - AA pulls its input towards the axis of the dominant eigenvector.

How is this happening? And why is it only towards one eigenvector?

Breaking Up the Input With an Eigenbasis

You’ll be surprised to see that this behavior comes very naturally from the properties of linear functions. Let’s see this with an example.

Let’s keep the same matrix/linear function A=[3214]A = \begin{bmatrix}3 & 2 \\ 1 & 4\end{bmatrix}, and analyze applying AA three times on the input v=[01]v = \begin{bmatrix} 0 \\ 1 \end{bmatrix} (i.e. A3vA^3v).

In the standard way, we'd just use standard matrix multiplication to find A3v.A^3v.

The standard way to do this is to simply follow the rules of multiplication and carry out A(A(A(v))).A(A(A(v))). But instead, let’s do this a different way using eigenvectors.

In the following discussion we will split vv into a linear combination of AA's eigenvectors. We then apply A3A^3 to each of these pieces and combine the result.

We know that that any vector vv can be written as the sum of the eigenvectors of AA. After all, eigenvectors are linearly independent and form a basis for the space (if the matrix AA is diagonalizable, which it is). If v1v_1 and v2v_2 are the eigenvectors of A,A, we can break up vv as:

v=c1v1+c2v2v = c_1 \cdot v_1 + c_2 \cdot v_2 for some constants c1c_1 and c2.c_2.

We first split vv into its eigenvector subcomponents.

When we have this representation, we can then rethink A3vA^3v as:

A3v=A3(c1v1+c2v2)A^3v = A^3(c_1 \cdot v_1 + c_2 \cdot v_2)

or more simply:

A3v=c1A3v1+c2A3v2A^3v = c_1 \cdot A^3v_1 + c_2\cdot A^3v_2

We then carry out A3v1A^3v_1 and A33v2.A^33v_2.

We then carry out the computation of A3v1A^3v_1 and A3v2A^3v_2. Thanks to v1v_1 and v2v_2 being eigenvectors, we have:

A3v1=λ13v1A^3v_1 = \lambda_1^3v_1 A3v2=λ23v2A^3v_2 = \lambda_2^3v_2

We finally combine the results to get A3v.A^3v.

We then finally combine the results to get A3v.A^3v. We find:

A3v=c1λ13v1+c2λ23v2A^3v = c_1 \lambda_1^3v_1 + c_2 \lambda_2^3v_2

Dominant Eignevalues and Eigenvectors

Now, what happens when λ1|\lambda_1| is larger than λ2|\lambda_2| (i.e. there exists a dominant eigenvalue)? In this example, λ1=5\lambda_1 = 5 and λ2=2.\lambda_2 = 2. Let’s now display what it would look like to carry out A3vA^3v when we have this difference in eigenvalues.

The interaction below shows this setup:

  1. Drag the slider to increase or decrease the number of times we apply AA on v.v.
  2. Notice how “Output Eigenvector 1” and “Output Eigenvector 2” change at different rates.
  3. Notice how “Final Output Vector” tilts towards “Output Eigenvector 1” as you drag the slider to the right.

We thus see that when there’s one eigenvalue larger than the other (λ1>λ2|\lambda_1| > |\lambda_2|), the linear function pushes its inputs towards the eigenvector associated with that large eigenvalue (“Output EigenVector One”). The more times we apply AA, the larger this effect.

Note this “push” effect will only happen towards this eigenvector with the largest eignevalue - not any of the other eigenvectors.

Why this happens

This tilt towards “Output Vector One” happens due to exponential growth. λ1x\lambda_1^x grows much faster than λ2x\lambda_2^x. As such the more times we apply AA (xx in our exponentials), the bigger the difference between λ1x\lambda_1^x and λ2x.\lambda_2^x. Hence the v1v_1 term has much more weight in the final sum. This increasing difference is shown in the plot below.

Due to the power of exponentials, the dominant eigenvector will play a bigger and bigger role the more times we apply A. Notice how the distance between the two expontial functions increases with x.


So, just using the properties of linear functions, we are able to see why eigenvectors are so important. They show us where a linear function will “push” its inputs.

If you’ve enjoyed this post on eigenvectors, check out the following additional posts on the topic I’ve written:

  1. You could have come up with eigenvectors. Here’s how.
  2. How Eigenvectors Power PageRank - the algorithm behind Google Search.

Thanks for reading!


  1. Everything I’ve discussed is for real eigenvalues.
  2. This only applies for matrices that are diagonalizable.


Thanks to Luis Serrano, Rouzbeh Shirvani, and Pranav Ramkrishnan for feedback.