# University of Florida/Egm4313/s12.team11.imponenti/R3.8
## Problem 3.8

solved by Luca Imponenti

### Kreyszig 2011 pg.84 problem 5
#### Problem Statement

Find a (real) general solution. State which rule you are using. Show each step of your work.
       $y''+4y'+4y=e^{-x}cos(x)\!$

#### Homogeneous Solution

To find the homogeneous solution, $y_{h}\!$, we must find the roots of the equation
$\lambda ^{2}+4\lambda +4=0\!$
$(\lambda +2)(\lambda +2)=0\!$
$\lambda =-2\!$
We know the homogeneous solution for the case of a double root to be
$y_{h}=c_{1}e^{\lambda x}+c_{2}xe^{\lambda x}\!$
       $y_{h}=c_{1}e^{-2x}+c_{2}xe^{-2x}\!$

#### Particular Solution

We have the following excitation
       $r(x)=e^{-x}cos(x)\!$
From table 2.1, K 2011, pg. 82, we have
       $y_{p}(x)=e^{-x}[Kcos(x)+Msin(x)]\!$
Since this does not correspond to our homogeneous solution we can use the Basic Rule (a), K 2011, pg. 81 to solve for the particular solution
$y_{p}''+4y_{p}'+4y_{p}=r(x)\!$
where
$y_{p}'=e^{-x}[-Ksin(x)+Mcos(x)]-e^{-x}[Kcos(x)+Msin(x)]\!$
$y_{p}'=e^{-x}[-Ksin(x)+Mcos(x)-Kcos(x)-Msin(x)]\!$
and
$y_{p}''=e^{-x}[-Kcos(x)-Msin(x)+Ksin(x)-Mcos(x)]-e^{-x}[Ksin(x)+Mcos(x)-Kcos(x)-Msin(x)]\!$
$y_{p}''=e^{-x}[-Kcos(x)-Msin(x)+Ksin(x)-Mcos(x)+Ksin(x)-Mcos(x)+Kcos(x)+Msin(x)]\!$
$y_{p}''=e^{-x}[2Ksin(x)-2Mcos(x)]\!$
Plugging these equations back into the differential equation
$y_{p}''+4y_{p}'+4y_{p}=r(x)\!$
$e^{-x}[2Ksin(x)-2Mcos(x)]+4e^{-x}[-Ksin(x)+Mcos(x)-Kcos(x)-Msin(x)]+4e^{-x}[Kcos(x)+Msin(x)]=e^{-x}cos(x)\!$
$e^{-x}[2Ksin(x)-2Mcos(x)-4Ksin(x)+4Mcos(x)-4Kcos(x)-4Msin(x)+4Kcos(x)+4Msin(x)]=e^{-x}cos(x)\!$
$2Mcos(x)-2Ksin(x)=cos(x)\!$
from the above equation it is obvious that $K=0\!$ and $M={\frac {1}{2}}\!$
therefore the particular solution to the differential equation is
       $y_{p}(x)={\frac {1}{2}}e^{-x}sin(x)\!$

#### General Solution

The general solution will be the summation of the homogeneous and particular solutions
$y(x)=y_{h}(x)+y_{p}(x)\!$
$y(x)=c_{1}e^{-2x}+c_{2}xe^{-2x}+{\frac {1}{2}}e^{-x}sin(x)\!$
The coefficients $c_{1}\!$ and $c_{2}\!$ can be readily solved for given either initial conditions or boundary value conditions.

### Kreyszig 2011 pg.84 problem 6
#### Problem Statement

Find a (real) general solution. State which rule you are using. Show each step of your work.
       $y''+y'+(\pi ^{2}+{\frac {1}{4}})y=e^{-{\frac {x}{2}}}sin(\pi x)\!$

#### Homogeneous Solution

To find the homogeneous solution, $y_{h}\!$, we must find the roots of the equation
$\lambda ^{2}+\lambda +(\pi ^{2}+{\frac {1}{4}})=0\!$
$\lambda ={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}\!$ with $a=1,b=1,c=(\pi ^{2}+{\frac {1}{4}})\!$
$\lambda ={\frac {-1\pm {\sqrt {1^{2}-4*1*(\pi ^{2}+{\frac {1}{4}})}}}{2*1}}\!$
$\lambda =-\alpha \pm i\omega =-{\frac {1}{2}}\pm \pi i\!$
We know the homogeneous solution for the case of a double root to be
$y_{h}=e^{-\alpha x}[Acos(\omega x)+Bsin(\omega x)]\!$
       $y_{h}=e^{-{\frac {x}{2}}}[Acos(\pi x)+Bsin(\pi x)]\!$

#### Particular Solution

We have the following excitation
       $r(x)=e^{-{\frac {x}{2}}}sin(\pi x)\!$
From table 2.1, K 2011, pg. 82, we have
       $y_{p}(x)=e^{-{\frac {x}{2}}}[Kcos(\pi x)+Msin(\pi x)]\!$
Since this corresponds to our homogeneous solution we must use the Modification Rule (b), K 2011, pg. 81 to solve for the particular solution
so $y_{p}(x)=xe^{-{\frac {x}{2}}}[Kcos(\pi x)+Msin(\pi x)]\!$
differentiating
$y_{p}'=\pi xe^{-{\frac {x}{2}}}[-Ksin(\pi x)+Mcos(\pi x)]+(e^{\frac {x}{2}}-{\frac {1}{2}}xe^{-{\frac {x}{2}}})[Kcos(\pi x)+Msin(\pi x)]\!$
$y_{p}'=e^{-{\frac {x}{2}}}(\pi x[-Ksin(\pi x)+Mcos(\pi x)]+(1-{\frac {1}{2}}x)[Kcos(\pi x)+Msin(\pi x)])\!$
$y_{p}'=e^{-{\frac {x}{2}}}[-\pi xKsin(\pi x)+\pi xMcos(\pi x)+Kcos(\pi x)+Msin(\pi x)-{\frac {1}{2}}xKcos(\pi x)-{\frac {1}{2}}xMsin(\pi x)]\!$
and
$y_{p}''=e^{-{\frac {x}{2}}}[-\pi ^{2}xKcos(\pi x)-\pi Ksin(\pi x)-\pi ^{2}xMsin(\pi x)+\pi Mcos(\pi x)-\pi Ksin(\pi x)+\pi Mcos(\pi x)+{\frac {1}{2}}\pi xKsin(\pi x)-{\frac {1}{2}}Kcos(\pi x)-{\frac {1}{2}}\pi xMcos(\pi x)-{\frac {1}{2}}Msin(\pi x)]-{\frac {1}{2}}e^{-{\frac {x}{2}}}[-\pi xKsin(\pi x)+\pi xMcos(\pi x)+Kcos(\pi x)+Msin(\pi x)-{\frac {1}{2}}xKcos(\pi x)-{\frac {1}{2}}xMsin(\pi x)]\!$
$y_{p}''=e^{-{\frac {x}{2}}}[-\pi ^{2}xKcos(\pi x)-\pi Ksin(\pi x)-\pi ^{2}xMsin(\pi x)+\pi Mcos(\pi x)-\pi Ksin(\pi x)+\pi Mcos(\pi x)+{\frac {1}{2}}\pi xKsin(\pi x)-{\frac {1}{2}}Kcos(\pi x)-{\frac {1}{2}}\pi xMcos(\pi x)-{\frac {1}{2}}Msin(\pi x)+{\frac {1}{2}}\pi xKsin(\pi x)-{\frac {1}{2}}\pi xMcos(\pi x)-{\frac {1}{2}}Kcos(\pi x)-{\frac {1}{2}}Msin(\pi x)+{\frac {1}{4}}xKcos(\pi x)+{\frac {1}{4}}xMsin(\pi x)]\!$
grouping cosine and sine terms we get
$y_{p}''=e^{-{\frac {x}{2}}}[(2\pi M-\pi xM+({\frac {1}{4}}-\pi ^{2})xK-K)cos(\pi x)+(({\frac {1}{4}}-\pi ^{2})xM-M+\pi xK-2\pi K)sin(\pi x)]\!$
and
$y_{p}'=e^{-{\frac {x}{2}}}[(\pi xM+K-{\frac {1}{2}}xK)cos(\pi x)+(-\pi xK+M-{\frac {1}{2}}xM)sin(\pi x)]\!$
next we substitute the above equations into the ODE
$y_{p}''+y_{p}'+(\pi ^{2}+{\frac {1}{4}})y_{p}=r(x)\!$
$e^{-{\frac {x}{2}}}[(2\pi M-\pi xM+({\frac {1}{4}}-\pi ^{2})xK-K)cos(\pi x)+(({\frac {1}{4}}-\pi ^{2})xM-M+\pi xK-2\pi K)sin(\pi x)]+e^{-{\frac {x}{2}}}[(\pi xM+K-{\frac {1}{2}}xK)cos(\pi x)+(-\pi xK+M-{\frac {1}{2}}xM)sin(\pi x)]+(\pi ^{2}+{\frac {1}{4}})xe^{-{\frac {x}{2}}}[Kcos(\pi x)+Msin(\pi x)]=e^{-{\frac {x}{2}}}sin(\pi x)\!$
$e^{-{\frac {x}{2}}}[(2\pi M-\pi xM+({\frac {1}{4}}-\pi ^{2})xK-K)cos(\pi x)+(({\frac {1}{4}}-\pi ^{2})xM-M+\pi xK-2\pi K)sin(\pi x)+(\pi xM+K-{\frac {1}{2}}xK)cos(\pi x)+(-\pi xK+M-{\frac {1}{2}}xM)sin(\pi x)+(\pi ^{2}+{\frac {1}{4}})x(Kcos(\pi x)+Msin(\pi x))]=e^{-{\frac {x}{2}}}sin(\pi x)\!$
$e^{-{\frac {x}{2}}}[(2\pi M-\pi xM+({\frac {1}{4}}-\pi ^{2})xK-K+\pi xM+K-{\frac {1}{2}}xK+(\pi ^{2}+{\frac {1}{4}})xK)cos(\pi x)+(({\frac {1}{4}}-\pi ^{2})xM-M+\pi xK-2\pi K-\pi xK+M-{\frac {1}{2}}xM+(\pi ^{2}+{\frac {1}{4}})xM)sin(\pi x)]=e^{-{\frac {x}{2}}}sin(\pi x)\!$
$2\pi Mcos(\pi x)-2\pi Ksin(\pi x)=sin(\pi x)\!$
after cancelling terms; we can equate cosine and sine coefficients to get two equations
$2\pi M=0\!$
$-2\pi K=1\!$
so $M=0\!$ and $K=-{\frac {1}{2\pi }}\!$
and the particular solution to the ODE is
       $y_{p}(x)=-{\frac {1}{2\pi }}xe^{-{\frac {x}{2}}}cos(\pi x)\!$

#### General Solution

The general solution will be the summation of the homogeneous and particular solutions
$y=y_{h}+y_{p}\!$
$y=e^{-{\frac {x}{2}}}[Acos(\pi x)+Bsin(\pi x)]-{\frac {1}{2\pi }}xe^{-{\frac {x}{2}}}cos(\pi x)\!$
Egm4313.s12.team11.imponenti 04:28, 21 February 2012 (UTC)