Integrating Factor

The integrating factor is used to solve first-order linear ODEs of the form:

dydx+P(x)y=Q(x)\frac{dy}{dx} + P(x)y = Q(x)

First, we find the integrating factor, which is given by:

μ(x)=eP(x) dx\mu(x)=e^{\int P(x)~dx}

Next, we multiply both sides of the original ODE by the integrating factor:

μ(x)dydx+μ(x)P(x)y=μ(x)Q(x)\mu(x)\frac{dy}{dx}+\mu(x)P(x)y=\mu(x)Q(x)

Recognize that the left-hand side is the result of the product rule, so can be rewritten as:

(μ(x)y(x))=μ(x)Q(x)\left(\mu(x)y(x) \right)'=\mu(x)Q(x)

Now, integrating with respect to xx gives:

μ(x)y(x)=μ(x)Q(x) dx+C\mu(x)y(x)=\int \mu(x)Q(x)~dx + C

Finally, we can solve for CC. If given an initial condition, find CC and solve for y(x)y(x).

Example

Solve the following ODE:

dydx+2y=ex\frac{dy}{dx} + 2y = e^{-x}

First, we identify P(x)=2P(x) = 2 and Q(x)=exQ(x) = e^{-x}. Next, we find the integrating factor:

μ(x)=e2 dx=e2x\mu(x) = e^{\int 2~dx} = e^{2x}

Now, we multiply both sides of the original ODE by the integrating factor:

e2xdydx+2e2xy=e2xexe^{2x}\frac{dy}{dx} + 2e^{2x} y = e^{2x}e^{-x}

This simplifies to:

(e2xy)=ex\left(e^{2x}y\right)' = e^{x}

Now, we integrate both sides with respect to xx:

e2xy=ex dx+Ce^{2x}y = \int e^{x}~dx + C

This gives us:

e2xy=ex+Ce^{2x}y = e^{x} + C

Finally, we can solve for y(x)y(x):

y(x)=ex+Ce2xy(x) = e^{-x} + Ce^{-2x}

If we are given an initial condition, we can find CC and write the final solution. For example, if we are given y(0)=1y(0) = 1, we can substitute x=0x=0 and y=1y=1 into the solution to find CC:

1=e0+Ce0    C=01 = e^{0} + Ce^{0} \implies C = 0

Thus, the final solution to the ODE with the initial condition is:

y(x)=exy(x) = e^{-x}