3.3: Linear Equations
( \newcommand{\kernel}{\mathrm{null}\,}\)
The linear first-order differential equation (linear in y and its derivative) can be written in the form dydx+p(x)y=g(x), with the initial condition y(x0)=y0. Linear first-order equations can be integrated using an integrating factor μ(x). We multiply (???) by μ(x), μ(x)[dydx+p(x)y]=μ(x)g(x), and try to determine μ(x) so that μ(x)[dydx+p(x)y]=ddx[μ(x)y].

Equation (???) then becomes ddx[μ(x)y]=μ(x)g(x).
Equation (???) is easily integrated using μ(x0)=μ0 and y(x0)=y0:
μ(x)y−μ0y0=∫xx0μ(x)g(x)dx, or y=1μ(x)(μ0y0+∫xx0μ(x)g(x)dx).
It remains to determine μ(x) from (???). Differentiating and expanding (???) yields μdydx+pμy=dμdxy+μdydx; and upon simplifying, dμdx=pμ.
Equation (???) is separable and can be integrated:
∫μμ0dμμ=∫xx0p(x)dx,lnμμ0=∫xx0p(x)dx,μ(x)=μ0exp(∫xx0p(x)dx).
Notice that since μ0 cancels out of (???), it is customary to assign μ0=1. The solution to (???) satisfying the initial condition y(x0)=y0 is then commonly written as y=1μ(x)(y0+∫xx0μ(x)g(x)dx), with μ(x)=exp(∫xx0p(x)dx) the integrating factor. This important result finds frequent use in applied mathematics.
Solve dydx+2y=e−x, with y(0)=3/4.
Solution
Note that this equation is not separable. With p(x)=2 and g(x)=e−x, we have μ(x)=exp(∫x02dx)=e2x, and y=e−2x(34+∫x0e2xe−xdx)=e−2x(34+∫x0exdx)=e−2x(34+(ex−1))=e−2x(ex−14)=e−x(1−14e−x).
Solve dydx−2xy=x, with y(0)=0.
Solution
This equation is separable, and we solve it in two ways. First, using an integrating factor with p(x)=−2x and g(x)=x:
μ(x)=exp(−2∫x0xdx)=e−x2, and y=ex2∫x0xe−x2dx.
The integral can be done by substitution with u=x2, du=2xdx:
∫x0xe−x2dx=12∫x20e−udu=−12e−u]x20=12(1−e−x2).
Therefore, y=12ex2(1−e−x2)=12(ex2−1).
Second, we integrate by separating variables:
dydx−2xy=x,dydx=x(1+2y),∫y0dy1+2y=∫x0xdx,12ln(1+2y)=12x2,1+2y=ex2,y=12(ex2−1).
The results from the two different solution methods are the same, and the choice of method is a personal preference.