# A quick trick for computing eigenvalues | Chapter 15, Essence of linear algebra

## Метаданные

- **Канал:** 3Blue1Brown
- **YouTube:** https://www.youtube.com/watch?v=e50Bj7jn9IQ
- **Дата:** 07.05.2021
- **Длительность:** 13:12
- **Просмотры:** 1,273,356

## Описание

How to write the eigenvalues of a 2x2 matrix just by looking at it.
Need a refresher on eigenvalues?  https://youtu.be/PFDu9oVAE-g
Thanks to Tim for the jingle: https://www.youtube.com/acapellascience
Help fund future projects: https://www.patreon.com/3blue1brown​
An equally valuable form of support is to simply share the videos.
Special thanks to these supporters: https://3b1b.co/quick-eigen-thanks

Lockdown math lecture talking about the mean product formula:
https://youtu.be/MHXO86wKeDY

Timestamps:
0:00 - Background
4:53 - Examples
10:24 - Relation to the characteristic polynomial
12:00 - Last thoughts

------------------

These animations are largely made using a custom python library, manim.  See the FAQ comments here:
https://www.3blue1brown.com/faq#manim
https://github.com/3b1b/manim
https://github.com/ManimCommunity/manim/

You can find code for specific videos and projects here:
https://github.com/3b1b/videos/

Music by Vincent Rubinetti.
https://www.vincentrubinetti.com/

Download the music on Bandcamp:
https://vincerubinetti.bandcamp.com/album/the-music-of-3blue1brown

Stream the music on Spotify:
https://open.spotify.com/album/1dVyjwS8FBqXhRunaG5W5u

------------------

3blue1brown is a channel about animating math, in all senses of the word animate.  And you know the drill with YouTube, if you want to stay posted on new videos, subscribe: http://3b1b.co/subscribe

Various social media stuffs:
Website: https://www.3blue1brown.com
Twitter: https://twitter.com/3blue1brown
Reddit: https://www.reddit.com/r/3blue1brown
Instagram: https://www.instagram.com/3blue1brown_animations/
Patreon: https://patreon.com/3blue1brown
Facebook: https://www.facebook.com/3blue1brown

## Содержание

### [0:00](https://www.youtube.com/watch?v=e50Bj7jn9IQ) Background

This is a video for anyone who already knows what eigenvalues and eigenvectors are, and who might enjoy a quick way to compute them in the case of 2x2 matrices. If you're unfamiliar with eigenvalues, go ahead and take a look at this video here, which is actually meant to introduce them. You can skip ahead if all you want to do is see the trick, but if possible I'd like you to rediscover it for yourself. So for that, let's lay out a little background. As a quick reminder, if the effect of a linear transformation on a given vector is to scale that vector by some constant, we call it an eigenvector of the transformation, and we call the relevant scaling factor the corresponding eigenvalue, often denoted with the letter lambda. When you write this as an equation, and you rearrange a little bit, what you see is that if the number lambda is an eigenvalue of a matrix A, then the matrix A minus lambda times the identity must send some non-zero vector, namely the corresponding eigenvector, to the zero vector, which in turn means that the determinant of this modified matrix must be zero. Okay, that's all a little bit of a mouthful to say, but again, I'm assuming that all of this is review for any of you watching. So, the usual way to compute eigenvalues, how I used to do it and how I believe most students are taught to carry it out, is to subtract the unknown value lambda off the diagonals, and then solve for the determinant is equal to zero. Doing this always involves a few extra steps to expand out and simplify to get a clean quadratic polynomial, what's known as the characteristic polynomial of the matrix. The eigenvalues are the roots of this polynomial, so to find them you have to apply the quadratic formula, which itself typically requires one or two more steps of simplification. Honestly, the process isn't terrible, but at least for two by two matrices, there is a much more direct way you can get at the answer. And if you want to rediscover this trick, there's only three relevant facts you need to know, each of which is worth knowing in its own right and can help you with other problem solving. Number one, the trace of a matrix, which is the sum of these two diagonal entries, is equal to the sum of the eigenvalues. Or, another way to phrase it, more useful for our purposes, is that the mean of the two eigenvalues is the same as the mean of these two diagonal entries. Number two, the determinant of a matrix, our usual ad-bc formula, is equal to the product of the two eigenvalues. And this should kind of make sense if you understand that eigenvalues describe how much an operator stretches space in a particular direction, and that the determinant describes how much an operator scales areas, or volumes, as a whole. Now before getting to the third fact, notice how you can essentially read these first two values out of the matrix without really writing much down. Take this matrix here as an example. Straight away, you can know that the mean of the eigenvalues is the same as the mean of 8 and 6, which is 7. Likewise, most linear algebra students are pretty well practiced at finding the determinant, which in this case works out to be 48 minus 8. So right away, you know that the product of the two eigenvalues is 40. Now take a moment to see if you can derive what will be our third relevant fact, which is how you can quickly recover two numbers when you know their mean and you know their product. Here, let's focus on this example. You know that the two values are evenly spaced around the number 7, so they look like 7 plus or minus something, let's call that something d for distance. You also know that the product of these two numbers is 40. Now to find d, notice that this product expands really nicely, it works out as a difference of squares. So from there, you can find d. d squared is 7 squared minus 40, or 9, which means that d itself is 3. In other words, the two values for this very specific example work out to be 4 and 10. But our goal is a quick trick, and you wouldn't want to think through this each time, so let's wrap up what we just did in a general formula. For any mean m and product p, the distance squared is always going to be m squared minus p. This gives the third key fact, which is that when two numbers have a mean m and a product p, you can write those two numbers as m plus or minus the square root of m squared minus p. This is decently fast to re-derive on the fly if you ever forget it, and it's essentially just a rephrasing of the difference of squares formula. But even still, it's a fact that's worth memorizing so it's at the tip of your fingers. In fact, my friend Tim from the channel A Capella Science wrote us a nice quick jingle to make it a little bit more memorable: "m plus or minus squared root of m squared minus p". Let me show you how this works, say for the matrix ((3, 1), (4, 1)).

### [4:53](https://www.youtube.com/watch?v=e50Bj7jn9IQ&t=293s) Examples

You start by bringing to mind the formula, maybe stating it all in your head ("m plus or minus squared root of m squared minus p"). But when you write it down, you fill in the appropriate values for m and p as you go. So in this example, the mean of the eigenvalues is the same as the mean of 3 and 1, which is 2, so the thing you start writing is 2 plus or minus the square root of 2 squared minus. Then the product of the eigenvalues is the determinant, which in this example is 3 times 1 minus 1 times 4, or negative 1, so that's the final thing you fill in, which means the eigenvalues are 2 plus or minus the square root of 5. You might recognize that this is the same matrix I was using at the beginning, but notice how much more directly we can get at the answer. Here, try another one. This time, the mean of the eigenvalues is the same as the mean of 2 and 8, which is 5. So again, you start writing out the formula, but this time writing 5 in place of m ("m plus or minus squared root of m squared minus... "). And then the determinant is 2 times 8 minus 7 times 1, or 9 ("... p"). So in this example, the eigenvalues look like 5 plus or minus the square root of 16, which simplifies even further as 9 and 1. You see what I mean about how you can basically just start writing down the eigenvalues while you're staring at the matrix? It's typically just the tiniest bit of simplification at the end. Honestly, I've found myself using this trick a lot when I'm sketching quick notes related to linear algebra and want to use small matrices as examples. I've been working on a video about matrix exponents, where eigenvalues pop up a lot, and I realize it's just very handy if students can read out the eigenvalues from small examples without losing the main line of thought by getting bogged down in a different calculation. As another fun example, take a look at this set of three different matrices, which comes up a lot in quantum mechanics. They're known as the Pauli spin matrices. If you know quantum mechanics, you'll know that the eigenvalues of matrices are highly relevant to the physics that they describe. And if you don't know quantum mechanics, let this just be a little glimpse of how these computations are actually very relevant to real applications. The mean of the diagonal entries in all three cases is zero. So the mean of the eigenvalues in all of these cases is zero, which makes our formula look especially simple. What about the products of the eigenvalues, the determinants of these matrices? For the first one, it's 0 minus 1, or negative 1. The second one also looks like 0 minus 1, but it takes a moment more to see because of the complex numbers. And the final one looks like -1 minus 0. So in all cases, the eigenvalues simplify to be plus and minus 1. Although in this case, you really don't need a formula to find two values if you know that they're evenly spaced around 0 and their product is negative 1. If you're curious, in the context of quantum mechanics, these matrices describe observations you might make about a particle's spin in the x, y, or z direction. And the fact that their eigenvalues are plus and minus 1 corresponds with the idea that the values for the spin that you would observe would be either entirely in one direction or entirely in another, as opposed to something continuously ranging in between. Maybe you'd wonder how exactly this works, or why you would use 2x2 matrices that have complex numbers to describe spin in three dimensions. Those would be fair questions, just outside the scope of what I want to talk about here. You know, it's funny, I wrote this section because I wanted some case where you have 2x2 matrices that aren't just toy examples or homework problems, ones where they actually come up in practice, and quantum mechanics is great for that. The thing is, after I made it, I realized that the whole example kind of undercuts the point that I'm trying to make. For these specific matrices, when you use the traditional method, the one with characteristic polynomials, it's essentially just as fast. It might actually be faster. I mean, take a look at the first one. The relevant determinant directly gives you a characteristic polynomial of lambda squared minus 1, and clearly that has roots of plus and minus 1. Same answer when you do the second matrix, lambda squared minus 1. And as for the last matrix, forget about doing any computations, traditional or otherwise, it's already a diagonal matrix, so those diagonal entries are the eigenvalues. However, the example is not totally lost to our cause. Where you will actually feel the speedup is in the more general case, where you take a linear combination of these three matrices and then try to compute the eigenvalues. You might write this as a times the first one, plus b times the second, plus c times the third. In quantum mechanics, this would describe spin observations in a general direction of a vector with coordinates (a, b, c). More specifically, you should assume that this vector is normalized, meaning a squared plus b squared plus c squared is equal to 1. When you look at this new matrix, it's immediate to see that the mean of the eigenvalues is still 0. And you might also enjoy pausing for a brief moment to confirm that the product of those eigenvalues is still -1. And then from there, concluding what the eigenvalues must be. And this time, the characteristic polynomial approach would be by comparison a lot more cumbersome, definitely harder to do in your head.

### [10:24](https://www.youtube.com/watch?v=e50Bj7jn9IQ&t=624s) Relation to the characteristic polynomial

To be clear, using the mean product formula is not fundamentally different from finding roots of the characteristic polynomial. I mean, it can't be, they're solving the same problem. One way to think about this actually is that the mean product formula is a nice way to solve quadratics in general. And some viewers of the channel may recognize this. Think about it, when you're trying to find the roots of a quadratic, given the coefficients, that's another situation where you know the sum of two values, and you also know their product, but you're trying to recover the original two values. Specifically, if the polynomial is normalized, so that this leading coefficient is 1, then the mean of the roots will be -1/2 times this linear coefficient, which is -1 times the sum of those roots. With the example on the screen, that makes the mean 5. And the product of the roots is even easier, it's just the constant term, no adjustments needed. So from there, you would apply the mean product formula, and that gives you the roots ("m plus or minus squared root of m squared minus p"). And on the one hand, you could think of this as a lighter weight version of the traditional quadratic formula. But the real advantage is not just that it's fewer symbols to memorize, it's that each one of them carries more meaning with it. I mean, the whole point of this eigenvalue trick is that because you can read out the mean and product directly from looking at the matrix, you don't need to go through the intermediate step of setting up the characteristic polynomial. You can jump straight to writing down the roots without ever explicitly thinking about what the polynomial looks like. But to do that, we need a version of the quadratic formula where the terms carry some kind of meaning.

### [12:00](https://www.youtube.com/watch?v=e50Bj7jn9IQ&t=720s) Last thoughts

I realize this is a very specific trick for a very specific audience, but it's something I wish I knew in college, so if you happen to know any students who might benefit from this, consider sharing it with them. The hope is that it's not just one more thing that you memorize, but that the framing reinforces some other nice facts that are worth knowing, like how the trace and the determinant are related to eigenvalues. If you want to prove those facts, by the way, take a moment to expand out the characteristic polynomial for a general matrix, and then think hard about the meaning of each of these coefficients. Many thanks to Tim for ensuring that this mean product formula will stay stuck in all of our heads for at least a few months: "m plus or minus squared root of m squared minus p". If you don't know about A Cappella Science, please do check it out. The molecular shape of you in particular is one of the greatest things on the internet.

---
*Источник: https://ekstraktznaniy.ru/video/16185*