Why should we avoid complementary solution in particular solution

ordinary differential equations

I'm currently learning calculus and my teacher taught me that:

For second-order differential equations taking the form:

$y'' + py' + qy = g(x)$

For:

$g(x)=Q_n(x)e^{rx}$

If $r$ equals a real complementary solution of homogeneous differential equation: $y'' + py' + qy = 0$. Then we should guess the particular $y_p$ would take the form: $P_n(x)xe^{rx}$

For example:

Given a 2nd-order ODE: $y''-y'=xe^x$
We can easily find its complementary solution: $y_c = c_1 + c_2e^x$
So we should guess $y_p$ to take the form $(Ax+B)xe^x$ instead of $(Ax+B)e^x$ since $Be^x$ is already a complementary solution.

I don't understand so clearly because even if $Be^x$ is a complementary solution and when substituted into the equation it results in zero, how about the term $Axe^x$? Why can't only the term $Axe^x$ be a particular solution for the differential equation? (And $Be^x$ could be zero with $B=0$)

Best Answer

Technically it's not that we need to exclude parts of the complementary solution from the particular solution, but that they have no influence on the particular solution and so we need to introduce some extra component to have enough degrees of freedom in which to find the necessary function.

There's a "more proper" method for proving this kind of thing via differential operators and the like, but here's a sketch of what happens:

We suppose that the solution looks something like $y(x) = P(x) e^{rx}$, where $P(x)$ is some polynomial - we're not going to assume it has to be of any particular degree. So $y = e^{rx} (a_0 + a_1 x + \ldots + a_m x^m)$, where $m$ is just some natural number. Then we know that $y^{(k)}(x)$, the $k$th derivative, is going to also have a form that's some polynomial (still of degree $m$, as it happens) multiplied by $e^{rx}$.

In fact, we can write $y'(x) = e^{rx}(P(x) + P'(x))$, and $y''(x) = e^{rx}(P(x) + 2P'(x) + P''(x))$, and so on using binomial coefficients if we want to write the general $k$th derivative. Then when we put that into the DE, we're going to get $e^{rx}\tilde{P}(x) = e^{rx} Q_n(x)$, where $\tilde{P}(x)$ is just whatever you get when you add up all the appropriate derivatives on the left-hand side, and clearly this means that $\tilde{P}(x) = Q_n(x)$, and we can equate all the coefficients to get our solution. In fact, we wind up with a set of linear equations in the coefficients of $P$, and if you've done some basic linear algebra you'll know that generally speaking if you have $m$ linearly independent equations in $m$ unknowns you will get a unique solution.

Usually, as we've noted, all of the derivatives of $e^{rx} P(x)$ will have the same degree, so if $P(x)$ is of degree $n$ then $\tilde{P}(x)$ will also be of degree $n$, and we'll be able to match up all the coefficients with those of $Q_n(x)$ and solve away.

But if $e^{rx}$ is part of the complementary solution, something happens - you'll find that stuff on the left side starts cancelling with each other, specifically because of this, and that effectively removes one degree of freedom on the left. So then if we only have $n$ degrees of freedom on the left, but $n+1$ coefficients to match up, then most of the time we won't be able to find a consistent solution. Let's have a look at how that works in practice using $y''-y'$ as an example.

$$\begin{eqnarray} y'' - y' & = & e^x (P(x) + 2 P'(x) + P''(x)) - e^x(P(x) + P'(x)) \\ & = & e^x(P'(x) + P''(x)) \end{eqnarray}$$

Notice how the $P(x)$ terms cancel each other out, so what we end up with is one degree less than $P$. Which means that if $Q_n$ is degree $n$, we need $P'(x) + P''(x)$ to be degree $n$, which means that $P(x)$ must (in general) be degree $n+1$.

Now, technically, that means that if $Q_n(x)$ were linear, we just need $P(x)$ to be quadratic, and so you might ask "why do we just assume $P(x) = x(Ax + B)$? And the answer is because if we assume $P$ is a generic quadratic $Ax^2 + Bx + C$, we'll find that the constant term is the part that disappears in all of the derivatives, and so it winds up doing the same job as the coefficient of $e^x$ in the complementary solution, making it redundant. Remember, our problem was that we needed 2 degrees of freedom, so we only need two coefficients, and the specific way they show up doesn't matter as long as they don't get swallowed up in the complementary solution.

So to answer your last question - couldn't $Axe^x$ be a particular solution? It could, depending on the specific ODE. But it might not be. And you need to have some way to deal with the situations where it isn't, which is why we still need two coefficients.