Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

Differential Equation Solver

Choose the equation type, enter its parts and, if you have them, the initial conditions. Get the general or particular solution with the separation, integrating factor or characteristic equation shown, and the answer substituted back as a check.

Leave the initial values empty for the general solution.

Examples

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

  1. Choose separable, linear first-order or second-order.
  2. For separable, enter g(x) and h(y); for linear, enter P(x) and Q(x).
  3. For second-order, enter a, b and c from ay″ + by′ + cy = 0.
  4. Optionally enter x₀ and y(x₀), plus y′(x₀) for second-order.
  5. Press Solve equation and read the solution and the check.

Formulas

Separable

∫dyh(y)=∫g(x) dx+C\int \frac{dy}{h(y)} = \int g(x)\,dx + C

Integrating factor

μ=e∫P dx,(μy)′=μQ\mu = e^{\int P\,dx},\quad (\mu y)' = \mu Q

Characteristic equation

ar2+br+c=0ar^2 + br + c = 0

Complex roots α ± βi

y=eαx(C1cos⁡βx+C2sin⁡βx)y = e^{\alpha x}(C_1\cos\beta x + C_2\sin\beta x)

Exponential growth

dydx=ky⇒y=y0ekx\frac{dy}{dx} = ky \Rightarrow y = y_0e^{kx}

Worked example: dy/dx = 2xy, y(0) = 3

For dydx=2xy\frac{dy}{dx} = 2xy with y(0)=3y(0) = 3, separate to get dyy=2x dx\frac{dy}{y} = 2x\,dx, then integrate: ln⁡∣y∣=x2+C\ln|y| = x^2 + C, so y=Kex2y = Ke^{x^2}.

Putting x = 0 gives K = 3, so the particular solution is y=3ex2y = 3e^{x^2}. Differentiating, y′=6xex2=2x⋅3ex2=2xyy' = 6xe^{x^2} = 2x \cdot 3e^{x^2} = 2xy, 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

y=3ex2y = 3{e}^{{x}^{2}}

How we read your problem

Solve the separable initial value problem.

dydx=(2x)(y),y(0)=3\frac{dy}{dx} = \left(2x\right)\left( y\right),\quad y(0) = 3

Step-by-step solution

  1. Separate the variables

    Move every y to the left with dy and every x to the right with dx.

    dyy=2x dx\frac{dy}{y} = 2x\,dx
  2. Integrate both sides

    ∫dyy=11ln⁡∣y∣=x2+C\int \frac{dy}{y} = \frac{1}{1}\ln\left| y\right| = {x}^{2} + C
  3. Solve for y

    Multiply by the coefficient of y, exponentiate, and absorb ±e^C into a single constant K.

    y=Kex2 y = K e^{{x}^{2}}
  4. Use the initial condition

    K=(1⋅3+0)e−1⋅0=3K = \left(1\cdot 3 + 0\right)e^{-1\cdot 0} = 3

Formulas used

  • Separation of variables

    dydx=g(x)h(y)⇒∫dyh(y)=∫g(x) dx+C\frac{dy}{dx} = g(x)h(y) \Rightarrow \int \frac{dy}{h(y)} = \int g(x)\,dx + C

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 y=2−2e−xy = 2 - 2e^{-x}, 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 μ(x)=e∫P dx\mu(x) = e^{\int P\,dx} turns the left side into the derivative of the product μy, so one integration finishes the job.

For y′ + 2y = 4, μ = e^{2x}. Then (e2xy)′=4e2x(e^{2x}y)' = 4e^{2x}, so e2xy=2e2x+Ce^{2x}y = 2e^{2x} + C and y=2+Ce−2xy = 2 + Ce^{-2x}. 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 (C1+C2x)erx(C_1 + C_2x)e^{rx}, 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 y=3e2x−2e3xy = 3e^{2x} - 2e^{3x}. 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.

More math calculators