# Summary for second order differential equations with constant coefficients

In this article, I will consider the second order differential equations $$y^{\prime\prime}+p y’+q y=f(x)$$, where $$p,q$$ are constants.

We have the general theories for non-homogeneous second order differential equations. That is , if $$y_h$$ is the general solution for $$y^{\prime\prime}+p(x) y’+q(x) y=0$$ and $$y_p$$ is one (special) solution for equation $$y^{\prime\prime}+p(x) y’+q(x) y=f(x)$$. Then the general solution for $$y^{\prime\prime}+p(x) y’+q(x) y=f(x)$$ is $$y=y_h+y_p$$

Case 1: $$f(x)=0$$, i.e the homogeneous equation. First we need to solve its characteristic equation:
$r^2+pr+q=0$
There are three cases:

• If $$r_1\ne r_2$$ are real, the general solution is $y=C_1e^{r_1x}+C_2e^{r_2x}$
• If $$r_1= r_2$$ is a repeat root. Then $y=(C_1+C_2x)e^{rx}$
• If $$r_{1,2}=\alpha\pm i\beta$$ are complex roots. Then$y=e^{\alpha x}(C_1\cos(\beta x)+C_2\sin(\beta x))$

Case2: $$f(x)=P_m(x)e^{ax}$$, where $$P_m(x)$$ is a polynomial of order $$m$$. In this case, there are three cases:

• If $$a$$ is not a root for the characteristic equation $$r^2+pr+q=0$$. Then we can choose$y_p=Q_m(x)e^{ax}$
where $$Q_m(x)=a_m x^m+a_{m-1}x^{m-1}+\cdots+a_1x+a_0$$ is another polynomial of order $$m$$. Then we insert $$y_p$$ into the differential equation to find $$Q_m(x)$$
• If $$a$$ is a single root for the characteristic equation $$r^2+pr+q=0$$. Then we can choose$y_p=xQ_m(x)e^{ax}$
• If $$a$$ is a repeat root for the characteristic equation $$r^2+pr+q=0$$. We choose$y_p=x^2Q_m(x)e^{ax}$

Case 2: $$f(x)=P_m(x)e^{\alpha x}\cos(\beta x)$$ or $$f(x)=P_m(x)e^{\alpha x}\sin(\beta x)$$. where $$P_m(x)$$is a polynomial of order $$m$$. There are two cases:

• If $$\alpha+i\beta$$ is not a root for the characteristic equation $$r^2+pr+q=0$$. Then we choose$y_p=e^{\alpha x}(C_1Q_m(x)\sin(\beta x)+C_2R_m{x}\cos{\beta x}),$ where both $$Q_m(x)$$ and $$R_m(x)$$ are polynomial of order $$m$$.
• If $$\alpha+i\beta$$ is a root for the characteristic equation $$r^2+pr+q=0$$. We choose$y_p=e^{\alpha x}(C_1Q_m(x)\sin(\beta x)+C_2R_m{x}\cos{\beta x}).$

Let us see an example:

Example 1: Find the general solution of
$y^{\prime\prime}-y’-2y=2e^{-x}$
Solution: The characteristic equation is
$r^2-r-2=0.$
Its roots are $$r_1=-1, r_2=2$$. So the general solution for the homogeneous equation is
$y_h=C_1e^{-x}+C_2e^{2x}.$

Next, we will find a special solution for the non-homogeneous equation. Here we know$$a=-1, P_m(x)=2$$. $$P_m(x)$$ is a polynomial of order $$0$$ and $$a=-1$$ is a single root of characteristic equation. So we assume $y_p=Axe^{-x}.$
Insert it to the equation
$y^{\prime\prime}_p-y_p’-2y_p=2e^{-x}$
we got
$-3Ae^{-x}=2e^{-x}.$
Hence $$A=-\frac{2}{3}$$. Therefor $$y_p=-\frac{2}{3}xe^{-x}$$. So the general solution for the original equation is
$y=C_1e^{-x}+C_2e^{2x}-\frac{2}{3}xe^{-x}$