# Euler's Method

Euler’s method is a **numerical method** for **solving a differential equation** given the **initial condition**.

Recall, a differential equation is an equation the relates a function with derivitives of said function, and your aim is to find the set of all functions that have such a relationship with their derivitives. So the solution to a differential equation is functions that satisfy said rules with their derivitives.

Without an “initial condition” the solution to a differential equation is often many functions, to find a specific function you need an initial condition. An initial condition is one or more input-output pairs of the function you’d like to find (i.e. samples). The number of input-output pairs that you need depend on the order of the differential equation. The higher the order, the more input-output pairs you need.

Euler’s method assumes that you 1) know the derivitve of the function you’d like to find and 2) you have one input-output pair (also called x,y pair).

You start at your known input-output, and you plug the input into the given derivitive function to find the derivitive at this input. You know where you are at this input, and you know your derivitive, so you know where you need to go to. You just pick a “domain step”, an amount to move in the domain, and then you move the correct amount in the range, based on your current derivitive! You are now at a new point. You simply repeat!

- you are at some point x,y
- evauluate the derivitive at this x (you can do this b/c you are given the derivitive function)
- pick a delta x amount to move
- based on the delta x chosen, and the slope at this point, move correctly in the range (y)
- you now have a new x,y, keep repeating!

Notice that you are simply finding a ton of x,y pairs of the function, so you are not really finding a “symbolic representation” of the function. The smaller you make your delta x, the more accurate your tons of x,y pairs will be with the real function.

This image from wikipedia helps illustrate the point:

Blue is the actual curve, red is the x,y pairs you found using euler’s method. You started at point A0, then based on the derivitive at this point’s x, you moved to A1, then based on the derivitive at A1’s x, you moved to A2, etc. The delta x you choose between these points is what I called “domain step size”. The smaller this is, the more accurate your found curve is to the actual curve.