Linear First-Order ODE Calculator

Type y' + P(x)y = Q(x), and optionally an initial condition, to solve it with an integrating factor.

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: one condition such as y(0) = 2. Leave empty for the general solution, with its constant C.

Try

Result

You enteredy′−y=exy' - y = e^{x}

y=(x+C)ex\displaystyle y = \left(x + C\right)e^{x}
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)=−1P(x) = -1 and Q(x)=exQ(x) = e^{x}.

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

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

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

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

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

    The general solution, with arbitrary constants.

    y=(x+C)exy = \left(x + C\right)e^{x}

Worked examples