A first-order linear differential equation has the standard form
$$\frac{dy}{dx}+P(x)\,y=Q(x),$$
where $P$ and $Q$ are functions of $x$ only. It is solved using an integrating factor.
The integrating factor (IF)
$$\text{IF}=e^{\int P\,dx}.$$
Multiplying through by the IF turns the left side into the derivative of (IF $\times y$). The solution is then
$$y\cdot(\text{IF})=\int Q\cdot(\text{IF})\,dx + C.$$
Method
- Put the equation in standard form and read off $P$ and $Q$.
- Compute IF $=e^{\int P\,dx}$.
- Write $y\cdot\text{IF}=\int Q\cdot\text{IF}\,dx+C$ and integrate.