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′=x yy' = x\,y

y=C ex22\displaystyle y = C\,e^{\frac{x^{2}}{2}}
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)=−xP(x) = -x and Q(x)=0Q(x) = 0.

    y′−x y=0y' - x\,y = 0
  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∫−x dx=e−x22\begin{aligned} \mu(x) &= e^{\int P(x)\,dx} \\ &= e^{\int -x\,dx} \\ &= e^{-\frac{x^{2}}{2}} \end{aligned}
  4. Integrate both sides

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

    μy=∫0 dx=0+C\begin{aligned} \mu y &= \int 0\,dx \\ &= 0 + C \end{aligned}
  5. Solve for y

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

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

    The general solution, with arbitrary constants.

    y=C ex22y = C\,e^{\frac{x^{2}}{2}}

Worked examples