What Is Euler's Method?
Most differential equations cannot be solved with formulas, but every reasonable one can be solved with arithmetic. Euler's method is the original recipe: given y′ = f(x, y) and a starting point y(x₀) = y₀, it builds the solution step by tiny step, using the differential equation itself as a local compass. At the current point, the equation tells you the slope; walk a short distance h along that slope; you arrive at (approximately) the next point of the solution. Repeat:
yn+1 = yn + h · f(xn yn)
Each step is a small linear approximation Euler's method is the tangent-line idea applied over and over, stitching hundreds of micro-tangents into a polyline that shadows the true curve. It is to differential equations what Riemann sums are to integrals: the definition-level algorithm, simple enough to run by hand and honest enough to expose exactly where numerical error comes from.
How to Use This Calculator
Enter the right-hand side f(x, y), the initial condition (x₀, y₀), the step size h, and how many steps to take. The calculator executes the iteration, listing every step's slope evaluation and update so you can follow (or check homework) line by line, then reports y at the final x. The plot draws the Euler polyline in indigo against a high-accuracy reference solution (dashed teal) computed with a fine-step Runge–Kutta integrator, so the method's drift away from the truth is visible, not hypothetical, and shrinking h visibly closes the gap.
Worked Example
The classic classroom problem: y′ = x + y, y(0) = 1, with h = 0.1 for ten steps to reach x = 1. First step: the slope at (0, 1) is f(0, 1) = 0 + 1 = 1, so y(0.1) ≈ 1 + 0.1·1 = 1.1. Second step: slope f(0.1, 1.1) = 1.2, so y(0.2) ≈ 1.1 + 0.12 = 1.22. Continuing all ten steps lands at:
y(1) ≈ 3.187485, versus the exact 2e − 2 ≈ 3.436564
The error, about 0.25, has a diagnosis: y′ = x + y curves upward everywhere (the solution is y = 2eˣ − x − 1), and Euler steps along tangent lines, which sit below an upward-curving graph. Every step undershoots slightly, and the undershoots compound. Halve the step to h = 0.05 and the error roughly halves, the signature of a first-order method.
Error: Why Step Size Matters
Euler's method has local error of order h² (each step's tangent line misses the curve by about ½y″h²) but global error of order h, because reaching a fixed endpoint takes 1/h steps, and the per-step errors accumulate. Practically: to gain one extra decimal digit of accuracy you need ten times as many steps. That brutal exchange rate is why Euler's method is the teaching algorithm rather than the production one, the Runge–Kutta method spends four slope evaluations per step to achieve fourth-order accuracy, gaining four digits for each tenfold step refinement instead of one. Compare the two on this page's default problem and RK4's dashed reference is indistinguishable from truth at step sizes where Euler is off in the first decimal.
Common Mistakes to Avoid
- Updating x and y out of sync. The slope must be evaluated at the current point (xₙ, yₙ) before either coordinate advances. Computing f at the new x with the old y (or vice versa) corrupts every subsequent step.
- Trusting large steps through fast-changing regions. Where the solution bends sharply, tangent lines are poor guides. The logistic chip with h = 0.5 visibly overshoots the approach to y = 1; at h = 0.1 it behaves. Error is a local phenomenon, step size must respect the fastest dynamics in the window.
- Expecting the error to stay put. Euler error compounds: a solution family that spreads apart (like y′ = y) amplifies early mistakes exponentially. The final-step error can dwarf any single step's contribution.
- Forgetting negative h is allowed. Integrating backward (h < 0) recovers the solution's past, useful, but remember the same error analysis applies in reverse.
Real-World Applications
Euler's method is the conceptual seed of every ODE solver in scientific computing, the step-slope-update skeleton persists inside the sophisticated adaptive integrators that fly spacecraft, price interest-rate derivatives, and simulate protein folding. Video games and physics engines actually ship Euler variants (semi-implicit Euler is the industry workhorse) because at 60 frames per second, steps are small, speed is everything, and pixel-level accuracy suffices.
In engineering education and rapid prototyping, Euler remains the ten-line solver you write first: circuit transients, tank-mixing problems, epidemic curves, and rocket burns all yield to it before any library is imported. And in machine learning, gradient descent is Euler's method applied to the gradient-flow equation, learning rates are step sizes, and the instability that plagues too-large learning rates is precisely Euler's h-too-big failure mode, understood a century early.
Frequently Asked Questions
How do I choose the step size h?
Small enough that halving it barely changes the answer, that self-consistency check is the practical test. Production solvers automate it, adjusting h on the fly to hold estimated error below tolerance; with this calculator, run twice (h, then h/2) and compare, or watch the gap to the dashed reference curve.
Why is it called a first-order method?
Global error shrinks proportionally to h¹. Halving the step halves the error. Runge–Kutta 4 is fourth-order: halving the step cuts error by 2⁴ = 16, the order is the exponent in the error-versus-step-size law.
Can Euler's method fail completely?
Yes, for stiff equations (very fast decay mixed with slow dynamics), explicit Euler oscillates and explodes unless h is impractically small. Implicit (backward) Euler, which solves for the new point using the slope at the new point, is stable there, the classic reason implicit methods exist.
What does the dashed curve in the plot show?
A high-accuracy reference computed by fourth-order Runge–Kutta at a 24× finer step, accurate to far more digits than the display. The vertical gap between it and your Euler polyline is your method's global error, made visible.
Does Euler's method work for systems of equations?
Identically, y and f become vectors, and the same update applies componentwise. Second-order equations like y″ = −y convert to first-order systems (position and velocity), which is exactly how physics engines integrate motion. The vector field plotter shows the phase-plane picture such systems inhabit.
Who was Euler, and why does he own this method?
Leonhard Euler described the technique in his 1768 calculus text, the first systematic numerical ODE method. That the simplest possible algorithm bears history's most prolific mathematician's name is fitting: he touched essentially every branch of the subject this site covers.