For simplicity, consider such an equation of second-order,
where a, b and c are given constants and f is a given function. (Higher-order equations can be treated similarly.) Suppose that f is not the zero function. Then the equation
is the homogeneous equation that corresponds to the non-homogeneous equation 1. The two are connected by the following result:
If y=G(x) is the general solution of 2 and y=y1(x) is a particular solution of 1, then y=G(x)+y1(x) is the general solution of 1.
Thus the problem of solving 1 is reduced to the problem of finding the complementary function (C.F.) G(x), which is the general solution of 2, and a particular solution y1(x) of 1, usually known in this context as a particular integral (P.I.).
The complementary function is found by looking for solutions of 2 of the form y=emx and obtaining the auxiliary equation am2+bm+c=0. If this equation has distinct real roots m1 and m2, the C.F. is if it has one (repeated) root m, the C.F. is y=(A+Bx)emx; if it has non-real roots α ± β i, the C.F. is y =eαx(A cos βx+B sin βx).
The most elementary way of obtaining a particular integral is to try something similar in form to f(x). Thus, if f(x)=ekx, try as the P.I. y1(x)=pekx. If f(x) is a polynomial in x, try a polynomial of the same degree. If f(x)=cos kx or sin kx, try y1(x)=p cos kx+q sin kx. In each case, the values of the unknown coefficients are found by substituting the possible P.I. into the equation 1. If f(x) is the sum of two terms, a P.I. corresponding to each may be found and the two added together.
Using these methods, the general solution of y″−3y′+2y=4x+e3x, for example, is found to be