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′+yx=xy' + \frac{y}{x} = x

y=x23+Cx\displaystyle y = \frac{x^{2}}{3} + \frac{C}{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)=1xP(x) = \frac{1}{x} and Q(x)=xQ(x) = x.

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

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

    μy=∫x2 dx=x33+C\begin{aligned} \mu y &= \int x^{2}\,dx \\ &= \frac{x^{3}}{3} + C \end{aligned}
  5. Solve for y

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

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

    The general solution, with arbitrary constants.

    y=x23+Cxy = \frac{x^{2}}{3} + \frac{C}{x}

Worked examples