Particular Solutions by the Method of Undetermined Coefficients

When the forcing function f ( x ) is built from polynomials, exponentials, sines, and cosines, its derivatives keep returning to the same short list of shapes. That makes it possible to guess the form of y p , leaving only some numerical coefficients to determine by substitution. The method is fast, but it has two firm limitations: constant coefficients only, and a restricted class of forcing functions.

Quick Reference

Trial functions. For each term of f ( x ) , take the corresponding trial form for y p :

f ( x ) Trial function for y p
e b x A e b x
x m , m = 0 , 1 , 2 , A 0 + A 1 x + + A m x m
sin k x or cos k x A sin k x + B cos k x
e b x sin k x or e b x cos k x A e b x sin k x + B e b x cos k x
x m e b x e b x ( A 0 + A 1 x + + A m x m )
x m e b x sin k x or x m e b x cos k x e b x sin k x ( A 0 + + A m x m ) + e b x cos k x ( B 0 + + B m x m )

The two rules.

  1. Modification Rule. If a term in your choice for y p also appears in y h , multiply every term in your choice by x , or in general by the smallest integer power of x such that y p contains no term also appearing in y h .
  2. Superposition Rule. If f ( x ) is a sum of terms from the first column, find a particular solution for each term separately and add them.

When the method does not apply. f ( x ) = tan x , tan 1 x , ln x , 1 x , sec x , and anything else with infinitely many independent derivatives. Use variation of parameters instead.

The Setting

We previously learned that the complete solution of a linear differential equation

L[y] = y^{(n)} + P_{n-1}(x)y^{(n-1)} + \cdots + P_1(x)y' + P_0(x)y = f(x) \tag{i}

can be written as

y ( x ) = y h ( x ) + y p ( x )

where y h is the general solution of the corresponding homogeneous equation, obtained by setting f ( x ) = 0 , and y p is any particular solution of (i).

In this section we introduce a method for finding y p . It is simple to use but has two major limitations.

Limitation 1. The method works only for linear differential equations with constant coefficients,

a_ny^{(n)} + \cdots + a_1y' + a_0y = f(x) \tag{ii}

with a n 0 .

Limitation 2. The method applies only when the right-hand side of (ii) involves terms of the form x m (with m = 0 , 1 , 2 , ), sin k x , cos k x , e b x , or products of two or more such functions.

More about the second limitation

The functions listed have only a finite number of linearly independent derivatives. That is the real content of the restriction.

For example, f ( x ) = sin k x and its derivative f'(x) = k\cos kx are linearly independent, but the second derivative f''(x) = -k^{2}\sin kx is a multiple of the original function, and the third derivative is a multiple of the first. This function has only two linearly independent derivatives, f itself and f'.

As a second example, consider f ( x ) = x e x , with f'(x) = e^{x} + xe^{x}. Then

\begin{aligned} f''(x) &= 2e^{x} + xe^{x} = 2f'(x) - f(x) \\ f'''(x) &= 3e^{x} + xe^{x} = 3f'(x) - 2f(x) \\ &\ \ \vdots \end{aligned}

so every higher derivative is a combination of f and f'. Again there are only two independent derivatives.

This method does not work for functions such as

f ( x ) = tan x , f ( x ) = tan 1 x , f ( x ) = ln x , f ( x ) = 1 x .

These generate infinitely many linearly independent derivatives. For instance, successive differentiation of f ( x ) = 1 / x produces

f'(x) = -\frac{1}{x^{2}}, \quad f''(x) = \frac{2}{x^{3}}, \quad f'''(x) = -\frac{6}{x^{4}}, \quad \dots

with no repetition ever. A trial function with finitely many undetermined coefficients cannot possibly match such a forcing term.

The Method

To find the particular solution y p for (i), assume a trial function with a form similar to f ( x ) but containing some undetermined coefficients. Substitute this trial function into (ii), equate coefficients of like terms, and solve for the parameters.

The reason the guess succeeds is now visible: since f and all its derivatives lie in the span of a finite list of functions, and L merely differentiates and adds, a candidate y p drawn from that same span will produce L [ y p ] in that span too. Matching coefficients then becomes a finite system of linear equations.

Why the polynomial case works, in detail

For simplicity consider a second-order equation

L[y] = ay'' + by' + cy = f(x) ,

though the same argument applies at any order.

Case: f ( x ) = b 0 + b 1 x + + b m x m .

We look for a y p such that when y p , y_p', and y_p'' are multiplied by constants and added, the result is a polynomial of degree m . The obvious choice is a polynomial of degree m with coefficients to be determined:

y p = A 0 + A 1 x + + A m x m .

Computing,

\begin{aligned} L\left[y_p\right] &= a\left(2A_2 + \cdots + m(m-1)A_mx^{m-2}\right) \\ &\quad + b\left(A_1 + 2A_2x + \cdots + mA_mx^{m-1}\right) \\ &\quad + c\left(A_0 + A_1x + \cdots + A_mx^{m}\right) \end{aligned}

Equating coefficients of like powers of x in L [ y p ] = b 0 + b 1 x + + b m x m gives the triangular system

\left\{ \begin{aligned} cA_m &= b_m \\ cA_{m-1} + mbA_m &= b_{m-1} \\ &\ \ \vdots \\ cA_0 + bA_1 + 2aA_2 &= b_0 \end{aligned} \right.

If c 0 , the first equation determines A m = b m / c ; substituting into the second determines A m 1 , and so on down the chain. So when c 0 the equation has a particular solution of the assumed form.

If c = 0 the coefficients cannot be determined. Indeed, with c = 0 the left side reduces to ay_p'' + by_p', which is a polynomial of degree m 1 when y p has degree m , while f has degree m . To make the left side degree m , choose a polynomial of degree m + 1 for y p :

y p = x ( A 0 + A 1 x + + A m x m ) .

The constant term has been dropped, because y = constant already solves the homogeneous equation ay'' + by' = 0 and would contribute nothing. The coefficients are then uniquely determined provided b 0 .

If b = c = 0 , the equation reduces to ay'' = f(x), solvable by direct integration, and y p takes the form

y p = x 2 ( A 0 + A 1 x + + A m x m ) .

In summary,

y_p = \left\{ \begin{aligned} &A_0 + A_1x + \cdots + A_mx^{m} && \text{if } c \neq 0 \\ &x\left(A_0 + A_1x + \cdots + A_mx^{m}\right) && \text{if } c = 0 \text{ and } b \neq 0 \\ &x^{2}\left(A_0 + A_1x + \cdots + A_mx^{m}\right) && \text{if } b = c = 0 \end{aligned} \right.

Notice that the three cases correspond exactly to r = 0 being a non-root, a simple root, or a double root of the characteristic equation. That is precisely the Modification Rule at work.

The Two Rules

1. Modification Rule. If a term in your choice for y p also appears in y h , multiply every term in your choice by x , or in general by the smallest integer power of x such that y p contains no terms also appearing in y h .

The rule is necessary because a term already in y h satisfies L [ y ] = 0 , so it can never produce the nonzero right-hand side f ( x ) . Substituting it would give 0 = f ( x ) , an impossibility. Note the word every: if y p = A + B x needs modification, it becomes x ( A + B x ) , not A + B x 2 .

2. Superposition Rule. If f ( x ) is a sum of two terms from the first column of the table, find a particular solution for each and add them.

In other words, if y p 1 is a particular solution of L [ y ] = f 1 ( x ) and y p 2 is a particular solution of L [ y ] = f 2 ( x ) , then y p 1 + y p 2 is a particular solution of L [ y ] = f 1 ( x ) + f 2 ( x ) , because

L [ y p 1 + y p 2 ] = L [ y p 1 ] + L [ y p 2 ] = f 1 ( x ) + f 2 ( x ) .

Worked Examples

Find the general solution of

y'' - 3y' + 2y = 6x + 3e^{x} + \sin 2x .
Solution

We know that y = y h + y p , where y h is the general solution of y'' - 3y' + 2y = 0 and y p is any particular solution.

Step 1: find y h . The characteristic equation is

r 2 3 r + 2 = ( r 1 ) ( r 2 ) = 0 ,

with roots r 1 = 1 and r 2 = 2 . Therefore

y h = c 1 e x + c 2 e 2 x .

Step 2: split f ( x ) by the Superposition Rule. Write

y p = y p 1 + y p 2 + y p 3

where y p 1 solves y'' - 3y' + 2y = 6x, y p 2 solves y'' - 3y' + 2y = 3e^{x}, and y p 3 solves y'' - 3y' + 2y = \sin 2x.

Step 3: the polynomial part. Set y p 1 = A + B x . Then

y_{p_1}' = B, \qquad y_{p_1}'' = 0 .

Substituting,

0 3 B + 2 ( A + B x ) = 6 x .

Equating coefficients of x and of 1 ,

\left\{ \begin{aligned} 2B &= 6 && \text{coefficient of } x \\ 2A - 3B &= 0 && \text{coefficient of } 1 \end{aligned} \right.

so B = 3 and A = 4.5 , giving

y p 1 = 4.5 + 3 x .

Step 4: the exponential part. Because e x appears in y h , the Modification Rule tells us to use

y p 2 = C x e x .

Differentiating,

\begin{aligned} y_{p_2}' &= Ce^{x} + Cxe^{x} \\ y_{p_2}'' &= 2Ce^{x} + Cxe^{x} \end{aligned}

Substituting into the equation,

2 C e x + C x e x 3 ( C e x + C x e x ) + 2 C x e x = 3 e x .

The terms in x e x collect to C 3 C + 2 C = 0 and vanish, exactly as they must, since x e x was not itself a homogeneous solution but e x was. What survives is

2 C e x 3 C e x = C e x = 3 e x C = 3 .

Therefore

y p 2 = 3 x e x .

Step 5: the trigonometric part. Set

y p 3 = E sin 2 x + F cos 2 x .

Note that both a sine and a cosine must be included even though f contains only a sine, because differentiation converts one into the other. The derivatives are

\begin{aligned} y_{p_3}' &= 2E\cos 2x - 2F\sin 2x \\ y_{p_3}'' &= -4E\sin 2x - 4F\cos 2x \end{aligned}

Substituting,

4 E sin 2 x 4 F cos 2 x 3 ( 2 E cos 2 x 2 F sin 2 x ) + 2 ( E sin 2 x + F cos 2 x ) = sin 2 x

Collecting,

( 4 E + 6 F + 2 E ) sin 2 x + ( 4 F 6 E + 2 F ) cos 2 x = sin 2 x

that is,

( 2 E + 6 F ) sin 2 x + ( 6 E 2 F ) cos 2 x = sin 2 x .

Equating coefficients,

\left\{ \begin{aligned} -2E + 6F &= 1 \\ -6E - 2F &= 0 \end{aligned} \right.

The second gives F = 3 E . Substituting into the first, 2 E 18 E = 20 E = 1 , so E = 1 20 and F = 3 20 . Therefore

y p 3 = 1 20 sin 2 x + 3 20 cos 2 x .

Step 6: assemble.

\begin{aligned} y_p &= y_{p_1} + y_{p_2} + y_{p_3} \\ &= 4.5 + 3x - 3xe^{x} - \frac{1}{20}\sin 2x + \frac{3}{20}\cos 2x \end{aligned}

and the general solution is

y = c 1 e x + c 2 e 2 x + 4.5 + 3 x 3 x e x 1 20 sin 2 x + 3 20 cos 2 x .

Find the general solution of

y''' + y'' = 4x^{3} - 1 .
Solution

Step 1: find y h . The characteristic equation is

r 3 + r 2 = r 2 ( r + 1 ) = 0 r 1 , 2 = 0 , r 3 = 1 .

The three linearly independent solutions of the homogeneous equation are

y 1 ( x ) = e 0 x = 1 , y 2 ( x ) = x y 1 = x , y 3 ( x ) = e x ,

so

y h = c 1 + c 2 x + c 3 e x .

Step 2: choose the trial function. Because f ( x ) = 4 x 3 1 is a polynomial of degree 3 , we start with y p = A 0 + A 1 x + A 2 x 2 + A 3 x 3 . However, both y = 1 and y = x are solutions of the homogeneous equation, so by the Modification Rule we multiply by x 2 , the smallest power that clears the overlap:

y p = x 2 ( A 0 + A 1 x + A 2 x 2 + A 3 x 3 ) .

Now no term in y p appears in y h : the lowest power present is x 2 .

Step 3: differentiate. Expanding, y p = A 0 x 2 + A 1 x 3 + A 2 x 4 + A 3 x 5 , so

\begin{aligned} y_p' &= 2A_0x + 3A_1x^{2} + 4A_2x^{3} + 5A_3x^{4} \\ y_p'' &= 2A_0 + 6A_1x + 12A_2x^{2} + 20A_3x^{3} \\ y_p''' &= 6A_1 + 24A_2x + 60A_3x^{2} \end{aligned}

Step 4: substitute and match. Adding y_p''' + y_p'' and reorganizing by powers,

20 A 3 x 3 + ( 12 A 2 + 60 A 3 ) x 2 + ( 6 A 1 + 24 A 2 ) x + ( 2 A 0 + 6 A 1 ) = 4 x 3 1 .

Equating coefficients of like powers,

\left\{ \begin{aligned} 20A_3 &= 4 \\ 12A_2 + 60A_3 &= 0 \\ 6A_1 + 24A_2 &= 0 \\ 2A_0 + 6A_1 &= -1 \end{aligned} \right.

Solving from the top down: A 3 = 1 5 , then 12 A 2 = 12 so A 2 = 1 , then 6 A 1 = 24 so A 1 = 4 , then 2 A 0 = 1 24 = 25 so A 0 = 25 2 .

Step 5: assemble.

y p = x 2 ( 25 2 + 4 x x 2 + 1 5 x 3 )

and the complete solution is

y = c 1 + c 2 x + c 3 e x 25 2 x 2 + 4 x 3 x 4 + 1 5 x 5 .

Determine the correct form of y p (without computing the coefficients) for

y'' + 4y = 3\sin 2x + x e^{-x} .
Solution

The characteristic equation r 2 + 4 = 0 gives r = ± 2 i , so

y h = c 1 cos 2 x + c 2 sin 2 x .

For the term 3 sin 2 x , the usual trial function is A sin 2 x + B cos 2 x . But both of these appear in y h , so the Modification Rule applies and the correct form is

x ( A sin 2 x + B cos 2 x ) .

For the term x e x , the trial function is e x ( C + D x ) . Neither e x nor x e x appears in y h , so no modification is needed.

By the Superposition Rule,

y p = x ( A sin 2 x + B cos 2 x ) + e x ( C + D x ) .

Note that the modification applied to the trigonometric part only. Each term of f is examined against y h independently.

Exercises

Solve y'' - y = 3e^{2x}.

Solution

The characteristic equation r 2 1 = 0 gives y h = c 1 e x + c 2 e x . Since e 2 x is not in y h , take y p = A e 2 x . Then y_p'' - y_p = 4Ae^{2x} - Ae^{2x} = 3Ae^{2x} = 3e^{2x}, so A = 1 .

y = c 1 e x + c 2 e x + e 2 x .

Solve y'' + y = \cos x.

Solution

Here y h = c 1 cos x + c 2 sin x , and cos x appears in y h , so the Modification Rule gives

y p = x ( A cos x + B sin x ) .

Differentiating,

y_p' = A\cos x + B\sin x + x\left(-A\sin x + B\cos x\right)y_p'' = -2A\sin x + 2B\cos x + x\left(-A\cos x - B\sin x\right) = -2A\sin x + 2B\cos x - y_p .

Therefore y_p'' + y_p = -2A\sin x + 2B\cos x = \cos x, giving A = 0 and B = 1 2 .

y = c 1 cos x + c 2 sin x + x 2 sin x .

The unbounded factor x is the signature of resonance: forcing an undamped oscillator at its own natural frequency produces an amplitude that grows without bound.

Solve y'' - 2y' + y = e^{x}.

Solution

The characteristic equation ( r 1 ) 2 = 0 gives y h = c 1 e x + c 2 x e x . The natural trial function A e x is in y h ; so is A x e x . The smallest power of x that clears both is x 2 :

y p = A x 2 e x .

Then y_p' = A\left(2x + x^{2}\right)e^{x} and y_p'' = A\left(2 + 4x + x^{2}\right)e^{x}, so

y_p'' - 2y_p' + y_p = A e^{x}\left[\left(2+4x+x^{2}\right) - 2\left(2x+x^{2}\right) + x^{2}\right] = 2Ae^{x} .

Setting 2 A = 1 gives A = 1 2 , so

y = c 1 e x + c 2 x e x + x 2 2 e x .

Explain why undetermined coefficients cannot solve y'' + y = \tan x.

Solution

Because tan x has infinitely many linearly independent derivatives. Successive differentiation gives sec 2 x , then 2 sec 2 x tan x , then 4 sec 2 x tan 2 x + 2 sec 4 x , and so on, with new independent forms appearing at every stage. No trial function with finitely many undetermined coefficients can produce tan x after substitution.

Use variation of parameters instead, which handles this case without difficulty.

Frequently Asked Questions

When can I use the method of undetermined coefficients?

Only when both conditions hold: the equation has constant coefficients, and f ( x ) is a polynomial, an exponential, a sine, a cosine, or a product of these. Either condition failing rules the method out.


What is the Modification Rule and why is it needed?

If a term of your trial y p already solves the homogeneous equation, substituting it gives L [ y p ] = 0 , which cannot equal a nonzero f ( x ) . Multiplying the whole trial function by the smallest power of x that removes the overlap fixes this. Multiply every term, not just the offending one.


Why include both sine and cosine when f has only one of them?

Because differentiating a sine produces a cosine and vice versa. Substituting A sin k x alone into an equation with a y' term generates a cosine that nothing can cancel, so the system becomes inconsistent. Always include both, and let the coefficients come out zero if one is not needed.


How do I know which power of x to multiply by?

Use the smallest one that eliminates every overlap with y h . In practice this equals the multiplicity of the relevant root in the characteristic equation. If r = b is a double root and f contains e b x , use x 2 e b x .


What if f ( x ) has several different types of terms?

Use the Superposition Rule. Solve L [ y ] = f k separately for each term f k , applying the Modification Rule independently to each piece, then add the results. Terms needing modification and terms not needing it can coexist happily in the same problem.


My system of equations for the coefficients has no solution. What went wrong?

Almost certainly a missed application of the Modification Rule. An inconsistent system is the telltale sign that part of your trial function solves the homogeneous equation. Compare each term of y p against y h and multiply through by x as needed.


What is the connection to resonance?

When the forcing frequency matches a natural frequency of the system, f ( x ) contains a term already in y h , the Modification Rule kicks in, and the particular solution acquires a factor of x . That factor grows without bound, which is precisely the physical phenomenon of resonance. The algebra and the physics are the same fact.