How to use the Method of Undetermined Coefficients to solve Non-Homogeneous ODEs

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.

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!

$$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$$.

• So for all differential equations with constant coefficients you have to assume all $A_i$ are nonzero and for Euler equations you need to only choose nonzero $A_i$ for the ones that actually appear in the non-homogeneous part? – joseph Dec 8 '20 at 19:36
• Both equation are really different yes. Euler has variable coefficients the second ha sonly constants coefficents. So yes the guess is different @joseph – Aryadeva Dec 8 '20 at 19:37
• For the constant coefficents DE always choose $y_p=Ax+B$ if you have inhomogeneous part as $Dx$ – Aryadeva Dec 8 '20 at 19:41
• Yes @joseph that should be the guess but you have to take into account when the solution of the homogeenous DE is not the same as that of the inhomogeenous... – Aryadeva Dec 8 '20 at 19:44
• To summarize. You have differential equations with constants coefficents that are easy. And other ones like Euler with variable coefficents. Then you have to alos take into account if the solution of the homogeneous equation is not the same as that of the inhomogeneous DE. – Aryadeva Dec 8 '20 at 19:46

The rule for constant-coefficient equations (e.g. your $$y'' - 2 y' + y = x$$) is that if the right side is of the form $$p(x) e^{ax}$$ where $$p$$ is a polynomial and $$a$$ is not a root of the characteristic polynomial, there will be a particular solution of the form $$q(x) e^{ax}$$ where $$q$$ is a polynomial of the same degree as $$p$$; if $$a$$ is a root of the characteristic polynomial of multiplicity $$m$$, then there will be a particular solution of the form $$x^m q(x) e^{ax}$$ where $$q$$ is a polynomial of the same degree as $$p$$.

Euler equations can be transformed to constant-coefficient equations by the transformation $$x = e^t$$. If the right side of the Euler equation is a constant times a power of $$x$$ (or more generally a power of $$x$$ times a polynomial in $$\log(x)$$, you can apply the paragraph above to the transformed equation.