What is it?
The simplest numerical ODE solver: follow the tangent for a small time step, . First order (error ), easy to destabilize — and, in its semi-implicit form, the default integrator of game physics.
Why does it exist?
Most ODEs have no closed-form solution. Euler's idea (1768): we know the slope at the current point, so assume it stays constant for a short time, step, and repeat. It turns any ODE into a loop.
Intuition
Walking with your eyes closed, opening them every seconds to check your heading. Small : you follow the path closely. Large : you drift off, and on a circular orbit you spiral outwards because each tangent step leaves the circle. Error per step , accumulated over steps: .
Formal definition
Explicit Euler: . Global error for Lipschitz . On the test equation () it is stable only if , i.e. .
Formulas
- explicit Euler
- semi-implicit (symplectic) Euler, used in game engines
- gradient descent is explicit Euler on the gradient flow
How is it computed?
t, y = t0, y0
while t < T:
y = y + h * f(t, y)
t = t + h
For mechanics, update velocity first and then position with the new velocity (semi-implicit): energy stays bounded instead of growing.
Example
, (exact ), step : , so vs . With : — the numerical solution explodes while the true one decays. That is numerical instability.
Why does it matter?
Every game engine steps its world with a variant of Euler at 60 Hz. And the most important algorithm of machine learning is Euler's method in disguise: gradient descent is explicit Euler applied to the gradient flow , with the learning rate as the time step — so its stability limit is Euler's stability limit.
Where it shows up in computing
Semi-implicit Euler is the default integrator of Box2D, Bullet and most game engines.
Where it shows up in AI
GD is explicit Euler on ; the learning rate is the time step and inherits its stability limit.
Diffusion and flow-matching samplers integrate a learned ODE/SDE with Euler-type steps.
Where is it used?
Computing topics reachable from here, through the chain of ideas that leads to them:
What depends on it
Exercises
Do three Euler steps with for , .
Solution
; ; (exact ).
Simulate a planet on a circular orbit with explicit Euler. What happens to its energy? How does semi-implicit Euler fix it?
Solution
Each explicit step moves along the tangent, outside the circle: the radius and energy grow every step and the planet spirals out. Semi-implicit Euler is symplectic: it preserves a slightly perturbed energy, so the orbit stays closed for very long times.
Explain why a learning rate above makes training diverge, using Euler's method.
Solution
Near a minimum , so GD is Euler on . Along the top eigenvector, , which grows when , i.e. .