First we consider polynomials . The rule will be the following:

*Let be a polynomial of degree ,
and
.*

*If , has a solution that is a polynomial of the same degree .**If but , it has a solution that is a polynomial of degree with no constant term.**If , it has a solution that is a polynomial of degree with no constant term and no term.*

**Example: ** Find a solution of
.

The rule tells us to consider a polynomial of degree 2,
. Plugging this into the equation,
we get

In order for this to be true (as an equation of two functions, not just for some particular ), the coefficients of each power of must match on both sides. We must have , , . This is easy to solve, first for , then , then . We get , , . Thus our solution is .

**Example: ** Find a solution of
.

This time we take
, and get

Again solving three equations (one from each coefficient), we get the solution .

**Example: ** Find a solution of
.

For this one we don't need anything fancy: just integrate twice. A solution is .

Now, how do we know this will always work? After all, a system of
equations doesn't always have solutions.
One way to see it is the following. First consider the
first-order equation
, where and
is a polynomial of degree .
We have a formula for the solution of a first order linear equation:

Using integration by parts, one antiderivative is times a polynomial of degree , and the corresponding is a polynomial of degree .

For example, for
, we have

and the polynomial solution is .

Now consider our second-order equation . We can write for some (not necessarily real) constants and .

- If , and . There is a polynomial of degree with , and then a polynomial of degree with . Thus .
- If but , . There is a polynomial of degree with . Integrating , we get of degree with no constant term such that and .
- If and , we just integrate twice, to obtain of degree with no constant or term.

Now suppose is a polynomial times an exponential. The simplest
way is to use the Exponential Shift Theorem.

**Example: ** Find a solution of
.

If
we have

This puts us back in the polynomial case. We should have a solution where is a polynomial of degree 2, and thus is a polynomial of degree 2 times . Namely, using the methods we looked at before, .

What happens in general? Suppose we want a solution
of
, where is a polynomial of
degree . Using the Exponential Shift Theorem, we look for a solution
where
. Now:

- If not a root of , i.e. where neither nor is , then has a nonzero constant term, so we get a polynomial of degree .
- If is one of two roots of , i.e. with , then , and we get of degree with no constant term.
- If is a double root of , i.e. , then and we get of degree with no constant or term.

We have . With we'll have . The left side is . Solving the equations, we get , , . So our solution is .

If or , we can deal with it similarly using the complex exponential . If is not a root of , the polynomial will have the same degree as . If it is a root, the polynomial will have one degree higher and no constant term. It won't be a double root because complex roots come in pairs.

**Example: ** Find a solution of
.

We have , so we will solve and take . We have . We will have with . Now . Solving our equations and , we get and . So and .

If you don't like all the complex arithmetic, you can use the method
of undetermined coefficients directly on the real form: in this case
it will be
.
Then we have
. For this to be ,
we need the four equations
,
,
,
.

2002-02-18