Differential Equation Calculator

Type the equation, with y', y'' (up to y''''), and optionally initial conditions to get the solution.

Write y' and y'' (or dy/dx and d^2y/dx^2): y' + 2y = 4 or y'' - 3y' + 2y = 0. Type powers with ^ and functions with brackets: e^x, sin(x), ln(x).

Optional: y(0) = 2 for a first-order equation, or y(0) = 0, y'(0) = 1 for a second-order one. Leave empty for the general solution.

Try

Result

You enteredy′+2y=4y' + 2y = 4

y=2+C e−2x\displaystyle y = 2 + C\,e^{-2x}
Show the work
  1. Type of equation

    This equation is linear in y, so it can be written y' + P(x)y = Q(x) and solved with an integrating factor.

  2. Linear first-order equation

    The equation is linear in yy, so it has the form y′+P(x)y=Q(x)y' + P(x)y = Q(x) with P(x)=2P(x) = 2 and Q(x)=4Q(x) = 4.

    y′+2y=4y' + 2y = 4
  3. Integrating factor

    Multiply the equation by μ(x)=e∫P(x) dx\mu(x) = e^{\int P(x)\,dx}: the left side then becomes (μy)′(\mu y)'.

    μ(x)=e∫P(x) dx=e∫2 dx=e2x\begin{aligned} \mu(x) &= e^{\int P(x)\,dx} \\ &= e^{\int 2\,dx} \\ &= e^{2x} \end{aligned}
  4. Integrate both sides

    Now (μy)′=μQ(\mu y)' = \mu Q, so integrate μQ\mu Q and divide by μ\mu.

    μy=∫4e2x dx=2e2x+C\begin{aligned} \mu y &= \int 4e^{2x}\,dx \\ &= 2e^{2x} + C \end{aligned}
  5. Solve for y

    Divide by μ\mu: the constant CC multiplies 1/μ1/\mu.

    y=1μ(∫μQ dx+C)=2+C e−2x\begin{aligned} y &= \frac{1}{\mu}\left(\int \mu Q\,dx + C\right) \\ &= 2 + C\,e^{-2x} \end{aligned}
  6. Result

    The general solution, with arbitrary constants.

    y=2+C e−2xy = 2 + C\,e^{-2x}

Worked examples