Clarification about correct steps to follow for second order ODE

I have to solve this Cauchy's Problem:

$$\begin{cases}y''-y'+3y=x^2-x+3\\y(0)=y'(0)=0 \end{cases}$$

But I have a doubt about the correct steps to follow.

It was told me that a second-order ODE is solved by $y=y_o+z$ where $y_o$ is the solution of the homogeneous equation and $z$ is a particular solution of the equation.

But it was also told me that, given $y''+ay'+by=f$, $z$ is obtained by: $$z=-y_1 \int f \frac{y_2}{W} dx+y_2 \int f \frac{y_1}{W}dx$$ where $y_1, y_2$ are solutions of the homogeneous equation and $W$ is the Wronskian.

I don't understand why in the solutions book, it is written: $$z=A+Bx+Cx^2$$ Then it proceedes finding $A$, $B$, $C$ in the following way:

$$z'=B+2Cx$$ $$z''=2C$$

$$(2C)-(B+2Cx)+3(A+Bx+Cx^2)=x^2-x+3$$

And I understand it, but I don't understand why $z=A+Bx+Cx^2$... Many thanks!

first you find the particular solution of $$y'' - y' + 3y = x^2 - x + 3$$ by the method of undetermined coefficients. that is look for solutions in the form $$y = ax^2 + bx + c, \quad y' = 2ax + b, \quad y'' = 2a.$$ sub everything back $$2a-(2ax+b) + 3(ax^2 + bx + c) = x^2 - x + 1 \\ \to a = \frac 13, 3b - 2a = -1, b = -\frac 19,\\ 2a-b+3c = 1\to c = \frac2{27}$$

that is, if everything is alright, $$y_p= \frac13x^2-\frac19x+\frac2{27}$$ is a particular solution. it is unlikely to satisfy the initial condition. so we go an look for the solution to the hgs problem $$y'' - y' + 3y =0$$ in the form $y = e^{kx}.$ the $k$ needs to satisfy the char equation $$k^2 -k + 3= 0 \to k = \frac{1\pm\sqrt{11}i}2$$ the hgs solution is $$y_h = e^{x/2}\left(a\cos\sqrt{11}x + b\sin\sqrt{11}x\right)$$

the general solution is $$y=y_h + y_g.$$ i will let you detrmine the constants $a, b$ so that $y$ satisfies the initial conditions $y(0) = 0 = y'(0)$

• I'm sorry, Abel. I haven't understood why the particular solution is in the form $y = ax^2 + bx + c$.. Apr 27, 2015 at 12:48
• That happens because the right side $f$ is a solution of $f'''(x)=0$. In every case where the right side satisfies a linear ODE with constant coefficients, the approach with a trial solution works. Apr 27, 2015 at 13:37
• @sunrise, let $Ly = y'' - y' + 3y.$ can you compute $L(x62), L(x), L(1)?$
– abel
Apr 27, 2015 at 14:00
• I have understood: the problem is that I don't know the method of undetermined coefficients. I only know the variation of constants method. I have searched something on the net, but I have only found the rules to follow, but not the reason why I can use them... In particular, I haven't understood why $y''+ay'+by=f$ admit, as particular solution, $z=ax^2+bx+c$... To establish this rule, have they guessed and found that this relation is always valid? Are there any other reasons? Apr 27, 2015 at 14:31
• @LutzL I'm sorry, I haven't understood what you mean.. Apr 27, 2015 at 14:35

The rule for undetermined coefficients is rather simple, if the assumptions for it are satisfied. First, the linear differential equation $L(y)=f$ needs to have constant coefficients.

Then, the right hand side or inhomogeneity $f$ needs to be a sum of terms where each term is a product of a polynomial and an exponential. The case polynomial times exponential times sine or cosine falls also under this pattern, since $\cos(w·x)=(e^{iwx}+e^{-iwx})/2$ etc.

For each of the term one may compute a trial solution separately and add all of them up in the end to get the particular solution.

For each term $p(x)·e^{\lambda x}$ one uses the trial function $y=x^m·q(x)·e^{λx}$ where $m$ is the multiplicity of $λ$ as root of the characteristic polynomial of $L$ and $\deg q=\deg p$. The coefficients of $q$ are the unknown parameters that have to be computed from $$L(x^m·q(x)·e^{λx})=p(x)·e^{λx}.$$