Guessing the Particular Solution for Non-homogeneous ODEs
Previously, we have been dealing with only homogeneous constant-coefficient ODEs. If there is a non-homogeneous term then a particular solution should arise. For simple source terms such as powers of \( x \), an exponential, or a sine/cosine, we can guess the particular solution that has the same form but with some other coefficient(s) to be decided. This is known as the Method of Undetermined Coefficients. The table below shows what the guessed ansatz should look like given different source terms.
| R.H.S. | Guess |
| a polynomial \( p(x) \) | another polynomial of the same degree \( q(x) \) |
| an exponential \( e^{ax} \) | the same exponential \( Ae^{ax} \) but with an extra coefficient |
| a polynomial times an exponential \( p(x)e^{ax} \) | another polynomial of the same degree times the exponential \( q(x)e^{ax} \) |
| a sine/cosine \( \sin(bx), \cos(bx) \) | a combination of both the sine and cosine \( A \sin(bx) + B \cos(bx) \), even if the R.H.S. only contains one of them |
| a polynomial times a sine/cosine \( p(x)\sin(bx), p(x)\cos(bx)\) | another two polynomials of the same degree times the sine/cosine \( q_1(x)\sin(bx) + q_2(x)\cos(bx) \) |
| an exponential times a sine/cosine \(e^{ax}\sin(bx), e^{ax}\cos(bx) \) | a combination of both the sine and cosine times the exponential \( A e^{ax}\sin(bx) + B e^{ax}\cos(bx) \) |
For a linear combination of the above non-homogeneous terms, the particular solution will also be a linear combination of the corresponding ansatzes. (Linearity)
Example
Find the full solution for the ODE
\begin{equation}
\frac{d^2y}{dx^2} + y = 5xe^{2x} \tag{1}
\end{equation}
with the initial conditions \( y(0) = -1, y'(0) = 1 \).
It is not hard to see that the complementary solution corresponding to the homogeneous part is \( c_1\cos x + c_2\sin x \), as the auxiliary equation is \( r^2 + 1 = 0 \) and has the two complex roots \(r = \pm i \). Meanwhile, according to the above table, we can make a guess for the particular solution in the following form:
\begin{align}
y_p = (A_1x+A_0)e^{2x} \tag{2}
\end{align}
Substituting this into (1) gives
\begin{align}
\frac{d^2}{dx^2}\bigl[(A_1x+A_0)e^{2x}\bigr] + (A_1x+A_0)e^{2x} &= 5xe^{2x} \\
\frac{d}{dx}\bigl[(A_1x+A_0)2e^{2x} + A_1e^{2x}\bigr] + (A_1x+A_0)e^{2x} &= 5xe^{2x} \\
\bigl[(A_1x+A_0)4e^{2x} + 4A_1e^{2x}\bigr] + (A_1x+A_0)e^{2x} &= 5xe^{2x} \\
5A_1xe^{2x} + (4A_1+5A_0)e^{2x} &= 5xe^{2x} \tag{3}
\end{align}
By comparing the coefficients, we quickly obtain \( A_1 = 1, A_0 = -4/5 \), and so the particular solution is \( (x -4/5)e^{2x} \). The general solution is hence \( y = c_1\cos x + c_2\sin x + (x -4/5)e^{2x} \), and its derivative is \( y’ = -c_1\sin x +c_2\cos x + (2x -3/5) e^{2x}\). Putting the I.C., we have
\begin{align}
\left\{\begin{aligned}
c_1 -4/5 = -1 \\
c_2 -3/5 = 1
\end{aligned}\right. \tag{4}
\end{align}
and thus \( c_1 = -1/5, c_2 = 8/5 \), the full solution is \( y = -(1/5)\cos x + (8/5)\sin x + (x -4/5)e^{2x} \).
Exercise
Derive the general solution to the ODE below (initial conditions unspecified):
\begin{equation}
\frac{d^2y}{dx^2} -3\frac{dy}{dx} + 2y = x \sin x \tag{5}
\end{equation}
Answer
It is clear that the complementary solutions are \( y_1 = e^x \) and \( y_2 = e^{2x} \). The non-homogeneous term \( x \sin x \) requires us to propose the particular solution in the form of \( y_p = M \sin x + N \cos x + P x \sin x + Q x \cos x \). Its derivatives are
\begin{align}
\frac{dy_p}{dx} ={}& M \cos x -N \sin x \\
& +(P x \cos x + P \sin x) + (-Q x \sin x + Q \cos x) \\
={}& (M+Q)\cos x + (P-N)\sin x + P x \cos x -Q x \sin x \\
\frac{d^2y_p}{dx^2} ={}& -(M+Q)\sin x + (P-N)\cos x \\
& -P x \sin x + P \cos x -Q x \cos x -Q\sin x \\
={}& -(M+2Q)\sin x + (2P-N)\cos x -P x \sin x -Q x \cos x
\end{align}
Substituting these expressions into (5) leads to
\begin{align}
[-(M+2Q)\sin x + (2P-N)\cos x -P x \sin x -Q x \cos x] & \\
{}-3[(M+Q)\cos x + (P-N)\sin x + P x \cos x -Q x \sin x] & \\
{}+ 2[M \sin x + N \cos x + P x \sin x + Q x \cos x] &= x \sin x \\
(3N-3P+M-2Q)\sin x + (2P+N-3M-3Q)\cos x & \\
{}+ (3Q+P)x \sin x + (Q-3P)x \cos x &= x \sin x \\
\end{align}
Comparing the coefficients gives the system of equations:
\begin{align}
\left\{\begin{aligned}
3N-3P+M-2Q &= 0 \\
2P+N-3M-3Q &= 0 \\
3Q + P &= 1 \\
Q -3P &= 0
\end{aligned}\right.
\end{align}
Solving it yields \( P = 1/10, Q = 3/10, M = -3/25, N = 17/50 \) (we omit the steps), and hence the general solution is
\begin{align}
y &= c_1e^x + c_2e^{2x} \\
&\quad -(3/25)\sin x + (17/50)\cos x + (1/10) x \sin x + (3/10) x \cos x
\end{align}








Leave a Reply