Start with the equation and one known value
An initial-value problem supplies a differential equation and the value of its solution at a particular starting point. The first-order linear calculator supports y′ = ay + b with constant real a and b. Enter the coefficients, initial x and y, and the x where you want the result.
For example, y′ = −2y + 6 with y(0) = 1 describes a solution moving toward the equilibrium value 3 as x increases. Enter a = −2, b = 6, initial x = 0, initial y = 1, and evaluate at x = 1.
Use the initial value to choose the constant
The constant solution is y = 3. Subtract it by writing u = y − 3; the remaining equation is u′ = −2u. Its solutions are exponential. Since u(0) = −2, the required solution is 3 − 2e⁻²ˣ.
The integrating-factor method reaches the same result: rewrite the equation as y′ + 2y = 6 and use the factor e²ˣ. The initial value then fixes the one integration constant. For general constant coefficients with a ≠ 0, use the shifted origin x − x₀ in the formula below.
Check the equation as well as the starting value
At x = 0, the solution gives 3 − 2 = 1, as required. Its derivative is 4e⁻²ˣ. Substituting the solution into −2y + 6 also gives 4e⁻²ˣ, so it satisfies the differential equation for every real x.
At x = 1, the value is approximately 2.7293294335. The solution remains below 3 for finite x and approaches 3 as x increases, consistent with the equation’s direction of change. A check at one evaluation point is useful; differentiating the formula establishes the identity across its domain.
Compare with a numerical solution
In the Euler & Runge–Kutta tool, enter the derivative as -2*y+6, start at x = 0 and y = 1, and take ten steps of size 0.1 to reach x = 1. Euler follows the slope at the start of each step; classical RK4 combines four slope evaluations.
Repeat with twenty steps of size 0.05 to reach the same endpoint. Both methods move closer to the closed-form value in this example. RK4 is much closer on these grids, but the comparison is specific to this smooth equation and these step sizes.
| Method | h = 0.1; 10 steps | h = 0.05; 20 steps |
|---|---|---|
| Euler | 2.785251635 | 2.756846691 |
| Classical RK4 | 2.729320903 | 2.729328943 |
| Closed form | 2.729329434 | 2.729329434 |
Choose the solver that matches the problem
When a = 0, the equation becomes y′ = b and its solution is the line y = y₀ + b(x − x₀). The first-order linear tool handles that case separately. For small nonzero a, it evaluates the exponential difference carefully; extreme exponentials and cancellation can still limit a numerical result.
This closed-form calculator does not solve variable-coefficient or nonlinear equations. The separate Euler & Runge–Kutta tool accepts a restricted f(x, y) expression and 1–80 fixed steps. It is not an adaptive or stiff solver, does not certify an error tolerance, and does not establish that a solution remains valid through a singularity.
Even with a known formula, its evaluated value is a floating-point approximation. Check the equation, initial value, interval and units before interpreting it as a physical model. The tools reject nonfinite results and values beyond their stated numerical range.
References & further reading
- OpenStax Calculus Volume 2, §4.5 — first-order linear equations
- Cleve Moler, Numerical Computing with MATLAB, chapter 7 — ordinary differential equations
Equations describe the stated model. Worked values are rounded for reading; the calculator’s download retains its calculated precision. Read about our checks and their limits.