acalculator

How do I use Euler's method?

Type the differential equation y′ = f(x, y), the starting point and where to stop. The Euler's method calculator walks there in equal steps and shows each one.

Your numbers

y at the target x
1.5

Euler's method with 6 steps of h = 0.5 gives y(3) ≈ 1.5.

Step size h
0.5
First step
y₁ = 3 + 0.5 × -3 = 1.5

y at the target x: 1.5. Euler's method with 6 steps of h = 0.5 gives y(3) ≈ 1.5.

The Euler approximation

What is each step?

How to calculate

Approximates the solution of a differential equation y′ = f(x, y) with y(x₀) = y₀ by Euler’s method, in n equal steps from x₀ to a target x.

Example with the default inputs (y′ = f(x, y) 2x - 3, Starting x (x₀) 0, Starting y (y₀) 3, Target x 3, Number of steps (n) 6): Euler's method with 6 steps of h = 0.5 gives y(3) ≈ 1.5.

Method: h = (target x − x₀) ÷ n; x_k = x₀ + k h; y_k = y_(k−1) + h × f(x_(k−1), y_(k−1)), for k = 1 to n.

  • Euler’s method follows the tangent line for one step at a time, so the error grows with h; halving h roughly halves it.
  • x values are x₀ + n h, exactly from the typed decimals; y values are worked in double precision.
  • 1 to 1,000 steps; each number from −10⁹ to 10⁹. The target x may be below x₀ (then h is negative).

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. y′ = f(x, y) 2x - 3, Starting x (x₀) 0, Starting y (y₀) 3, Target x 3, Number of steps (n) 6 gives y at the target x 1.5, Step size h 0.5, First step y₁ = 3 + 0.5 × -3 = 1.5.Source: OpenStax, Calculus Volume 2, §4.2 Direction Fields and Numerical Methods: x_n = x₀ + nh, y_n = y_(n−1) + h f(x_(n−1), y_(n−1)) (https://openstax.org/books/calculus-volume-2/pages/4-2-direction-fields-and-numerical-methods, retrieved 2026-10-02): the table gives y₁ = 1.5, y₂ = 0.5, y₃ = 0, y₄ = 0, y₅ = 0.5, y₆ = 1.5
  2. y′ = f(x, y) y, Starting x (x₀) 0, Starting y (y₀) 1, Target x 1, Number of steps (n) 4 gives y at the target x 2.441406, Step size h 0.25.Source: OpenStax, Calculus Volume 2, §4.2 Direction Fields and Numerical Methods: x_n = x₀ + nh, y_n = y_(n−1) + h f(x_(n−1), y_(n−1)) (https://openstax.org/books/calculus-volume-2/pages/4-2-direction-fields-and-numerical-methods, retrieved 2026-10-02)
  3. y′ = f(x, y) x + y, Starting x (x₀) 0, Starting y (y₀) 1, Target x 0.3, Number of steps (n) 3 gives y at the target x 1.362, Step size h 0.1.Source: OpenStax, Calculus Volume 2, §4.2 Direction Fields and Numerical Methods: x_n = x₀ + nh, y_n = y_(n−1) + h f(x_(n−1), y_(n−1)) (https://openstax.org/books/calculus-volume-2/pages/4-2-direction-fields-and-numerical-methods, retrieved 2026-10-02)

How it works

Type f(x, y), the starting point x₀ and y₀, the target x (different from x₀) and the number of steps n (1 to 1,000). Each number is from −10⁹ to 10⁹.

  • Step size h = (target x − x₀) ÷ n, worked out exactly from the typed decimals.
  • x values: x_k = x₀ + k × h for k = 0 to n, each exact before it becomes a float, so the last one is exactly the target x.
  • y values: y₀ as typed, then yk = y(k−1) + h × f(x*(k−1), y*(k−1)), in double precision.
  • y at the target x is y_n. First step writes out y₁ = y₀ + h × f(x₀, y₀).
  • The table lists every step: n, x_n, y_n and f(x_n, y_n), the slope for the next step (0 on the last row, where no step follows). The chart draws y_n against x_n.

Numbers are shown to 10 significant figures.

What f(x, y) can hold

Numbers (2, 0.5, 1e-3), the letters x and y, + − * / and ^ (power), brackets, and implicit products (2x is 2 × x, x y is x × y). Functions: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, sqrt, cbrt, abs, exp, ln and log (both natural logarithms), log10; constants pi and e. Angles are in radians.

Rules

  • There is no answer when f(x, y) cannot be read, when the target x equals x₀, or when f has no real value at a point the method reaches (for example sqrt(y) with y below 0, or a division by 0). The message names the point.
  • There is no answer when |y| grows past 10³⁰⁰.

Worked examples by hand

y′ = 2x − 3, y(0) = 3, target x = 3, n = 6. h = (3 − 0) ÷ 6 = 0.5. y₁ = 3 + 0.5 × (2 × 0 − 3) = 1.5; y₂ = 1.5 + 0.5 × (1 − 3) = 0.5; y₃ = 0.5 + 0.5 × (2 − 3) = 0; y₄ = 0 + 0.5 × (3 − 3) = 0; y₅ = 0 + 0.5 × (4 − 3) = 0.5; y₆ = 0.5 + 0.5 × (5 − 3) = 1.5. This is OpenStax’s table; the exact solution y = x² − 3x + 3 gives 3 at x = 3.

y′ = y, y(0) = 1, target x = 1, n = 4. h = 0.25, and each step multiplies y by 1 + 0.25 = 1.25: y₄ = 1.25⁴ = 2.44140625. The exact answer is e ≈ 2.71828.

y′ = x + y, y(0) = 1, target x = 0.3, n = 3. h = 0.1. y₁ = 1 + 0.1 × (0 + 1) = 1.1; y₂ = 1.1 + 0.1 × (0.1 + 1.1) = 1.22; y₃ = 1.22 + 0.1 × (0.2 + 1.22) = 1.362.

Other questions people ask

What is Euler's method?

A way to approximate the solution of a differential equation y′ = f(x, y) with a known starting value y(x₀) = y₀. From each point it follows the tangent line for one short step: y_new = y + h × f(x, y), x_new = x + h.

How do I use Euler's method by hand?

For y′ = 2x − 3, y(0) = 3 and h = 0.5: the slope at (0, 3) is −3, so y₁ = 3 + 0.5 × (−3) = 1.5 at x = 0.5. The slope there is −2, so y₂ = 1.5 + 0.5 × (−2) = 0.5 at x = 1. Repeat until you reach the target x.

How do I choose the step size?

Smaller steps give a better answer but take more of them. Here you choose the number of steps n, and the step size is h = (target x − x₀) ÷ n. For y′ = y from 0 to 1, 4 steps give 2.441 and 100 steps give 2.705, against the exact e = 2.718.

Why is Euler's method not exact?

It assumes the slope stays the same across each step, but the true solution curves. The error at the target shrinks roughly in proportion to h, so halving the step about halves the error.

What can I type for f(x, y)?

Numbers, x and y, + − × ÷ and ^ for powers, brackets, and functions such as sin, cos, tan, exp, ln (natural log), sqrt and abs. 2x means 2 × x. Angles in sin and cos are in radians.

Can the target x be smaller than x₀?

Yes. Then h is negative and the method walks backwards from x₀.