Differential equations have a lot of use in modeling physical problems particularly engineering problems. This first example I want to talk about is not an engineering problem. I guess you would call it a financial mathematics problem. But it actually occurs in many other physical problems not just this problem of compound interest. So, it's useful for engineers, but even compound interests itself is useful for everybody. So, what is compound interest? If you view that you have some deposit say in a bank account or in an investment fund. Let's just talk about a bank account for simplicity. The bank can give you interest on your deposit. When you earn interest on the interest we call that compounding and that would be compound interest. You can get a differential equation from compound interest in the limit that the compounding occurs continuously and I'll show you how that works out. It's interesting example to do because we can then show, I can also show you how to derive a differential equation. So let's assume that we have some amount of money in a bank account S of T at time T. S at time T, we'll call that S of T. We want to calculate how much money we have at some arbitrary time. At time T we start with the amount of money S of T, and we ask how much money do we have in the bank account at a time T plus Delta T. Okay. So, initially you can view say T is now and how much money do we have one month from now. So, Delta T can be one month or if T is in units of years, Delta T would be one-twelfth of a year. So, how much money do we have in the account at time T plus Delta T? Well, it's the amount of money we have in the account at time T plus the interest we've earned in the account. So, the interest we earned on the account depends on the interest rate R. So, plus R, but we've only earned interest over a time Delta T. So say R could be something like six percent per year for an investment. So, R would be, say 0.06 per year. If Delta T was one month, then Delta T would be one-twelfth of a year. So, you don't earn six percent over one month. You earn R times Delta T over the shorter period of time. You're earning this as a percentage of the amount of money you have in the account, so times S of T. So, that's the interest you've earned over the time period Delta T. To this we'll add one more term. Maybe you're depositing money into the account, say you're working and every month you're putting a fraction of your paycheck into the account. So, let's say you're putting K dollars per year into the account. So, to this we have K dollars per year, but Delta T is not a year. You're only putting money in over the period Delta T. Delta T is one month, there would be one-twelfth of a year. So, you add amount of money, K Delta T. That's your deposits. So, the amount of money you have in the account at time T plus Delta T is the amount of money you have in the account at time T plus the interest you earned on that amount of money over the time Delta T, plus the amount of money you add it to the account over the time Delta T. We can take this equation and we can try to get a derivative out of it. We can write S of T plus Delta T minus S of T, and then divide through by Delta T. If we do that, then on the right-hand side we have left an R times an S plus the K. So, RS of T plus K. Okay, to get the differential equation we need continuous compounding. So, rather than compounding, getting interest once a month, we view once a day or once an hour, once a minute once a second. We can take the limit as Delta T goes to zero, and then we get a derivative. So, we get the differential equation, the STT equals RS plus K. To solve a first-order differential equation, we need to know how much money we had in the account initially at T equals zero. So, S of zero we specify as S naught. Okay, compound interest equation. This we recognize as a linear first order equation. So, we can put it in standard form. Let me do that here. So, we have the STT minus RS equals K. That's the standard form for a linear first-order equation. We can solve that using the method we know. We need an integrating factor. So, the integrating factor is E to the integral of P of TDT, P of T is minus R here. So, E to the integral from zero to T of P of TDT. So, minus RDT. So, that's just E to the minus RT. So that's our integrating factor. Then we can write down the solution for S. So, we have S of T is equal to one divided by the integrating factor which is E to the RT times the initial value S naught, plus the integral from zero to T of Mu of T, the integrating factor times the right hand side G of T which is KDT. So, E to the minus RT KDT. Okay. That's our expression for the amount of money at time T. So, we have to do this integral, this is a rather simple integral to do. We're integrating K is a constant, so we're integrating E to the minus RT DT. That becomes minus one over RE to the minus RT. Then we can evaluate it at the upper limit minus the lower limit. If we do that and we multiply through by E to the RT, we'll obtain the expression S naught, E to the RT plus K over RE to the RT, times one minus E to the minus RT. That's the solution to our compound interest problem. Okay, let's try and interpret this solution. So, S naught is the initial money in the account, and we see that compounding causes the initial money to grow exponentially. That's always a good thing when your money grows exponentially, right? So, this is the initial growth. This is the growth of your initial deposit. Then you put in K dollars per year say into this account, and that money you put in will also grow exponentially. If this is a retirement account and we're looking something like 40 years into the future, 30 years into the future, this E to the minus RT might be small relative to one. Then you get this amount, this deposits growing exponentially. If you look at this expression and may worry you a little bit because if R goes to zero meaning that the bank is not giving you any interest, then you have a division by zero here. But if you look at one minus E to the minus RT, that would be one minus one as R goes to zero. So, this expression is actually zero divided by zero. So, I think it's worthwhile to make sure we get the right answer here. So, if we wanted to look at say, the limit as the interest rate goes to zero of S of T, what would we get? The first term would be S naught. What would this term get? You can use L'Hopital's Rule. If you use L'Hopital's rule, you will take the derivative with respect to R, right? The derivative with respect to R of this expression. Actually, all we need then is the limit of one minus E to the minus RT divided by R. We can carry the KE to the RT term because this is the zero divided by zero. If we use L'Hopital's rule and take the derivative with respect to R, this one would become T times E to the RT divided by one. So, if you can do that then and put R goes to zero. What you'll see is you get S naught plus K times T. That's what you would expect because of the bank is not giving you any interest, the amount of money you have in your account is your initial deposit plus how much money you put into the account at time T. So, if you're putting say, $20,000 per year into the account, after 10 years you would have put $200,000 into the account. So, this is the expression for any interest rate. I just checked to make sure you get the right answer if the interest rate goes to zero. Okay, a very useful expression you can use it to evaluate retirement savings. I ask you to do that as an exercise after this video. So, let me review what we've done here. We've looked at the application of compound interest. I wanted to show you how to derive a differential equation. To derive a differential equation for the amount of money you have in the account, you consider how much money you have in the account at T plus Delta T. A time Delta T from the time T. That is in terms of the amount of money and you have in the account at time T plus what happens over the time Delta T. Over the time Delta T, the bank gives you interest and you make a deposit. Then you can form this difference equation which is a derivative, use the definition of a derivative. Take the limit at Delta T goes to zero. A very common technique to derive a differential equation and we end up with here, in this case we end up with a first-order linear differential equation which we can solve by our known method. I'm Jeff Chasnov, thanks for watching, and I'll see you in the next video.