Professor Gilbert Strang gives an excellent explanation in this MIT OpenCourseWare lesson. If you are interested in differential equations, I highly recommend it.
Linearity
y′(x)+P(x)y(x)=Q(x)
We do not yet know how to solve a differential equation in this form, but suppose it could be written as:
μy′+μ′y=Q(x)
The product rule then gives:
μy′+μ′y=Q=dxd(μy)
Finally, integrate both sides and rearrange:
μyy=∫Qdx=μ1∫Qdx
Therefore, construct μ so that μ′=μP, and solve the homogeneous equation for μ:
μμ′ln(μ)μ=P=∫Pdx+a=Ce∫Pdx
Multiply both sides of (1) by μ, then integrate both sides:
μ(y′+Py)μy′+μPyμy′+μ′yμyy=μQ=μQ=μQ=∫μQdx+C=μ1(∫μQdx+C)
If the original equation is homogeneous, that is, Q(x)=0, then
yh=μ1C
If the original equation is nonhomogeneous, we can choose C=0 in particular, giving
yp=μ1∫μQdx
Looking at the two terms on either side of the plus sign in (3), we can see that the general solution to a first-order linear differential equation consists of the homogeneous solution and a particular solution: y=yp+yh.
Separable Equations
Homogeneous Equations
...