The applications of eigenvectors and eigenvalues | That thing you heard in Endgame has other uses

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is sponsored by curiosity stream home to over 2,500 documentaries and nonfiction titles for curious minds in a previous video I showed the basic idea behind an eigenvector and eigenvalue but as a quick review when you have some arbitrary two-by-two matrix and multiply it by a vector let's say 1 comma 0 that can be written as such you'll get out a new vector or negative 1 comma negative 2 in this case instead of representing vectors with arrows though I'll just be using points which will represent the end of the vector I'm using desmos so it's just easier this way but still we have an input and output vector and you'll notice of the matrix transformation cause the vector to scale and also rotate that's usually what happens put a random vector in here and the output vector will likely have a different length and angle in fact I'll put a bunch of random input vectors on the screen or really dots that represent their ends and I'll apply the same matrix multiplication to all of them at once these are the new output vectors and most of them are just scaled and rotated versions of their associated inputs but real quick if we rewind you'll see that any point on these two lines does not get rotated vectors on these lines only get scaled and when a matrix only scales vectors along some line that is known as an eigen vector of the matrix the scale factor or how much larger the vector gets is known as the eigenvalue you'll notice one of these eigenvalues is 1 because when we apply the transformation those vectors didn't change in length if you want to rewind it again you'll see the dots on the other eigenvector all got three times as far from the origin now if I change the 2 by 2 matrix to this aka a rotation matrix then any input will be rotated 90 degrees so the question is what is the eigenvector of this new matrix and by the way 0 0 doesn't count well considering an eigenvector is a vector not rotated by the matrix we can say that an eigenvector doesn't exist here because every vector besides zero zero gets rotated when you go through the analysis though you do come out with eigenvectors and eigenvalues however their imaginary there isn't as much visual intuition behind this what we care about is this simple fact if the eigenvalue slash vectors are imaginary or just have an imaginary component then any non-zero real input vector will be rotated by some amount from the matrix multiplication it may be scaled it may not but some rotation will definitely occur now the first visual application we're going to see the eigenvectors and eigenvalues is the fibonacci sequence as most you know this is the sequence that starts with 0 than 1 and you just add those to get the next term then you add these to get the next and this continues so mathematically to get some term you add the previous two now if I told you this number as part of that sequence and asked for the next number there's a nice visual way to find it without just going through the sequence itself the reason for this visualization is because we can express the equation through matrix multiplication just by matrix rules you'll see the first dot product gives us FN minus 1 plus FN minus 2 equals FN the same equation as above the second dot product is trivial and just says FN minus 1 plus 0 is itself we just need this included so we can have a square matrix so if I input any two neighboring terms like 8 and 5 the resulting output should just be the next term in the sequence or 13 and the same FN minus 1 we input or 8 essentially the output is just the rectangle slid over by 1 and every matrix multiplication slides it over by 1 again graphically this says if I have the vector 8 comma 5 then the matrix transformation should send it to 13 comma 8 which it does but let me do that same transformation to several Fibonacci coordinates where any points or vectors represent two neighboring terms if I keep a copy of the inputs then we can see the outputs just land on the next vector in the sequence well we care about most though is the fact that these points all seem to be very close to this line here because that is an eigenvector of our matrix point really close to that line pretty much just move further up there's mostly no rotation the associated eigenvalue is actually the golden ratio or 1 plus root 5 over 2 that's how much further the points get from the origin with each multiplication roughly since the points here aren't exactly on that line this does make it easy to predict future terms though because even way further into the sequence the coordinates will pretty much lie on this line it's the eigenvector those points aren't getting rotated off of it so if I take any point and multiply its coordinates by the golden ratio we get roughly the next point up even for the early terms like this the air is fairly small but as we zoom out and let the term number go to infinity the air goes to zero and as you can see the points start to get extremely close to that eigenvector this means if I gave you some number way further up the sequence and asked for the next you just multiply by the golden ratio and you will find it to nearly exact precision what I also find really interesting though is what happens when we apply that same matrix transformation to a bunch of random points think of each of these as the first two numbers in a new Fibonacci sequence with the same arithmetic but a different beginning if I apply the matrix multiplication we get these points representing the second pair of numbers in the sequence then another transformation gets us this set and as we keep going the points all get closer and closer to the eigenvector meaning they all start to become scaled by the golden ratio here I'll zoom out a bit so you can see where they're at just after four multiplications mathematically this tells us whether we start at 0 and 1 or 3 and 17 or any other two positive numbers so long as we use the same formula and add the two previous terms to get the next the numbers will eventually just become a golden ratio multiple of the previous that ratio is built into the arithmetic and also this matrix and its eigenvalues not the starting terms themselves now for the people who want a more real-world application this next examples for you because it combines calculus with complex numbers with eigen stuff real quick we first have to answer a few questions though let's say I put a point randomly on the XY plane and tell you it will move as some function of time my first question is what values of DX DT and dy DT will cause it to move to the right well if you've taken calculus this is pretty easy DX DT has to be positive while dy DT has to be zero that'll cause a positive change in X but no change in Y which is exactly what we want if I want the particle to move up then dy DT has to be positive while DX DT is zero and you get the idea but the slightly harder question is what if I want to move towards or away from the origin well in this case dy DT has to be 1/2 of DX DT we can see this is we think about those two velocities as a coordinate because dy DT will be 1/2 of DX DT when that coordinate is on this line the same line that passes through the particle itself and the origin the equation for this is y equals 1/2 X just to show the visuals if DX DT is 1 and dy DT is 0.5 like this corner shows then the vector sum yields this here which points directly away from the origin and that's the direction the particle would move any of these values will give us the same thing though while negative velocities will result in motion towards the origin ok now we're ready for the applications let's say there's some population of foxes we'll label f and a population of rabbits with label are these variables will represent the number of each of those animals at any given time then let's say that the population of foxes changes at a rate equal to its current population this makes some sense in that the more foxes you have the faster they'll multiply but we are assuming they live forever and there's no upper bound on population because it will simplify things if you've completed calc one you know this leads to exponential growth now the population of rabbits will grow at a rate three times their current population much faster than the foxes however they will die or be eaten at a rate equal to how many foxes there are this makes things more difficult but overall the goals to see what will happen over time if we start with some arbitrary number of both animals now graphically just consider the x axis to be rabbit population at any time and the y axis will be foxes if we say there are initially 10 rabbits and 10 foxes that's represented as a point at 10 comma 10 if we plug those numbers into the equations then we get out the derivatives which tells us the rabbits will be increasing at twice the rate as the Foxes just at that time this is just like before so if we put the dr/dt and the df/dt component at that point basically like velocities the vector sum will tell us that it will move up and to the right just at that moment this just means both the populations are increasing because even though the rabbits are being eaten that are reproducing fast enough to increase in population don't worry about the length of the vector though just the direction now had the rabbit population start at 2 instead then plugging those into the equations tells us that the rabbits will decrease in number essentially there's not enough of them now and they'll die out faster than they can reproduce so plotting those vector components tells us that at that instant the point will move up and to the left it looks like we're headed towards 0 rabbits if I did this for every point we make kind of like a slope field but it's really called a phase plane for a system of differential equations if I start at let's say 10 comma 10 we just followed the arrows and see how the population will change over time starting at 2 comma 10 we see that it eventually does reach 0 rabbits and these would just be a bunch of other scenarios depending on where you start what you're seeing are the solutions that set of differential equations for different initial conditions but making a phase plane one point a time is way too tedious so let's look at this another way I'm gonna take the coefficients and put them into a matrix that'll be multiplied by the two variables R and F I'll call the derivatives just R Prime and F Prime and my matrix multiplication you'll see these are the same thing now we can apply matrix transformations from before but this time notice that the inputs are the rabbit and fox populations those were the points you're seeing however applying the matrix multiplication will output velocities in a way or rates of change of the population not new ones here I'll put ten ten in a different color and do the multiplication while keeping a copy of it at ten ten here we have the outputs but again these represent the instantaneous rates of change for their Associated inputs as in at ten ten we'd have an R prime of twenty and F prime of ten if I proportionally shrink these and put them on top of the input then this tells us exactly what we saw before that if you put ten rabbits and ten foxes in our simulation and hit play at that moment both populations would increase but rabbits would be increasing twice as fast now did you notice the eigenvector though if I rewind you'll find anything on this line or the x axis is not rotated this means any inputs on those lines will also have velocity values on those lines and remember from before when that was the case and that motion would be along that line this means if we have nine rabbits and zero foxes or let's say three rabbits and six foxes as long as we're on those eigenvectors and let the simulation run the population values will stay on those lines forever see the bottom eigenvector is obvious if you start with only rabbits then after some time you'll have more rabbits no surprise but the top one is kind of like a sweet spot where you start with twice as many fall as rabbits and over time that ratio never changes there's just enough foxes where the rabbits don't take over in population but not enough where the rabbits die out completely everything stays in proportion both of these have positive eigenvalues which is why the points move away from the origin and not towards it but just these eigenvectors are enough for us to approximate the evolution of the system for any initial conditions because the flow from any other initial populations kind of follows the eigenvectors which is why the phase plane look the way that it did plus the top eigenvector divided this into interesting regions any populations located above it will result in no rabbits eventually all these arrows lead to the y axis this is where the foxes quote win they kill off the rabbits faster than the rabbits can reproduce but below that eigenvector and above the other is where the rabbit sort of win really it means over time they out populate the Foxes more and more they're still being eaten but they are reproducing much faster and the eigenvector is again the sweet spot where everything stays in proportion this is why before we saw some paths fly off to the right and others turn towards the left it was all dependent on which side of the eigenvector we started on and to add some dynamics here you'll see if I increase this number and make it so the rabbits reproduce faster then the eigenvector moves up increasing the rabbits wind section as expected if I make the foxes reproduce faster then it goes back down increasing that foxes wind region the most well-known use of this though is with masses on a spring because instead of plotting animal populations will plot position versus velocity if I pull the mass to the left but give it no initial velocity that corresponds to this point on the graph if I let go assuming no damping it will oscillate back and forth forever on the face plane this corresponds to circling the origin between axis placement no velocity to max velocity no displacement and so on forever now the equation that represents this is MA or MV prime equals negative KX minus BV where K is the spring constant and B is the damping coefficient currently the mass and spring constant are 1 while B is 0 so this is the actual equation and as you guys probably know the derivative of position is velocity now why am I writing things like this because look we have two derivatives some coefficients and those same variables without the prime just like before it's the same type of problem which comes down to finding eigen things however in this case the eigen values are imaginary thus so are the eigen vectors now do you guys remember before when I said that imaginary eigen values correspond to rotation well here it is again in a much more visual way for these systems of differential equations purely imaginary eigen values mean only rotation no decay to equilibrium or diverging away from it now if I increase the spring constant and make the spring stronger we still expect no decay but there should be some higher velocities so what what happens as I increment it now we get more of an oval shape showing that the max velocity has increased but the max position does not since it starts from the same point the eigen value is still imaginary though meaning only rotation and no decay if we have some light damping like put the block in some fluid we expect the block to oscillate but decayed equilibrium in the process so first watch what happens to the phase plane as I change that damping coefficient you'll see it now spirals into the origin aka the equilibrium where there's no velocity or displacement which matches what we expect with the decay that comes from the damping from the eigenvalue perspective we gain even more intuition because on top of imaginary components corresponding to rotation we can now see that negative real components correspond to decay as in the system is stable and will go to equilibrium eventually here I'll increase the damping coefficient even more where we see faster decay on the phase plane and as expected a more negative real component of our eigenvalue and if it were possible to have a positive damping coefficient here which I'll change it to then that gives us a positive real component which corresponds to growth or instability and this really means that the phase plane will spiral away from equilibrium now so far we've seen how eigenvalues and eigenvectors can give us a real visual sense for what can happen to a system or a sequence after a long time or many iterations this isn't always the case but in many situations heigen vectors and eigen values reveal that long term behavior that's one reason why they're so useful in the applications of matrices video I showed an example of this with a zombie apocalypse scenario where in a quarantine area every hour some percentage of humans turn into zombies but there is a cure that converts a percentage of zombies back to humans since the new population of humans and zombies after each hour can be calculated with linear equations we can change it into a matrix problem to see what happens in the long run if I use desmos instead we can see with several starting points representing initial populations of humans and zombies the eigenvector reveals the equilibrium of the system and since the eigenvalue is 1 once the populations are on that then they won't change but everything else will move towards it with each hour so after many iterations the system will converge to a point where there are twice as many zombies as humans and again it's the eigenvector that reveals that long term behavior or let's say we had several nodes in one way path connecting them if you were to just randomly walk this network all day and want to know how much time you'd spend at each node on average it becomes a matrix problem because since everything is random we can write out the probabilities like if you're at a there's a 100 percent chance of going to be but once you're there you have a 50% chance of going to C or D and you just do this for every edge if we put those probabilities into a matrix where you can see like the chance of going from A to B is a hundred percent but B to C is 50% it turns out that eigen vector of that matrix reveals the percentage of time you'll spend at each node if we instead think of those nodes as web sites and the edges as links between them then you get the basic idea of how Google ranks web pages yes in the beginning the basic idea of Google Pagerank was determining which site you'd spend more time on if you randomly clicked links all day and that ranking matrix is really just an eigenvector but it's not always about long term behavior for example also from that previous video I didn't mention something about the dating app Network example this was when three men labeled one through three and three women four through six were matched on a dating site as shown but there were no same sex matches which makes us a bipartite graph bipartite just means the network can be separated into two different sets such that each one of these has no internal connections now when we made the adjacency matrix for this we're if like person 1 and 4 connected then we see a 1 in column 1 and row 4 as well as Row one in column 4 and if two people were not connected there B is 0 giving us this what I didn't say is that these were the eigenvalues it turns out if a graph is bipartite then the eigenvalues of this matrix will come in plus and minus pairs if we allow the same-sex match then this is no longer bipartite and the eigenvalues don't come in those pairs so if I gave you a network like this it's not obvious whether it's bipartite just by looking at it but if I label the nodes and make an adjacency matrix based on those connections I find the eigenvalues all come in plus and minus pairs which tells us yes the graph is bipartite and if we rearrange that becomes more obvious looking at how clustered a graph is also involves eigenvalue analysis by the way and this can reveal hidden patterns among very chaotic graphs you can look up spectral clustering to learn more about this though then eigenvalues show up in frequency analysis as you're used to find the natural frequency of a system of course they appear in circuits do the similarities between those and masses on the spring eigenvalues can help us understand how quickly a disease will spread throughout a population they're used in data compression and facial recognition tons of physics applications and of course way more than I can put in one video but hopefully this gave you an idea of the power and intuition behind these things that I think for most people are very dry when we learn them in school and if you've made it this far and want to expand your knowledge further into a variety of topics I recommend checking out curiosity stream the sponsor of today's video curiosity stream hosts thousands of documentaries and nonfiction titles put on by industry leaders that you will very likely enjoy if you're a fan of this channel they have documentaries like the Hawking paradox if you want to learn more about one of the greatest mistakes made by Stephen Hawking in his search for a deeper understanding behind the physics of black holes or for those who like the real-world applications of mathematics I recommend the secret life of chaos which will take you through several examples of how chaos shows up in reality and even math itself curiosity stream is available in a variety of streaming services including Roku Android Xbox one Amazon fire Apple TV and more and it only comes out to $2.99 per month plus if you go to curiosity stream comm slash major prep or click the link below you'll get your first month membership completely free so no rest in just giving it a try but with that I'm gonna end that video there of course big thanking my supporters on patreon social media links follow me or down below and I will see you guys next time
Info
Channel: Zach Star
Views: 548,014
Rating: 4.9769516 out of 5
Keywords:
Id: i8FukKfMKCI
Channel Id: undefined
Length: 23min 44sec (1424 seconds)
Published: Fri Dec 13 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.