Differential Equation Solver
Solve simple first-order DEs y'=f(x).
About this tool
Type an equation the way your textbook writes it (y' + 2y = x, y'' + 3y' + 2y = 0, y^(4) − y = 0, d²y/dx² + y = tan x, (2xy+3)dx + (x²−1)dy = 0, or a system such as x' = 3x + y; y' = x + 3y) and add initial conditions like y(0)=1, y'(0)=0. The tool names the method, shows the steps, substitutes the answer back into the equation (the Checked line), and falls back to Runge–Kutta 4 when no closed form exists.
How to use
How it works
First order: y' = f(x) is integrated; y' = f(x)g(y) is separated; y' + P(x)y = Q(x) is solved with the integrating factor μ = exp(∫P dx), so that (μy)' = μQ; Bernoulli equations y' + Py = Qyⁿ use v = y^(1−n); homogeneous equations y' = F(y/x) use y = vx and become separable; M dx + N dy = 0 is tested for exactness (M_y = N_x), then the potential ψ is built and ψ = C is the solution (an integrating factor depending on x only or y only is tried when it is not exact). Autonomous equations y' = f(y) also report their equilibrium points and whether each is stable, unstable or semi-stable. Higher order: for linear equations with constant coefficients the characteristic polynomial is solved (distinct, repeated and complex-conjugate roots, any order), the forcing term is handled by undetermined coefficients for polynomial × e^(ax) × sin/cos combinations including resonance (the trial solution is multiplied by x^s), and by variation of parameters in second order when the integrals can be done (tan, sec, 1/sin, e^x/x). Cauchy–Euler equations use the indicial equation of y = x^r. When y or x is missing, p = y' reduces the order. The constants are found from your conditions by a linear solve (conditions at two points also work). Systems x' = Ax in two unknowns use the eigenvalues and eigenvectors of A (real, repeated with a generalized eigenvector, complex). Everything that is not solvable this way goes to Runge–Kutta 4 on the equivalent first-order system, with the step count doubled from your value until the half-step error estimate is below 1e-9 or 20,000 steps are reached.
y' + Py = Q: y = (1/μ)(∫μQ dx + C), μ = e^(∫P dx) ar² + br + c = 0 → e^(rx), x·e^(rx), e^(αx)cos βx, e^(αx)sin βx RK4: yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)
Worked example
A second-order initial-value problem
- Input
- y'' + 3y' + 2y = 0, y(0) = 1, y'(0) = 0, x = 1
- Output
- y = -exp(-2*x) + 2*exp(-x), y(1) = 0.6004236
- Walkthrough
- The characteristic equation r² + 3r + 2 = 0 has roots −2 and −1, so y = C1·e^(−2x) + C2·e^(−x). The conditions give C1 + C2 = 1 and −2C1 − C2 = 0, so C1 = −1 and C2 = 2. The tool substitutes the result into the equation at eight test points (largest relative residual about 2e-16), and a step-controlled Runge–Kutta 4 run of the equivalent system agrees with y(1) = 0.6004236.
Limitations
- Closed forms exist only for the families above: first-order separable, linear, Bernoulli, homogeneous and exact equations; linear constant-coefficient equations of any order; second-order Cauchy–Euler (nonhomogeneous only through variation of parameters); reduction of order when y or x is missing; and homogeneous 2×2 constant-coefficient systems. Other linear equations with variable coefficients (Bessel, Airy, Legendre) go to the numeric method.
- Undetermined coefficients needs a forcing term that is a sum of polynomial × e^(ax) × sin/cos(bx) terms. Variation of parameters is implemented for second order only, and only when the integrals can be done: y'' + y = tan x works, y'' + y = 1/x does not (it needs Si and Ci), and the tool says so instead of guessing.
- Exact equations are given as the implicit relation ψ(x, y) = C, and the answer is labelled implicit; it is solved for y only when ψ is linear in y. Separable results such as the logistic equation also stay implicit, with y at your x taken from RK4.
- Reduction of order needs the reduced first-order equation to have an explicit solution; y'' = 2yy' with y(0)=0, y'(0)=1 gives the implicit atan(y) = x. Systems with a forcing term or more than two unknowns are solved numerically, not in closed form.
- The numeric method needs all starting values at one x, an end x, and an equation that is first degree in its highest derivative. It stops with a message if the solution blows up. Step control doubles the count from your value; it is capped at 20,000 steps, and stiff equations may need more.
- The substitution check uses eight test points, which catches algebra slips but is not a proof. Cauchy–Euler solutions are valid for x > 0, and formulas with roots or logarithms hold on the interval around your starting point where they stay defined.
Questions
What is the solution of y' + 2y = x with y(0) = 1?
What is y(1) for y' = x + y with y(0) = 1?
How do I enter a second-order equation with conditions?
What does the tool do with a forcing term like e^x when e^x is already a solution?
Can it solve y'' + y = tan x?
How are systems written?
How do I know the answer is right?
What happens if there is no closed form?
Features
- First-order: linear, Bernoulli, exact, homogeneous
- Any-order linear equations and Cauchy–Euler
- 2×2 systems and RK4 for any order
- Every closed form checked by substitution
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Variables, expressions, and equations
Khan Academy
Algebra language shared by many math calculators.
Watch on YouTubeDefinite integrals intro
Khan Academy
Definite integral basics for area-under-curve calculators.
Watch on YouTube
- Math is Fun
Math is Fun
Clear explainers that pair well with calculator-style tools.
- OpenStax Math
OpenStax
Free textbooks for algebra through calculus.