About the Differential Equation Solver
A differential equation relates an unknown function to its derivatives. Population growth, cooling coffee, a falling object with air resistance, a mass on a spring and an electric circuit are all described this way, which is why ODEs appear in calculus, physics, engineering and AP Calculus BC.
This solver covers the three families met first in most courses: separable equations dy/dx = g(x)h(y), linear first-order equations y′ + P(x)y = Q(x), and homogeneous second-order equations ay″ + by′ + cy = 0 with constant coefficients. Each solution is differentiated and plugged back into the original equation numerically.
What is a differential equation?
An ordinary differential equation (ODE) involves a function of one variable, y(x), and some of its derivatives. Its order is the highest derivative that appears. Solving it means finding every function that makes the equation true; the general solution contains arbitrary constants, one for each order.
An initial value problem adds conditions such as y(0) = 3, or y(0) = 1 and y′(0) = 0 for a second-order equation. These fix the constants and pick out a single particular solution from the whole family of curves.
How to use the Differential Equation Solver
- Choose separable, linear first-order or second-order.
- For separable, enter g(x) and h(y); for linear, enter P(x) and Q(x).
- For second-order, enter a, b and c from ay″ + by′ + cy = 0.
- Optionally enter x₀ and y(x₀), plus y′(x₀) for second-order.
- Press Solve equation and read the solution and the check.
Formulas
Separable
Integrating factor
Characteristic equation
Complex roots α ± βi
Exponential growth
Worked example: dy/dx = 2xy, y(0) = 3
For with , separate to get , then integrate: , so .
Putting x = 0 gives K = 3, so the particular solution is . Differentiating, , which confirms it.
Notice that the initial condition is applied only after the general solution has been found. Substituting too early, before integrating, would hide the constant and lead to a wrong curve. The same order of work applies to every equation type on this page: solve generally, then fix constants, then check by substitution.
The solution below is generated by the same engine that powers the calculator above.
Final answer
How we read your problem
Solve the separable initial value problem.
Step-by-step solution
Separate the variables
Move every y to the left with dy and every x to the right with dx.
Integrate both sides
Solve for y
Multiply by the coefficient of y, exponentiate, and absorb ±e^C into a single constant K.
Use the initial condition
Formulas used
Separation of variables
Each side is integrated with respect to its own variable; one constant of integration is enough. Equilibrium solutions where h(y) = 0 are also solutions of the equation.
Verification
- Substituted back into dy/dx − g(x)h(y): residual is 0 at sample points ✓
- y(0) = 3 ✓
Detailed explanation
Separable equations
If the right-hand side factors into a part depending only on x and a part depending only on y, divide by h(y) and multiply by dx so each variable sits on its own side, then integrate both sides. Only one constant is needed, because the two constants can be combined.
Dividing by h(y) can lose equilibrium solutions where h(y) = 0. For dy/dx = 2 − y, the constant function y = 2 also satisfies the equation. With y(0) = 0 the solver finds , which approaches that equilibrium as x grows, the pattern behind Newton’s law of cooling.
Linear first-order equations
Write the equation as y′ + P(x)y = Q(x). Multiplying by the integrating factor turns the left side into the derivative of the product μy, so one integration finishes the job.
For y′ + 2y = 4, μ = e^{2x}. Then , so and . Every solution approaches the steady state y = 2. When P(x) = 1/x, μ = x, and the solver drops the absolute value by working on an interval where x > 0.
Second-order equations with constant coefficients
Substituting y = e^{rx} into ay″ + by′ + cy = 0 gives the characteristic equation ar² + br + c = 0. Its discriminant decides everything: two real roots give two exponentials, a repeated root r gives , and complex roots α ± βi give oscillation inside an exponential envelope.
For y″ − 5y′ + 6y = 0 the roots are 2 and 3. With y(0) = 1 and y′(0) = 0 the constants satisfy C₁ + C₂ = 1 and 2C₁ + 3C₂ = 0, giving . An undamped spring, y″ + 4y = 0, has roots ±2i and solutions built from cos 2x and sin 2x.
Common mistakes
- Forgetting the constant of integration until after solving for y.
- Adding C on both sides when separating variables.
- Not writing a linear equation in standard form before finding P(x).
- Using e^{rx} with the wrong sign of the root.
- Applying initial conditions to the general solution before differentiating for y′(x₀).
Tips
- Always check a solution by substituting it back into the equation.
- Divide through by the coefficient of y′ to reach standard form.
- Look for equilibrium solutions where h(y) = 0.
- For second-order problems compute the discriminant first; it tells you the form.
- Use the integral calculator to practise the integrals that appear.
Frequently asked questions
How do I know if a differential equation is separable?
If dy/dx can be written as a product g(x)·h(y), with no terms mixing x and y in a sum, it is separable.
What is an integrating factor?
For y′ + P(x)y = Q(x) it is μ = e^(∫P dx); multiplying by it makes the left side the derivative of μ·y.
What is the characteristic equation of y″ + by′ + cy = 0?
It is r² + br + c = 0, obtained by trying y = e^(rx). Its roots decide the form of the solution.
Why do I get sines and cosines in the solution?
When the characteristic roots are complex, α ± βi, Euler’s formula turns e^(βix) into cos βx and sin βx, which describe oscillation.
What is the difference between a general and a particular solution?
The general solution has arbitrary constants; a particular solution fixes them using initial conditions.
How many initial conditions does a second-order equation need?
Two, usually y(x₀) and y′(x₀), one for each constant C₁ and C₂.
Can this solver handle non-homogeneous second-order equations?
Not yet. It solves ay″ + by′ + cy = 0; equations with a forcing term need undetermined coefficients or variation of parameters.
Solve a differential equation
Pick the equation type above, enter its parts and any initial conditions to see every step.