# Preface

This section presents a technique to find a particular solution to the driven linear constant coefficient differential equation when its nonhomogebeous term has a special form: polynomial times exponential function times a trigonometric function. The technique, called the method of undetermined coefficients, reduces the problem down to an algebra problem.

# Method Undetermined Coefficients

Let $$\texttt{D} = {\text d}/{\text d}x$$ be the derivative operator and its powers are defined recursively: $$\texttt{D}^{m+1} = \texttt{D} \left( \texttt{D}^{m} \right) , \quad m=0,1,2,\ldots .$$ As usual, its zero power is identified with the identity operator $$\texttt{D}^{0} = \texttt{I} ,$$ where I is the identity operator: I(f) = f for any function f. We consider linear constant coefficient differential operators that are generated by a polynomial of degree n:

$L\left[\lambda \right] = a_n \lambda^n + a_{n-1} \lambda^{n-1} + \cdots + a_1 \lambda + a_0 , \qquad a_n \ne 0,$
which is referred to as the characteristic polynomial to the corresponding differential operator
$L \left[ \texttt{D} \right] = a_n \texttt{D}^n + a_{n-1} \texttt{D}^{n-1} + \cdots + a_1 \texttt{D} + a_0 \texttt{I} , \qquad a_n \ne 0.$
It is always assumed that the coefficients of the above operator are constants. Moreover, we always suppose that the leading coefficient 𝑎n ≠ 0. Therefore, it could be factored out or set to be 1.

The Idea why the Method of Undetermined Coefficients works

We know from the previous section that the general solution of the nonhomogeneous differential equation
$L \left[ \texttt{D} \right] y = f(x) \qquad \mbox{or} \qquad a_n y^{(n)} + a_{n-1} y^{(n-1)} + \cdots + a_1 y' + a_0 y = f(x)$
is the sum of yh(x), the general solution of the homogeneous equation $$L \left[ \texttt{D} \right] y_h = 0,$$ and yp(x), a particular solution of the driven equation $$L \left[ \texttt{D} \right] y_p = f(x).$$ We also know how to find the general solution of the homogeneous equation $$M \left[ \texttt{D} \right] y_h = 0$$ for any constant coefficient differential operator M because it is actually reduced for solving the polynomial equation $$M \left( \lambda \right) = 0 .$$

If the input function f(x) is known to be annihilated by some constant coefficient differential operator M:

$M \left[ \texttt{D} \right] f(x) = 0 \qquad \mbox{or} \qquad b_n f^{(n)} + b_{n-1} f^{(n-1)} + \cdots + b_1 f' + b_0 f(x) = 0,$
then we can reduce the given problem to the known problem for solving homogeneous differential equation (ML) y = 0. To achieve this, we just multiply the given nonhomogeneous equation $$L \left[ \texttt{D} \right] y = f(x)$$ by M to obtain
$M \left[ \texttt{D} \right] L \left[ \texttt{D} \right] y = M \left[ \texttt{D} \right] f(x) = 0.$
Since both operators M and L are constant coefficient linear differential operators, the order of their multiplication does not matter: M L = L M. Now we can conclude that a particular solution yp(x) of the driven differential equation $$L \left[ \texttt{D} \right] y_p = f(x)$$ becomes a solution of the homogeneous equation $$M \left[ \texttt{D} \right] L \left[ \texttt{D} \right] y_p = 0 .$$

This reduction of nonhomogeneous problem to a homogeneous one is possible only if we know an annihilator of the input function M f(x) ≡ 0. It turns out that we know what kind of function f(x) should be for arbitrary constant coefficient differential operator M.

Suppose that the input function f(x) is annihilated by the constant coefficient differential operator M:

$M \left[ \texttt{D} \right] f(x) \equiv 0 .$
The corresponding characteristic polynomial can be factored into simple terms:
$M \left( \sigma \right) = b_n \left( \sigma - \sigma_1 \right)^{m_1} \left( \sigma - \sigma_2 \right)^{m_2} \cdots \left( \sigma - \sigma_k \right)^{m_k} = \prod_{i=1}^k M_i (\sigma ),$
where m1, m2, …, mk are algebraic multiplicities of roots of the equation $$M \left( \sigma \right) = 0 .$$ Then the input function will represented as the sum of simple functions
$f(x) = f_1 (x) + f_2 (x) + \cdots + f_k (x) ,$
each term of which is annihilated by a simple multiple:
$\left( \texttt{D} - \sigma_i \right)^{m_i} f_i (x) \equiv 0 , \qquad i = 1,2,\ldots .$
Therefore, we need to consider only one-term operator:
$M_i \left( \sigma \right) = \left( \sigma - \sigma_i \right)^{m_i} , \qquad i=1,2,\ldots , k.$
for each root of the polynomial M(σ) = 0. If σi is a real number, then fi(x) is a polynomial of degree mi-1 times the exponential function: $$f_i (x) = p_{m_i -1} (x)\,e^{\sigma_i x} ,$$ where pmi-1(x) is a polynomial of degree mi-1. If σi = α + jβ is a complex root(α and β are real numbers), then its complex conjugate α - jβ will be also the root of M(σ). To this pair of complex roots of multiplicity m corresponds the real-valued function $$f_i (x) = e^{\alpha_i x}\left[ p_{m_i -1} (x)\,\cos (\beta_i x) + q_{m_i -1} (x)\, \sin (\beta_i x) \right] .$$ Applying M to the sum-function, we get
$M\left[ \texttt{D} \right] f(x) = M_1 \left[ \texttt{D} \right] M_2 \left[ \texttt{D} \right] \cdots M_k \left[ \texttt{D} \right] \left( f_1 + f_2 + \cdots + f_k \right) = 0 ,$
In case of two multiples, we have
$M\left[ \texttt{D} \right] f(x) = M_1 \left[ \texttt{D} \right] M_2 \left[ \texttt{D} \right] \left( f_1 + f_2 \right) = M_2 \left[ \texttt{D} \right] M_1 \left[ \texttt{D} \right] f_1 + M_1 \left[ \texttt{D} \right] M_2 \left[ \texttt{D} \right] f_2 = M_2 \left[ \texttt{D} \right] 0 + M_1 \left[ \texttt{D} \right] 0 = 0.$

The following theorem explains why the method undetermined coefficients works. Recall that the kernel of the operator A, denoted by ker(A), is the set of elements in the domain of the operator A that are mapped to the zero.

Theorem: If L and A are both linear differential operators of positive order, and f is a function annihilated by A, i.e., such that A(f) = 0, then

1. every solution of $$L[y] = f$$ belongs to Ker(AL);
2. in every subspace V of Ker(AL) complementary to Ker(L) (i.e., in every V such that $$\mbox{Ker}(L) \oplus V = \mbox{Ker}(AL)),$$ there is a unique solution to $$L(y) = f.$$

Corollary: If operators L and A commute then Ker(A) is a subspace of Ker(AL). If, in addition, Ker(L) and Ker(A) have only 0 in common, then in Ker(A) there is a unique solution to $$L( y) = f. \qquad$$

If L and A have constant coefficients, then L and A commute. This motivates the standard practice of undetermined coefficients; however, the complement of Ker(L) in Ker(AL) needs have very little similarity to Ker(A), depending on just how large $$\mbox{Ker}(L) \cap \mbox{Ker}(A)$$ is.

It is not the fact that L and A are differential operators which makes the theorem work, but the fact that for operators of these types, dim(Ker(AL)) = dim(Ker(A)) + dim(Ker(L)). Recall that "dim" is an abbreviation for dimension, tha maximum number of linear independent functions.

The theorem explains exactly which nonhomogeneous linear differential equations permit finding a particular solution by the method of undetermined coefficients: the right-hand side must be annihilated by some linear differential operator of positive order. In the constant coefficients case for either topic, it is clear from the theory how to obtain A and all of the basis functions specified by the theorem. In fact, the bases for Ker(L) and Ker(AL) so obtained will always give a basis for Ker(L) as a subset of a basis for Ker(AL). This means that one can immediately identify a basis for a subspace complementary to Ker(L) as those basis elements in Ker(AL) which were not in Ker(L). One then knows the form of a particular solution since the existence of a unique solution in this complementary subspace is guaranteed. These ideas are illustrated by the following examples.

Example: Consider the differential operator of degree four $$L = \left( \texttt{D} - 2 \right)^2 \left( \texttt{D} +3 \right)\left( \texttt{D} - 4 \right) .$$ Let $$f(x) = 2x^3 e^{2x}$$ be a function whose control number is 2. This means that $$A= \left( \texttt{D} -2 \right)^4$$ annihilates it. Since $$AL=LA$$ has the basis of functions

$e^{2x} , \ x\,e^{2x} , \ x^2 e^{2x} , \ x^3 e^{2x} , \ x^4 e^{2x} , \ x^5 e^{2x} , \ e^{-3x}, \ e^{4x} ,$
while L has
$e^{2x} , \ x\,e^{2x} , \ e^{-3x}, \ e^{4x} ,$
A has
$e^{2x} , \ x\,e^{2x} , \ x^2 e^{2x} , \ x^3 e^{2x} ,$
and the complement space V is spanned on
$x^2 e^{2x} , \ x^3 e^{2x} , \ x^4 e^{2x} , \ x^5 e^{2x} .$
Now assume a particular solution of the form
$y_p (x) = c_1 x^2 e^{2x} + c_2 x^3 e^{2x} + c_3 x^4 e^{2x} + c_4 x^5 e^{2x} = x^2 \left( c_1 + c_2 x + c_3 x^2 + c_4 x^3 \right) e^{2x} ,$
which is a product of x2 (power is 2 because the characteristic polynomial has double root 2) times exactly the same form as the input functions; namely, it is a polynomial of degree 3 multiplied by the exponential function. Note that the form of the assumed solution is from the form of the basis for Ker(A) because $$\dim (\mbox{Ker}(L) \cap \mbox{Ker}`(A)) = 2.$$

Lemma: Let us consider the linear nonhomogeneous differential equation with constant coefficients of order n:

$L \left[ \frac{\text d}{{\text d}x} \right] y = f(x) ,$
where $$L[\lambda ] = a_n \lambda^n + \cdots + a_1 \lambda + a_0$$ is its characteristic polynomial, and f(x) is a polynomial of degree m. Then the differential equation $$L[\texttt{D}] y = f(x)$$ has a polynomial solution. Moreover,
1. if $$a_0 \ne 0 ,$$ then the degrees of the polynomials f and g are the same;
2. if $$k = \max \left\{ j \, : \, a_l =0, \ l \le j \right\} ,$$ exists, then we can admit that <$$g(x) = x^{k+1} h(x) ,$$ where h and f have the same degree; /li>
3. if all coefficients are real, the g and h are real.

Theorem: Let f(x) be a nonzero real polynomial and (γ, δ) be a pair of numbers such that γ is a complex number, but δ is always real number, with the condition that δ = 0 if γ is real. Let $$L[\texttt{D}]$$ be a constant coefficient differential operator, with the characteristic polynomial $$L[\lambda ] = a_n \lambda^n + \cdots + a_1 \lambda + a_0 .$$ Then the nonhomogeneous differential equation

$L \left[ \frac{\text d}{{\text d}x} \right] y = f(x)\, e^{\gamma\,x + {\bf j} \delta} ,$
has a particular solution $$y_p (x) = g(x)\, e^{\gamma\,x + {\bf j} \delta} ,$$ where g(x) is an arbitrary polynomial satisfying the differential equation,
$L \left[ \texttt{D} + \gamma \right] g(x) \equiv a_n g^{(n)} + L^{(n-1)} (\gamma ) \,\frac{1}{(n-1)!}\, g^{(n-1)} + \cdots + L' (\gamma )\, g' (x) + L(\gamma )\, g(x) = f(x) .$
Moreover,
1. If γ is a real number, then g(x) is a real valued solution of the above differential equation, and a particular solution of $$L[\texttt{D}] y = g(x)\, e^{\gamma\,x + {\bf j} \delta}$$ becomes $$y_p (x) = g(x)\, e^{\gamma\,x} .$$
2. If γ is complex, then $$z (x) = g(x)\, e^{\gamma\,x + {\bf j} \delta}$$ is a complex-valued solution of $$L[\texttt{D}] y = g(x)\, e^{\gamma\,x + {\bf j} \delta} .$$ If $$\gamma = \alpha + {\bf j} \beta ,$$ where α and β are real numbers, then the real part $$Y_r (x) = \Re \left[ z(x) \right] = \mbox{Re} \left[ z(x) \right]$$ and the imaginary part $$Y_i (x) = \Im \left[ z(x) \right] = \mbox{Im} \left[ z(x) \right]$$ are solutions of the differential equation
$L[\texttt{D}] Y_r (x) = g(x)\,e^{\alpha\, x} \,\cos \left( \beta x + \delta \right) , \qquad L[\texttt{D}] Y_i (x) = g(x)\,e^{\alpha\, x} \,\sin \left( \beta x + \delta \right) .$
3. If $$L[\gamma ] \ne 0 ,$$ then the degree of the polynomial g(x) is the same as the degree of the polynomial f(x).
4. If γ is a root of multiplicity m of the characteristic equation $$L[\gamma ] =0 ,$$ then we can choose a polynomial $$g(x) = x^m h(x) ,$$ where h(x) has the same degree as f(x). ■

Algorithm of the Method of Undetermined Coefficients

Our main objective is to show how to find a particular solution to the nonhomogeneous (also called driven or forced) equation

$L\left[\texttt{D}\right] y = f(x),$
where f(x) is a given function of specific form and L is a linear constant coefficient differential operator. Since it is assumed that the input function f(x) is annihilated by some constant coefficient linear operator M, we can represent this function as the sum
$f(x) = f_1 (x) + f_2 (x) + \cdots + f_k (x) ,$
where each of the functions fi(x) is annihilated by a simple operator either
$M \left[\texttt{D}\right] = \left( \texttt{D} - \sigma_i \texttt{I} \right)^{m_i} \qquad\mbox{or}\qquad M \left[\texttt{D}\right] = \left[ \left( \texttt{D} - \alpha_i \texttt{I} \right)^2 + \beta_i^2 \texttt{I} \right]^{m_i} .$
Therefore, we can restrict ourselves with an input function that is annihilated by one of the above operators. In this section, we present the algorithm for implementation of the method of undetermined coefficients that allows one to find a particular solution in case when
1. the coefficients $$a_n , \ a_{n-1} , \ \ldots , \ a_1 , \ a_0$$ are constants and
2. f(x) is a constant, a polynomial function, an exponential function eax, a sine or cosine function $$\sin \beta x \quad \mbox{or}\quad \cos \beta x,$$ or finite sums and products of these functions.
To each of these input functions, called admissible for the method of undetermined coefficients, we assign a control number, summarized in the table below.

function  formula  control number
polynomial or constant  $$p_n x^n + \cdots + p_1 x + p_0$$   0
polynomial times exponential  $$\left( p_n x^n + \cdots + p_1 x + p_0 \right) e^{\alpha \,x}$$  α
polynomial times exponential & sine  $$\left( p_n x^n + \cdots + p_1 x + p_0 \right) e^{\alpha \,x} \, \sin \beta x$$  α + β j or α - β j
polynomial times exponential & cosine  $$\left( p_n x^n + \cdots + p_1 x + p_0 \right) e^{\alpha\, x}\, \cos \beta x$$  α + β j or α - β j

A control number is just a root of the characteristic polynomial that corresponds to the operator annihilating the function. For instance, if a control number is known to be α, we know that the annihilating polynomial for such function must be $$\left( \texttt{D} - \alpha \right)^m ,$$ for some positive integer m (called the multiplicity). Since the characteristic polynomial for any constant coefficient differential operator can be factored into simple terms, it is natural to start analyzing with some such simple multiples.

Example: The following functions all have zero control number:
$f(x) = 2, \quad x^2 -7x +3 , \quad 3\,x^9 - 101\,x^8 + x -1 .$
The following functions have real control numbers, which we denote by σ,
$f(x) = e^{2x}, \quad \sigma =2, \qquad \left( x^2 -7x +3 \right) e^{-3x} , \quad \sigma = -3, \quad \left( 3\,x^9 - 101\,x^8 + x -1 \right) e^{\pi x} , \quad \sigma = \pi .$
The final set of admissible functions presents input functions with complex control numbers:
$f(x) = e^{2x}\, \sin 3x, \quad \sigma =2+ 3{\bf j}, \qquad x^2 e^{-3x} \cos 5x , \quad \sigma = -3+ 5{\bf j}, \quad \left( 3\,x^9 - 101\,x^8 + x -1 \right) e^{\pi x} \sin \pi x, \quad \sigma = \pi + \pi {\bf j}.$
■
 Method of Undetermined Coefficients Given: Linear constant coefficient differential operator L[D] Driven term f(x) having control number σ Action: Check whether the control number annihilates polynomial L[λ] that is, chech whether L[σ] is zero or not Condition: L[λ] = 0 Seek a particular solution in the same form as f(x) Condition: L[λ] ≠ 0 Seek a particular solution in the form xrf(x) where r is the multiplicity of the root σ in polynomial L[λ], so L[λ] = (λ - σ)r l[λ] and l[σ] ≠ 0 Solution: is obtained upon substitution of guess function into the differential equation and equating coefficients
 txt1 = Graphics[ Text[Style["Algorithm", FontSize -> 24, FontColor -> Red, Bold], {1.6, 2}]]; txt2 = Graphics[ Text[Style["Method Undetermined Coefficients", FontSize -> 24, FontColor -> Blue, Bold], {1.6, 1.75}]]; larrow = Graphics[{Thickness[0.02], Arrowheads[0.15], Arrow[{{1.5, 1.65}, {0.7, 0}}]}]; rarrow = Graphics[{Thickness[0.02], Arrowheads[0.15], Arrow[{{1.7, 1.65}, {2.5, 0}}]}]; txt3 = Graphics[Text[ Style["L[$Sigma]] != 0", FontSize -> 16, FontColor -> Black, Bold], {0.5, 1}]]; txt4 = Graphics[ Text[Style["L[\[Sigma]] = 0", FontSize -> 16, FontColor -> Black, Bold], {2.5, 1}]]; txt5 = Graphics[ Text[Style["Particular solution", FontSize -> 16, FontColor -> Black, Bold], {0.5, -0.2}]]; txt5a = Graphics[ Text[Style["similar to f(x)", FontSize -> 16, FontColor -> Black, Bold], {0.5, -0.4}]]; txt6 = Graphics[ Text[Style["Particular solution is", FontSize -> 16, FontColor -> Black, Bold], {2.8, -0.2}]]; txt6a = Graphics[ Text[Style["similar to" Superscript["x", "r"] "f(x)", FontSize -> 16, FontColor -> Black, Bold], {2.6, -0.4}]]; Show[txt1, txt2, larrow, rarrow, txt3, txt4, txt5, txt5a, txt6, txt6a] Method of Undetermined Coefficients in Examples The above theorem shows that we can always reduce the problem of finding a particular solution to a nonhomogeneous equation to the case when the input function does not contain an exponential multiple. We illustrate the method of undetermined coefficients in the series of examples. Example: Consider the differential equation of third order \[ L[\texttt{D}] y (x) = \left( \texttt{D}^3 -2\,\texttt{D}^2 -5\,\texttt{D} +6 \right) y \equiv y''' -2\,y'' -5\,y' +6\,y = x^3 ,$
with input function $$p(x) = x^3$$ being a polynomial in x. Since the characteristic polynomial $$L[\lambda ] = \lambda^3 -2\,\lambda^2 -5\,\lambda +6 = \left( \lambda -1 \right) \left( \lambda -2 \right) \left( \lambda -3 \right)$$ has three positive distinct roots while the input function has the control number 0, we seek a particular solution in the same form as the driven term, namely, as a polynomial of degree 3:
$y_p (x) = c_0 + c_1 x + c_2 x^2 + c_3 x^3 ,$
where coefficients c's should be determined upon substituting yp into the given differential equation:
$L[\texttt{D}] y_p (x) = 6 \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) -5 \left( c_1 + 2c_2 x + 3 c_3 x^2 \right) -2\left( 2c_2 + 6 c_3 x \right) + 6c_3 = x^3 .$
Equating coefficients of like powers of x (because xk and xn are linearly independent for $$k \ne n$$ ), we obtain four equations:
$\begin{split} 6c_0 -5c_1 +4c_2 +6 c_3 &= 0, \\ 6c_1 -10c_2 -12c_3 &=0, \\ 6c_2 -15c_3 &=0, \\ 6c_3 &=1 . \end{split}$
It is not hard to solve the above system of algebraic equation; however, we delegate this job to Mathematica:
Clear[x,y];
L[x_, y_] = y'''[x] - 2 y''[x] - 5 y'[x] + 6 y[x]
rhs = x^3
L[x,y] == rhs
assume[x_] = a0 + a1*x + a2*x^2 + a3*x^3
result = Collect[L[x, assume], x ]
eqns = CoefficientList[result, x] == CoefficientList[rhs, x]
yp[x_] = assume[x] /. Solve[eqns][[1]]
Out[40]= 209/216 + (37 x)/36 + (5 x^2)/12 + x^3/6

Example: Consider the differential equation with the same differential operator as in the previous example, but having exponential input:

$L[\texttt{D}] y (x) = \left( \texttt{D}^3 -2\,\texttt{D}^2 -5\,\texttt{D} +6 \right) y \equiv y''' -2\,y'' -5\,y' +6\,y = x^3 \, e^{-x} .$
Since the driving function $$f(x) = x^3 e^x$$ has the control number -1, which does not match the roots of characteristic equation, the method suggests to seek a particular solution in the same form and the input function:
$y_p (x) = \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) e^{-x} .$
Next step is to find derivatives of the above function
$\begin{split} y'_p &= \left( c_1 + 2c_2 x + 3c_3 x^2 \right) e^{-x} - y_p (x) , \\ y''_p &= \left( 2c_2 + 6c_3 x \right) e^{-x} - 2 \left( c_1 + 2c_2 x + 3c_3 x^2 \right) e^{-x} + y_p , \\ y'''_p &= 6c_3 e^{-x} -3 \left( 2c_2 + 6c_3 x \right) e^{-x} + 3 \left( c_1 + 2c_2 x + 3c_3 x^2 \right) e^{-x} - y_p (x) . \end{split}$
Then we substitute the derivatives into the given nonhomogeneous equation, canceling the exponential multiple $$e^{-x} ,$$ and obtain
$e^x \,L \left[ \texttt{D} \right] y_p (x) = \left( 6 c_3 -10c_2 + 3c_1 + 8 c_0 \right) + x \left( 8 c_1 + 4 c_2 -30 c_3 \right) + x^2 \left( 6c_3 + 8 c_2 \right) + 8c_3 x^3 = x^3 .$
Two polynomials are equal only when all coefficients are the same. This yields
$\begin{split} 4c_0 + c_1 -5c_2 +3 c_3 &= 0, \\ 8c_1 +4c_2 -30c_3 &=0, \\ 6c_3 +8c_2 &=0, \\ 8c_3 &=1 . \end{split}$
We ask Mathematica for help and verification:
DSolve[y'''[x] - 2*y''[x] - 5*y'[x] + 6*y[x] == x^3 *Exp[-x], y, x]
{{y -> Function[{x}, 1/256 E^-x (-87 + 132 x - 24 x^2 + 32 x^3) + E^(-2 x) C[1] + E^x C[2] + E^(3 x) C[3]]}}
y[x_]=c0 +c1*x +c2*x^2 + c3*x^3
Simplify[D[y[x], x, x, x] - 2*D[y[x], x, x] - 5*D[y[x], x] + 6*y[x]]
2 E^-x (4 c0 + c1 - 5 c2 + 3 c3 + 4 c1 x + 2 c2 x - 15 c3 x + 4 c2 x^2 + 3 c3 x^2 + 4 c3 x^3)
As we see, practical application of the method of undetermined coefficients requires a lot of calculations; so a computer algebra is very helpful. To reduce tedious calculations, we apply the formula from the annihilating method:
$e^{-\gamma\,x} L\left[ \texttt{D} \right] f(x)\, e^{\gamma\, x} = L\left[ \texttt{D} + \gamma \right] f(x) , \qquad \mbox{where } \texttt{D} = \frac{{\text d}}{{\text d}x} . \tag{A}$
We apply Eq(A) with γ = -1 and reduce the differential operator to the following one:
$L\left[ \texttt{D} -1 \right] = \left( \texttt{D} -1 \right)^3 -2 \left( \texttt{D} -1 \right)^2 -5 \left( \texttt{D} -1 \right) +6 = \texttt{D}^3 -5 \texttt{D}^2 +2 \texttt{D} +8 ,$
which we denote by $$M \left[ \texttt{D} \right] = \texttt{D}^3 -5 \texttt{D}^2 + 2 \texttt{D} +8 .$$ Then instead of the original nonhomogeneous problem with the driving term containing exponential multiple, we get equivalent problem with polynomial right-hand side term:
$M \left[ \texttt{D} \right] y = x^3 \qquad \mbox{or} \qquad y''' -5 y'' + 2y' +8y =x^3 .$
Since the characteristic polynomial corresponding to the differential operator M has three distinct real roots $$\lambda = -1, \ 2, \ 4$$ that do not match zero (control number of x3), we seek its particular solution in the form
$y_p (x) = c_0 + c_1 x + c_2 x^2 + c_3 x^3 .$
Substituting this function into the differential equation $$y''' -5 y'' + 2y' +8y =x^3 ,$$ we obtain exactly the same system of algebraic equations:
$\begin{split} 4c_0 + c_1 -5c_2 +3 c_3 &= 0, \\ 4c_1 +2c_2 -15c_3 &=0, \\ 3c_3 +4c_2 &=0, \\ 8c_3 &=1 . \end{split}$

Example: Consider the differential equation with the same differential operator as in the previous example, but having exponential input:

$L[\texttt{D}] y (x) = \left( \texttt{D}^3 -2\,\texttt{D}^2 -5\,\texttt{D} +6 \right) y \equiv y''' -2\,y'' -5\,y' +6\,y = x^3 \, e^{x} .$
We have two options to determine a particular solution: either seek a function having exponential multiple or reduce the problem to the polynomial input without exponential multiple. We demonstrate both approaches.

The control number of the driving term is σ = 1, which matches one of the roots of the characteristic equation $$\lambda^3 -2 \lambda^2 -5 \lambda + 6 = \left( \lambda -1 \right) \left( \lambda -2 \right)\left( \lambda -3 \right) =0$$ of multiplicity 1. Therefore, we seek its particular solution in the form:

$y_p (x) = x \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) e^{x} .$
Substituting this function into the given equation and equating coefficients of like powers of x, we obtain the following system of algebraic equations
$\begin{split} 3c_0 - c_1 -3c_2 &= 0, \\ 6c_1 -3c_2 -12c_3 &=0, \\ 9c_2 -6c_3 &=0, \\ -24c_3 &=1 . \end{split}$
Solving the above system of algebraic equations, we find a particular solution:
$y_p (x) = -x \left( \frac{13}{216} + \frac{7}{72}\, x + \frac{1}{36}\, x^2 + \frac{1}{24}\, x^3 \right) e^{x} .$
Now we use Eq.(A) and reduce the problem to the following differential equation:
$M\left[ \texttt{D} \right] y \equiv L \left[ \texttt{D} +1 \right] y = x^3 \qquad \Longleftrightarrow \qquad y''' + y'' -6y' = x^3 .$
Since the characteristic polynomial $$\lambda^3 + \lambda^2 -6 \lambda = \lambda \left( \lambda -2 \right) \left( \lambda +3 \right)$$ has a root that matches the control number σ = 0 of the input polynomial, we seek its particular solution in the form:
$y_p (x) = x^2 \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) .$
Substituting this function into the differential equation $$M\left[ \texttt{D} \right] y = x^3$$ yields exactly the same solution.

Example: Consider the differential equation with the fourth order differential operator that has a polynomial input:

$L[\texttt{D}] y (x) = \texttt{D}^2 \left( \texttt{D}^2 +\texttt{D} -2 \right) y \equiv \texttt{D}^2 \left( \texttt{D}+2 \right) \left( \texttt{D} -1 \right) y \equiv y^{(4)} + y''' -2\,y'' = x^3 .$
The characteristic polynomial $$L[\lambda ] = \lambda^2 \left( \lambda +2 \right) \left( \lambda -1 \right)$$ has three real roots, one of which, λ = 0, is of multiplicity 2. Since the control number σ = 0 matches this root, we seek a particular solution in the form of a polynomial of degree 3 multiplied by x2:
$y_p (x) = x^2 \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) .$
Substituting this function into the given differential equation and equating like powers of x, we obtain the following system of algebraic equation:
$\begin{split} -4c_0 +5 c_1 +24c_2 &= 0, \\ -c_1 +2c_2 +10c_3 &=0, \\ -2c_2 +5c_3 &=0, \\ -40c_3 &=1 . \end{split}$
Solving the above system of equations, we obtain a particular solution
$y_p (x) = -x^2 \left( \frac{15}{16} + \frac{3}{8}\, x + \frac{1}{16}\, x^2 + \frac{1}{40}\, x^3 \right) .$

Example: Consider the differential equation with the fourth order differential operator when the input has an exponential term:

$L[\texttt{D}] y (x) = \left( \texttt{D}^4 -5\, \texttt{D}^3 +6\,\texttt{D}^2 +4\,\texttt{D} -8 \right) y \equiv \left( \texttt{D} -2 \right)^3 \left( \texttt{D} +1 \right) y \equiv y^{(4)} -5\,y''' +6\,y'' +4\,y' -8\,y = x^3 \, e^{2x} .$
The characteristic polynomial $$L[\lambda ] = \left( \lambda -2 \right)^3 \left( \lambda +1 \right)$$ has one triple root λ = 2 and one simple root λ = -1. Since the control number σ = 2 matches this root, we seek a particular solution as a product of a polynomial of degree 3 times the exponential term, then multiplied by x3:
$y_p (x) = x^3 \left( c_0 + c_1 x + c_2 x^2 + c_3 x^3 \right) e^{2x} .$
Substituting this function into the given differential equation, canceling the exponential multiple and equating like powers of x, we obtain the following system of algebraic equations:
$\begin{split} 3c_0 +4 c_1 &= 0, \\ -3c_1 +5c_2 &=0, \\ c_2 +2c_3 &=0, \\ 360c_3 &=1 . \end{split}$
Solving the above system of equations, we obtain a particular solution
$y_p (x) = x^3 \left( \frac{1}{360}\, x^3 - \frac{1}{180}\, x^2 + \frac{1}{108}\, x - \frac{1}{81} \right) e^{2x} .$

Example: Consider the differential equation whose characteristic polynomial has complex roots that do not match the control numbers of the input function:

$L[\texttt{D}] y (x) = \left( \texttt{D}^3 -4\,\texttt{D}^2 +14\,\texttt{D} -20 \right) y \equiv \left( \texttt{D} -2 \right) \left( \texttt{D}^2 -2\texttt{D} +10 \right) y \equiv y''' -4\,y'' +14\,y' -20\,y = x \, e^{x}\, \cos 2x .$
The characteristic polynomial $$L[\lambda ] = (\lambda -2) \left[ (\lambda -1)^2 + 9 \right]$$ has only simple roots, one is real λ = 2 and two are complex conjugate $$\lambda = 1 \pm 3{\bf j} .$$ The control number of the input function σ = 1 + 2j does not match neither of the roots. Therefore, we seek a particular solution in the same form as the driving function:
$y_p (x) = \left( a_0 + a_1 x \right) e^{x} \, \cos 2x + \left( b_0 + b_1 x \right) e^{x} \, \sin 2x ,$
where a0, a1, b0, and b1 are constants to be determined. Substituting this function into the given differential equation and canceling the exponential term, we obtain
$-\left( 5a_0 + 3a_1 -10b_0 + 4b_1 +5a_1 x -10b_1 x \right) \cos 2x - \left( 10a_0 - 4a_1 + 5b_0 + 3b_1 +10 a_1 x + 5b_1 x \right) \sin 2x = x\,\cos 2x .$
Equating polynomials of sine and cosine, we get
$\begin{split} 5a_0 +3 a_1 -10b_0 + 4b_1 &= 0, \\ 10b_1 -5a_1 &=1, \\ 10a_0 -4a_1 + 5b_0 + 3b_1 &=0, \\ 2a_1 + b_1 &=0 . \end{split}$
Solving the above system of equations, we obtain a particular solution
$y_p (x) = \frac{-1}{25} \left( 1 + x \right) e^{x} \, \cos 2x + \frac{2x}{25}\, e^{x} \, \sin 2x .$

Example: Consider the differential equation of second order whose characteristic polynomial has complex roots that do match the control numbers of the input function:

$L[\texttt{D}] y (x) = \left( \texttt{D}^2 +4 \right) y \equiv y'' +4\,y = 2\, x^2\, \sin 2x + 3x\, \cos x .$
The characteristic polynomial $$L[\lambda ] = \lambda^2 +4$$ has two complex conjugate roots $$\lambda = \pm 2{\bf j} ,$$ which matches the control number of the function $$2\, x^2\, \sin 2x .$$ Another function $$3x\, \cos x$$ has the control number σ = j (here j is a unit vector in vertical direction on the complex plane, so $${\bf j}^2 =-1$$ ). Therefore, we seek a particular solution in the form
$y_p (x) = x\left( a_0 + a_1 x + a_2 x^2 \right) \cos 2x + x \left( b_0 + b_1 x + b_2 x^2 \right) \sin 2x + \left( c_0 + c_1 x \right) \cos x + \left( c_3 + c_4 x \right) \sin x ,$
with some coefficients to be determined. Substituting yp into the differential equation, we obtain
$L[\texttt{D}] y_p (x) = 2\left[ a_1 + 2b_0 + \left( 3a_2 + 4b_1 \right) x + 6 b_2 x^2 \right] \cos 2x + 2\left[ b_1 - 2a_0 + \left( 3b_2 - 4a_1 \right) x - 6 a_2 x^2 \right] \sin 2x + \left( 3c_0 + 2c_4 + 3c_1 x \right) \cos x + \left( 3c_3 -2c_1 + 3c_4 x \right) \sin x.$
To make the result equal to the input function $$2\, x^2\, \sin 2x + 3x\, \cos x ,$$ we choose coefficients so that
$\begin{split} a_1 +2 b_0 &= 0, \\ 3a_2 +4b_1 &=0, \\ 6b_2 &=0, \\ b_1 -2a_0 &=0, \\ 3b_2 - 4 a_1 &=0 , \\ -6a_2 &= 1; \end{split} \qquad \mbox{and} \qquad \begin{split} 3c_0 +2 c_3 &= 0, \\ 3c_1 &=1, \\ 3c_2 -2c_1 &=0, \\ c_3 &=0 . \end{split}$
Solving these two systems of algebraic equations, we get the particular solution
$y_p (x) = x \left( \frac{1}{16} - \frac{x^2}{6} \right) \cos 2x - \frac{x^2}{8}\, \sin 2x + \frac{x}{3}\,\cos x + \frac{2}{9}\, \sin x .$
We verify with Mathematica:
y[x_] = Cos[2*x]*(a0 + a1*x + a2 ** x^2)*x + Sin[2*x]*(b0 + b1*x + b2*x^2)*x
D[y[x], x, x] + 4*y[x]
Simplify[%]
2 a1 Cos[2 x] + 4 b0 Cos[2 x] + 8 b1 x Cos[2 x] + 12 b2 x^2 Cos[2 x] + 2 x Cos[2 x] 0 ** (2 x) + x Cos[2 x] a2 ** 2 + 2 Cos[2 x] a2 ** (2 x) - 4 a0 Sin[2 x]
+ 2 b1 Sin[2 x] - 8 a1 x Sin[2 x] + 6 b2 x Sin[2 x] - 4 x a2 ** (2 x) Sin[2 x] - 4 a2 ** x^2 Sin[2 x] + 0 ** x^2 ((2 + x) Cos[2 x] - 4 x Sin[2 x])
If you try to solve the problem directly, Mathematica will provide you the answer that is hard to intrepid.
DSolve[z''[x] + 4*z[x] == x^2*Cos[2*x], z, x]
{{z -> Function[{x}, C[1] Cos[2 x] + C[2] Sin[2 x] +
1/384 (-3 Cos[2 x] Cos[4 x] + 24 x^2 Cos[2 x] Cos[4 x] + 32 x^3 Sin[2 x] + 12 x Cos[4 x] Sin[2 x] - 12 x Cos[2 x] Sin[4 x] - 3 Sin[2 x]

Example: Consider the differential equation of fourth order whose characteristic polynomial has complex roots that do match the control numbers of the input function:

$L[\texttt{D}] y (x) = \left( \texttt{D}^2 +4 \right)^2 y \equiv \left( \texttt{D}^4 + 8 \texttt{D}^2 +16 \right) y \equiv y^{(4)} +8\,y'' +16\,y' -y = 2\, x^2\, \sin 2x + 3x\, \cos x .$
Since the input function, $$2\, x^2\, \sin 2x + 3x\, \cos x ,$$ is the sum of two functions of control numbers σ = 2j and σ = j, it is annihilated by the differential operator $$M\left[ \texttt{D} \right] = \left( \texttt{D}^2 +4 \right)^3 \left( \texttt{D}^2 +1 \right)^2 .$$ Multiplying both sides of the given differential equation by $$M\left[ \texttt{D} \right] ,$$ we reduce it to a homogeneous equation
$M[\texttt{D}] \, L[\texttt{D}] y (x) \equiv L[\texttt{D}] \, M[\texttt{D}] y (x) \equiv \left( \texttt{D}^2 +4 \right)^5 \left( \texttt{D}^2 +1 \right)^2 y(x) =0 .$
Therefore, we seek a particular solution in the form:
$y_p (x) = x^2 \left( a_0 + a_1 x + a_2 x^2 \right) \cos 2x + x^2 \left( b_0 + b_1 x + b_2 x^2 \right) \sin 2x + \left( c_1 + c_2 x \right) \cos x + \left( c_3 + c_4 x \right) \sin x ,$
with some coefficients to be determined. Substituting yp into the differential equation, we obtain
$L[\texttt{D}] y_p (x) = -8 \left[ 4a_1 - 3a_2 - 6b_1 +3 \left( 4a_1 - 8b_2 \right) x + 8 a_2 x^2 \right] \cos 2x - 8\left[ 6a_1 + 4b_0 -3b_2 + 12\left( 2a_2 + b_1 \right) x + 24 b_2 x^2 \right] \sin 2x + \left( 3c_0 + 2c_4 + 3c_1 x \right) \cos x + \left( 3c_3 -2c_1 + 3c_4 x \right) \sin x.$
To make the result equal to the input function $$2\, x^2\, \sin 2x + 3x\, \cos x ,$$ we choose coefficients so that
$\begin{split} 4a_0 -3a_2 -6 b_1 &= 0, \\ 4a_1 - 8b_2 &=0, \\ a_2 &=0, \\ 6a_1 +4 b_0 -3b_2 &=0, \\ 2a_2 + b_1 &=0 , \\ -96b_2 &= 1; \end{split} \qquad \mbox{and} \qquad \begin{split} 17c_1 -4 c_4 &= 0, \\ 17c_2 &=1, \\ 4c_2 + 17 c_3 &=0, \\ 17 c_4 &=0 . \end{split}$
Solving these two systems of algebraic equations, we get the particular solution
$y_p (x) = - \frac{x^3}{48} \, \cos 2x + x^2 \left( \frac{3}{128} - \frac{x^2}{96}\right) \sin 2x + \frac{x}{17}\,\cos x - \frac{4}{289}\, \sin x .$

1. Using the method of undetermined coefficients, find a particular solution to the differential equation $$y'' + y = t^2 .$$