Use the Method of Undetermined Coefficients to solve Non-Homogeneous ODEs

ordinary differential equations

I have a very general question about the Method of Undetermined coefficients when the non-homogeneous part is a polynomial (say $n$th degree). In this case, I know that if you try:
$$ y_p(x) = A_nx^n+A_{n-1}x^{n-1}+…+A_1x+A_0 $$

then you will be guaranteed to get the correct answer. However, when I look through solutions I find that my professor is often simplifying her choice by choosing $A_i=0$ for some $i<n$.

Is there a way to know exactly when you can do this and when you have to assume that none of the $A_i$ are zero?

If it helps to have a specific example, one I just saw was:
$$ x^2y''+xy'+y=x^4 $$
This is a standard Euler equation which can be solved from guessing $y=x^r$. Doing so gives, $r=\pm i$ and so our homogeneous solution is:
$$ y_h(x) = c_1 \cos(\ln x)+c_2\sin(\ln x) $$
All of this I totally understand and can replicate. However, when she solves the non-homogeneous part she only chooses:
$$ y_p(x) =Ax^4 $$
This is what I'm confused about. Is there something special about this problem that allows you to assume the particular solution is only a function of $x^4$?

Conversely, for the equation:
$$ y''-y'-2y=x $$
we can similarly just solve the characteristic equation to get $r=-1,2$. So our homogeneous solution is:
$$ y_h(x) = c_1e^{-x}+c_2e^{2x} $$
Now in this example, however, she chooses:
$$ y_p(x) = Ax+B $$
and after solving it turns out both are non-zero. What are the differences – is i.t because the first is an Euler equation? If so, why does that change things? Or are there no differences and I should just always assume $A_i$ are nonzero?

Any help is much appreciated!

Best Answer

$$x^2y''+xy'+y=x^4$$ For the Euler equation it's a bit particular because all the derivatives ( also $y$) are on the form $Cx^4$. So that $y_p=Ax^4$ will do the job. (If we suppose of course that the solution to the homogeneous Euler equation has not the form : $y_h=C_1x^4+...$. In this case the guess $y_p=Ax^4$ will not work. )

And both differential equations are different. Euler equation has variable coefficients. When the second DE has constants coefficients.

$$y''-y'-2y=x$$ Here all the coefficents are constants. And $y_p=Ax$ will not work. The derivatives are not all of the form $Cx$. You have constants too. $y'_p$ is a constant not on the form $Cx$.