Physics Students Need to Know These 5 Methods for Differential Equations

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'm going to teach you five methods for solving differential equations that are extremely useful for physics starting from the simplest and working up to the most advanced but also the most powerful the fact is just about any time you want to solve a problem in physics you're going to wind up facing a differential equation in Newtonian mechanics that means adding up all the forces on an object plugging that into f equals ma or better yet M times the second derivative of the position and then solving this differential equation for the position as a function of time that's not too hard for the simplest systems we all meet in our first physics classes but as you study more and more physics you'll very quickly discover that the f equals ma equation can become extremely difficult to solve even for setups that look like they should be fairly straightforward at first glance so it's hugely important to have a toolkit of strategies for tackling the many differential equations you're going to meet throughout your physics studies and that's why you need to learn the five solution methods I'm going to tell you about in this video we'll see how they all work using one of the simplest but also arguably the most important differential equation in classical mechanics the equation of a simple harmonic oscillator or in other words the f equals ma equation for a block attached to a spring there's a good chance you've run into this equation before and maybe you've already seen a couple of different ways of solving it but what's hopefully going to be fun and different about this video is that the five solution methods I'm going to show you will start from the most straightforward and work our way up through increasingly Advanced approaches so we'll start off seeing some relatively basic strategies for solving equations like this which will already take you a long way with lots of problems you'll meet in classical mechanics and Beyond like solving by making a substitution or using energy conservation but as we go along I'm going to introduce you to some more and more sophisticated techniques like using a series expansion to solve the equation using an integral transform like the Laplace transform and finally using Hamilton's equations which also give us a new way of visualizing the solution as what's called a flow on face space and that's incredibly powerful so make sure you stick around to the end to see that okay let's get going first of all let me quickly remind you where this differential equation comes from our setup is a block of mass m sitting on a frictionless table and hooked up to a spring of stiffness K in equilibrium the spring isn't stretched or compressed and the block can sit happily at rest there let's call that position x equals zero but if we Slide the block away from there the spring will now exert a force minus KX trying to pull the block back toward equilibrium then the f equals ma equation is simply M times the second derivative of x that's the acceleration equals the force minus KX now let's say we pull the block out to an initial position x sub zero and then release it from rest the stretch spring holds the block back toward equilibrium to the left but then the block overshoots x equals zero and moves to the left of equilibrium the spring gets compressed and pushes the block back toward the right and on and on it goes making the block oscillate back and forth around equilibrium forever this is what we call simple harmonic motion I made a separate video All About It explaining why it's arguably the most important system in physics and why it shows up absolutely everywhere but now let's see how to solve for the motion from this equation we're looking for X of T the position of the block as a function of time and f equals m a is a differential equation because it involves the derivatives of this function it says that the second derivative of x with respect to T equals minus K Over M times x again and in the rest of this video we're going to explore five increasingly Advanced methods for solving this equation starting off with number one it might sound a little silly but honestly the first thing you can do especially with a relatively simple looking equation like this one is to try to guess the solution except that guessing doesn't sound very sophisticated so instead you'll often see textbooks call it making an ansats which is German and sounds much fancier all that means in is we're going to ask ourselves if we can think of a function which when we take its derivative two times we get back the same function we started with times some negative number so what kind of function satisfies a property like that using our physical intuition like we talked about before that the block is going to oscillate back and forth around equilibrium functions like sine and cosine might come to mind so let's make our onsets and write down a guess of the form a cosine Omega T where a and Omega are some constants that we don't know yet the idea is to see if we can choose them to solve the equation we have to have some constants there just to get the units right X is supposed to be a length remember in meters say that means a had better have units of meters too and inside the parentheses Omega T had better be measured in radians which are dimensionless so Omega had better be something in radians per second in order to cancel out the seconds units from the T okay well let's substitute this guess into the equation and see if it actually works the derivative of cosine is minus sine and by the chain rule we also need to multiply by the derivative of the thing in parentheses with respect to T which gives us a factor of Omega now to do it again for the second derivative this time the derivative of sine is cosine and again we get an extra factor of Omega from the chain rule all right that's what our guess gives us for the second derivative but does it solve our differential equation it looks promising because it says that the second derivative of x is indeed equal to X again times a constant minus Omega squared and all we need to do is pick this number Omega squared to be the same as the ratio K Over M that appeared in the differential equation and that'll do it if we choose this value for Omega then X of T equals a cosine Omega T will indeed satisfy the equation so are we done well no first of all sine of Omega T satisfies this property just as well as cosine Omega T and so more generally we can add them together to write a general solution of this form that works because the differential equation is linear meaning that we only have single powers of X and its derivatives showing up but what are we supposed to do with these two constants A and B this expression solves the equation for any values of these numbers that brings us to a really important point about solving differential equations the equation itself is only half the story we also have to specify the initial conditions we want to satisfy in order to get the solution to the problem physically that makes total sense when you throw a ball up into the air we need to know the initial position you're throwing it from and the initial velocity in order to be able to say what trajectory it's going to follow likewise we need to know the initial position and initial velocity of the Block in order to say what its Position will be after that in this case we release the block from rest at x sub zero and that means our two initial conditions are these mathematically the fact that we need two initial conditions comes from the fact that the differential equation is second order meaning that the highest derivative that shows up is the second derivative of x so when we plug in t equals zero the sign disappears and cosine of 0 is equal to one so we'd better set a equal to X Sub 0 in order to solve our specific problem likewise if you take the derivative and demand at the initial velocity vanishes you'll see that we need to set b equal to zero and that leaves us with X of T equals x Sub 0 cosine Omega T where again Omega equals the square root of K Over m is fixed by the stiffness of the spring and the mass of the block this looks about like we'd expect the block starts out at rest at the initial displacement x sub zero and then when we let it go it oscillates back and forth around equilibrium where Omega controls how fast it oscillates so there we have it we've solved the differential equation together with the initial conditions by substituting in a guess or onsots with some constants in it and seeing how to pick the constants in order to get a solution and this kind of strategy Works in general for a linear equation like this where a B and C are some consonants in general you'd pick an exponential for your guess a e to the Omega T substituted in and see what conditions come out on those constants explaining that whole method in detail though would really deserve its own video for now we're going to stick with the simple harmonic oscillator equation and see four other really powerful ways of approaching it and that brings us to Method number two using energy conservation to solve the equation as you've hopefully learned before if we take the kinetic energy of the block one half M times the velocity squared and add to it the potential energy in the spring one-half k x squared will get a constant the total energy that's not obvious because both X and DX by DT are changing with time as the block slides back and forth but when we add them together in this special combination the t's drop out and we get a constant the way to check that that's true is to take the derivative of e with respect to T and see that it's equal to zero I'll show you how to prove that in the notes which you can get at the link in the description and where I'll go through everything we're covering in this video in more detail if you really want to learn all these Concepts you should watch first to get the general idea of how things work and and then go through the notes to take your time processing the material in this case the potential energy is a parabola so when we release the block somewhere over here at x sub zero all of the energy is the potential energy stored in the spring there's no kinetic energy because we're releasing the block from rest then when we let it go the block starts to speed up and the spring starts to relax by the time it reaches x equals zero all the energy is kinetic and on and on the energy Cycles back and forth between kinetic and potential but the total energy never changes it's always the same number we started with one half k x sub zero squared and what we'll see now is that we can use this equation for energy conservation to solve for the trajectory of the Block it's again a differential equation for x but notice that it only involves the first derivative of x not the second derivative that we had in f equals Ma let's rearrange the equation a bit we can cross out the halves and I'll also move the KX squared over to the left hand side and then divide by m I'll also use the same symbol Omega squared as before for the ratio K Over M remember Omega was what told us how fast the block would oscillate back and forth and finally we can take the square root to get an equation for DX by DT now something really special has happened this equation tells us the velocity of the block as a function of its position X the point is if we know the position of the block we know how stretched or compressed the spring is and therefore how much potential energy is stored in it then conservation of the total energy tells us how much is left over for the kinetic energy of the block and therefore how fast it's moving so when the block starts off at X Sub 0 we get V equals zero because we released it from rest but by the time the spring pulls the block back to equilibrium at x equals zero it's sped up to its maximum velocity and we get DX by DT equals Omega times x0. actually we should really get minus that because the block is initially moving to the left so we ought to be a little more careful when we take the square root since we can get either sine we take the minus sign when the block is moving to the left and the plus sign when it turns around and goes back to the right and now we can solve for x of T by integrating one more time just divide the square root over to the left hand side and multiply the DT over to the right in order to separate the variables next we integrate both sides of this equation the integral on the right is super easy we just get T maybe plus some integration constant C the integral over X is a little harder you can do it with a trig substitution or of course you can just look it up it's given by minus the inverse cosine of x over x0 we could also add another integration constant here but we can just absorb that into the other constant C on the right now we solve for x flip the sign take the cosine of both sides and move the x0 over to the right now we're almost there cosine doesn't care if you plug in plus or minus something it's an even function so we can throw out the plus or minus and as for the C remember that when we plug in t equals 0 we want to get x sub 0. so we can just set c equal to zero then at last we get X of T equals x Sub 0 cosine Omega T just like we found with method number one so conservation of energy also lets us easily get to the solution of our differential equation and in fact this strategy can often be successful for harder problems even when our first method wouldn't work a great example is the simple pendulum which is supposed to be so simple that it's in the name but actually it's surprisingly tricky I'll let you play with that one for yourself for practice with this method and I'll share some more details about it in the notes so now we've seen two different ways of solving the harmonic oscillator equation and these will more or less do the job for most of the equations you'll meet in your first mechanics class but if you're up for it what I'd like to do now is show you some more powerful methods that will come in handy later on when you're faced with harder equations so let's plow ahead to Method number three using a series expansion this one is probably the most versatile of all the strategies we'll see here and you can apply it to most any differential equation to get an exact or even just an approximate solution the idea is whatever the solution X of T to our differential equation might be we can almost always expand it as a Taylor series in powers of T at least within a window where things are well behaved the question is how do we figure out what these coefficients are supposed to be well first of all let's go ahead and impose our initial conditions when we plug in t equals 0 to the series expansion all the t's disappear and we're left with X of 0 equals a sub zero so we want to set that equal to x0 to coincide with the initial position of the block and to impose that the initial velocity is zero we'll take the derivative of the series a one plus two a two times t plus three a three t squared and so on now when we plug in t equals zero we're left with a sub 1. and so we want to set that equal to zero all right so far we figured out a Sub 0 and a sub 1 but there are still infinitely many coefficients left to determine so the next thing we need to do is actually plug the expansion into the differential equation that means we need to take the derivative of the series one more time to get the acceleration we'll have 2 times A2 plus 3 times 2 a 3T plus four times three a four t squared and so on and now we add on Omega squared times x and set the whole thing equal to zero and it's helpful to pair up the corresponding terms all of this needs to vanish if we want our series to solve the differential equation and the only way that can happen for every time T is if all the coefficients are separately equal to zero so the idea is to go term by term through the series and demand that each factor in parentheses is zero let's start with the odd terms the coefficient of the T term is 3 times 2 a sub 3. so for that to vanish we need to choose A3 equal to zero notice there's also an A3 in the T Cube term so I'll go ahead and erase that as well but now when we look at that t cubed term its coefficient is just 5 times 4 a sub 5. and so for that to vanish we'll also have to set a 5 equal to zero the same thing is going to happen for all the odd terms so we conclude that all the odd coefficients are equal to zero that's already pretty nice because it means we get to throw out half the terms in our expansion so now let's move on to the even terms the zeroth one says that 2 a 2 plus Omega squared x0 is equal to zero and so we can solve that for a sub 2. next for the t-squared term we've got 4 times 3 a 4 plus Omega squared A2 and we set that equal to zero again we can solve to get a sub 4. don't worry too much about that algebra the point is you can already see the pattern that's forming here here are the first few terms we're getting for our series solution does that look familiar at all let's simplify it a bit by pulling out the common factor of x0 and we can also put the omegas in the t's together like this so how about now does this thing look like the Taylor series for any function that you know that's right the sum in parentheses is just the Taylor series for the cosine and so reassuringly we've once again found that X of T equals x0 cosine Omega t like I mentioned series expansions like this are an extremely versatile method for solving all kinds of differential equations they don't always add up to a simple looking function like this but that doesn't make them any less useful or valid as a solution to the equation as long as you're looking at a point where the series converges okay we're on a roll here let's keep it going with our next method using an integral transform to solve a differential equation we're definitely getting a little more advanced here but this is really cool so stick with me there are lots of kinds of integral transforms out there including the Fourier transform which my last video was actually all about but the one that's most useful for solving the problem we're looking at today is called the Laplace transform and here's what it is the Laplace transform is an instruction to take our position function X of T multiply it by e to the minus St with some new variable called s and then integrate that over T from 0 all the way to T equals infinity and we'll call that X hat of s okay well that sounds like a funny thing to do especially if you've never seen it before but we'll see in a second that this transformation has a magical property when it comes to differential equations the way you should think about it though is that we have two spaces here t-space where our original function X of T lives and s space where it's Laplace transform lives X hat of s to give a couple of examples if x of T were a constant like say x of T equals one then it's just a horizontal line in t space and you can show pretty easily that it's Laplace transform in s space obtained by doing this integral is one over s or for our block on a spring we found and we're about to find again that X of T equals x0 cosine Omega T it oscillates in t space and in s space it's Laplace transform is a rational function x0 times s divided by S squared plus Omega squared all right so we can do this integral to go from t space to s space big whoop why the heck would we want to do such a thing how does it help us solve a differential equation like a harmonic oscillator the reason is that the Laplace transform acts in a beautifully simple way on derivatives when we take the transform of the derivative DX by DT it turns into s times x hat of s minus the initial position in other words taking a derivative in t space is the same as simply multiplying by s in s space up to a shift by x0 and that follows just by using integration by parts in the Laplace transform integral I'll show you how that works in the notes but the point is because of this beautiful property the Laplace transform can turn a differential equation for x of T into an algebraic equation for x hat of s let's see how that works for our harmonic oscillator equation we'll take the Laplace transform of both sides on the right we just get that constant minus Omega squared times the Laplace transform of X on the left we need to use our derivative rule twice in a row if you work that out you'll get S squared times x hat minus s times the initial position minus the initial velocity and if we plug in our initial conditions we find that when we transform our differential equation to s space it becomes s squared times x hat minus s x 0 equals minus Omega squared x hat like I promised there are no more derivatives the Laplace transform took our differential equation for x of T and turned it into an algebraic equation for x hat of s and this equation is much easier to solve just move the X hats over to the left and then divide out that factor out front to get X hat of s equals s x 0 divided by S squared plus Omega squared and that's the solution to our problem in s space anyway to finish the job we just need to transform back to t space there's a general formula for doing that but in practice it's often faster to just pull up a table of Laplace transforms there's a nice one on Wikipedia and find the one you're looking for in fact I already mentioned that this function is the Laplace transform of x0 cosine Omega T and therefore that's the solution to our original equation once again so that's method number four starting from a linear differential equation take the Laplace transform to try to turn it into an algebraic equation which you can solve for x hat and finally transform back to get your solution for x all right we're in the home stretch now and I saved maybe the most fascinating of all of these for last Hamilton's equations and flows on face space let me show you how it works we started out with the f equals m a equation for a block on Spring now notice that the left hand side is the same as the derivative of M times DX by DT since m is a constant in other words it's the derivative of the momentum p that's just Newton's Second Law the force minus KX equals the rate of change of the momentum but mathematically what that enables us to do is replace the single second order differential equation that we started with with a pair of first order equations these are called Hamilton's equations I haven't done anything fancy this pair of equations contains the exact same content as f equals m a all I've done is split it up into two pieces but working with the first order equations has a couple of big advantages to see why it's helpful let's draw a picture with X on the horizontal axis and P on the vertical axis this diagram is called the phase space and each point in this plane tells us where the block is and what its momentum is or equivalently its velocity at any given moment so for example when we pull the block out to its initial position and then release it from rest that initial State corresponds to this point here on the horizontal axis where x equals x Sub 0 and P is equal to zero after we let it go the block is going to begin to move and so these X and P coordinates are going to change with time so the point in this plane moves around with time and it traces out a curve called a float and flow really is a good name for it because I want you to Picture This Plane like the surface of a pool of water with some current flowing around it then we take something like a ping pong ball say and set it down at the point for our initial conditions once we let it go the current will carry the ball off moving it around the surface of the water the flow is the path that the ball follows through the water but what determines the shape and strength of the current that's telling the ball where to move our differential equations of course it's helpful to write the pair of them as a single vector equation again X and P are the coordinates of the ping pong ball on the surface of the water and so their time derivative is telling us the ball's velocity Vector at each point on the surface over here at our initial point x was positive and P was Zero then the horizontal component of the Velocity Vector is zero and the vertical component is negative so the velocity of the imaginary ping pong ball points straight down at that point likewise we can go to each point in this plane and draw this velocity Vector those arrows are what tell us the current that's swirling around the plane and what dictates how the ping pong ball will move you can see that they're sort of swirling around the origin here that's the equilibrium point and I'm using the colors here to indicate how strong the current is its smallest for the yellow arrows near the middle and gets bigger for the Red Arrows farther out by following those vectors starting from our initial conditions we see that the flow is an ellipse that wraps around the origin again and again as the block oscillates back and forth around equilibrium this is definitely a more abstract way of thinking about the solution to our differential equation remember the physical system here is the block sliding back and forth on this one-dimensional line so obviously there isn't actually any pool of water or ping pong ball those are just useful mathematical constructs for picturing what's going on but what this picture buys us is that we can very quickly understand what the motion of our system is going to look like without solving any differential equations all we need to do is draw the arrows at each point in face space that we get from the right hand side of Hamilton's equations either by hand or better yet on a computer that's already an extremely useful way of thinking about differential equations but Hamilton's formulation also gives us a really direct way of explicitly writing down the solution at least for a linear equation like the harmonic oscillator and that's the last thing I want to to quickly sketch out for you to see how it works let's Express Hamilton's equations as a matrix equation this might look like we've made things more complicated but hang on a second we'll see how it pays off think about a simple differential equation like d by DT of Z equals Alpha times Z for some constant Alpha this equation says that when we take the derivative of a function Z of T we're supposed to get back Z again times a number Alpha and the solution is simple it's just e to the alpha T times Z of zero that's because the derivative of the exponential just turns back into itself times a factor of Alpha from the chain Rule and when you plug in t equals 0 you get that initial value Z of zero but notice that our Matrix equation for the block on a spring is essentially of the same form only with vectors and matrices now instead of single numbers it says that the derivative of the vector XP is equal to itself multiplied by a constant Matrix m and the solution is just the Matrix analog of our simple equation for Z we take the initial Vector X of 0 P of 0 and act on it with the Matrix we get by exponentiating T times m that looks reasonable but of course we have to ask ourselves what it even means to take the exponential of a matrix here and it's defined by the usual Taylor series for E we get one plus the thing in the exponent plus half the thing squared plus one over three factorial the thing cubed and so on that might look like a nasty thing to try to compute and it certainly can be in general but for our Matrix m in this problem the answer works out in a beautiful and simple way again I'll show you how to get it step by step in the notes but here's the result we get cosine of Omega T in the top left and bottom right and sine of Omega T in the top right and bottom left times some constants and finally when we plug in our initial conditions here's what we get lo and behold the first line tells us that X of T is equal to x0 cosine Omega T yet again and the second line is the corresponding momentum M times the derivative of x so I hope I've convinced you of how powerful Hamilton's method is of converting a second order equation into a pair of first order equations both for explicitly solving the equation with the Matrix exponential but also for visualizing the behavior of the solution as a flow on face space all right I hope that was fun we got to see how to solve the simple harmonic oscillator equation with five different increasingly sophisticated techniques again nobody's saying you actually should use Laplace transforms or Matrix exponentials to solve such a simple differential equation but as you work your way up in physics you're quickly going to start running into more challenging differential equations where the methods you've gotten a glimpse of here become invaluable remember that you can get the notes for this video for free at the link in the description and I'll also put the links to all those other videos that I've mentioned down there I want to say a huge thank you to my supporters on patreon if you want to see more videos like this you can join too at the link up in the corner also this was the first video I've made in large part using manim the programming library for math animations created by three blue one brown and further developed by the brilliant people who work on the open source project I want to say another huge thank you to them for sharing all their hard work thank you so much for watching and I'll see you soon with another physics lesson
Info
Channel: Physics with Elliot
Views: 974,740
Rating: undefined out of 5
Keywords: physics, science, lesson, physics help, differential equation, simple harmonic oscillator, simple harmonic motion, math, calculus, derivative, energy conservation, ansatz, initial conditions, series expansion, Taylor series, recursion relation, integral transform, Laplace transform, hamiltonian mechanics, hamiltonian flow, Hamilton's equations, matrix exponential, flow on phase space, phase space
Id: 0kY3Wpvutfs
Channel Id: undefined
Length: 30min 36sec (1836 seconds)
Published: Fri Jan 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.