Definition
y′+p(x)y=r(x)
Solution
Want to hold: μ(t)y′+p(x)μ(t)y=dtd[μ(t)y]⇔p(t)μ(t)=μ′(t)
p(t)μ(t)=μ′(t)⇒p(t)dt=μdμ⇒∫p(t)dt=lnμ(t)⇒μ(t)=e∫p(t)dt+k
Let k=0 and fix μ, then μ(t)^[integrating factor] =e∫p(t)dt
Now, the original ODE becomes
e∫p(t)dty′+p(t)e∫p(t)dty=e∫p(t)dtr(t)
⇒(e∫p(t)dty)′=e∫p(t)dtr(t)
Let h:=∫p(t)dt for simplicity
∫(ehy)′dt=∫ehr(t)dt
⇒(ehy)′=∫ehr(t)dt+c
⇒y=e−h(∫ehr(t)dt+c)=ce−h+e−h∫r(t)ehdt
Examples
&\frac{dy}{dx} = \frac{x^{3}-2y}{x}\\
&\frac{dy}{dx} + \frac{2}{x}y = x^{2}\\
&h(x) := \int\frac{2}{x}dx = 2\ln|x| \Rightarrow \mu(x) := C\exp(\ln|x^{2}|)= Cx^2\\
&\frac{d}{dx}(Cx^{2}y) = Cx^{4}\\
&Cx^{2}y = C\int x^{4}dx = \frac{C}{5}x^{5} + C_{1}\\
&y = \frac{1}{5}x^{3} + \frac{C_{1}}{x^{2}}
\end{aligned}$$