Here's first and basic method of solving Differential Equations, Euler Method.

### Euler Method-

Euler method (also called forward Euler method) is a first-order numerical procedure for solving ordinary differential equations with a given initial value. It is the most basic explicit method for numerical integration of ordinary differential equations and is the simplest Runge–Kutta method.

Sometimes there is no analytical solution to a first-order differential equation and a numerical solution must be sought. The first-order differential equation

This solution

Sometimes there is no analytical solution to a first-order differential equation and a numerical solution must be sought. The first-order differential equation

*dy/dx = f(x, y)*with initial condition*y(x0) = y0*provides the slope*f(x0, y0)*of the tangent line to the solution curve*y = y(x)*at the point*(x0, y0)*. With a small step size*∆x = x1 − x0*, the initial condition*(x0, y0)*can be marched forward to*(x1, y1)*along the tangent line using Euler’s method (see figure):*y1 = y0 + ∆x f(x0, y0).*

This solution

*(x1, y1)*then becomes the new initial condition and is marched forward to*(x2, y2)*along a newly determined tangent line with slope given by*f(x1, y1)*. For small enough*∆x*, the numerical solution converges to the unique solution, when such a solution exists. There are better numerical methods than the Euler method, but the basic principle of marching the solution forward remains the same
Watch this video by Jeff Chasnov Sir and enjoy the concept:

#### Subtitles:

I'd like to start a differential equations course by talking about a very simple numerical method that can be used to solve differential equations. I feel like a student understanding how to solve a differential equation numerically gives them some intuition as to what it means to solve a differential equation. So, we're going to start with the Euler Method. We'll talk about solving a general first-order equation. So, we have dy, dx is some general function of x and y. For most types of equations of this sort, there's no such thing as an analytical solution. So, one has to solve it numerically. In this course, we'll be talking about numerical, certain equations that have analytical solutions. But here we solve the general equation, and we need an initial condition to solve this equation. So, we have y at some initial value of x, which I'll call x-naught, equal to y-naught. So, how does one solve this equation numerically using computer, that will tell us actually the meaning of this differential equation? So, a solution for y, which is the function of x, typically means graph y versus x. So, we're looking for a graph. So, let me draw the graph here. So, our x-axis and our y-axis, and we want to find y as a function of x. What do we know? So, the information we're given here is that we start with the initial value. So, we know that y of x-naught equals y-naught. So, we know one point on this graph. So, let's say that it's here. So, this is the value of x-naught, and this is the value of y-naught. So, that's the initial condition. Then what else do we know? Well, we know the differential equation. So, what does the differential equation give us? It gives us the value of dy, dx, the derivative of y at this point. So, dy, dx is the slope of the tangent line to the curve y versus x. So, it tells us how the slope of the solution at that point. So, let me draw the slope. So, here is the slope. Let's say dy, dx is positive. So, it's increasing. So, let me draw it like this. So, this is our slope of the solution curve dy, dx. So, that's the slope of that line, which is going to be f of x-naught, y-naught. That's what the differential equation gives us. So, we have the slope. Then a numerical solution says, "Okay. So, let's approximate the solution y of x as a line segment that follows this slope." So, we follow this slope out to say here to the point x_1. That will be the new y-value, y_1. This line segment here will be the approximation to our function between x-naught and x_1. That's what the numerical method does. Then what do we do next? Well, with them, we're at the point x_1, y_1, and we just repeat the process. That becomes our new initial condition. So, the differential equation then tells us the slope of the solution at this point. Let's say dy, dx is slowly decreasing. So, the slope may look like that. So, here the slope will be f of x_1, y_1. We march the solution along this line. So, we get to x_2 here, and then we'll be here. This will be the value then of y_2. This line segment here becomes the approximation to the solution between x_1 and x_2. So, what are the formulas? So, the first step will give us y_1. So, we have y_1. We're starting at y-naught. To that, we're adding along the line. So, we have y plus Delta x times Delta y divided by Delta x. Y plus Delta x times Delta y divided by Delta x. So, to here, we add Delta x. So, Delta x, just let me write it as Delta x. Then Delta y over Delta x is the slope here, and that's just our f of x-naught, y-naught. That's to get to y_1. Here Delta x is just x_1 minus x-naught. Then to get to y_2, it's similar. So, y_2 equals y_1 plus Delta x times f of x_1, y_1. Here our Delta x is x_2 minus x_1. So, typically, in a simple numerical method, you would fix Delta x, so Delta x would always have the same value and so on. So, you can keep marching the solution. So, if Delta x is small enough, you'll have these line segments that are all glued together. If you look at the graph, it will just look like a curve. You won't be able to see the line segment, and that will be the solution. So, intuitively, what can you say about this differential equation? Given an initial value, then you can march the solution forward using the differential equation, and you'll have a unique solution. You'll have a solution that's called the existence, and the solution will be unique. There will only be one solution as you march forward. So, that's the existence and uniqueness of the solution of a differential equation. But, occasionally, something can go wrong. So, this f may not be a well-behaved function. It could go to infinity. That could stop a solution. It could become imaginary. That could stop a solution. So, not all differential equations have a solution. But if f is nice enough, as most differential equations for engineers are nice enough, then there'll be a solution to the differential equation at least numerically. So, let me review. This is a simple numerical method for solving first-order differential equations called the Euler Method. A general differential equation that's first order is dy, dx is some function of x and y. To solve this differential equation, you need an initial condition, y of x-naught equals y-naught. Then starting at the initial point, you can march the solution forward by following the slope of the tangent line to the graph. That gives you formulas for the Euler Method. I'm Jeff Chasnov. Thanks for watching, and I'll see you in the next video.