solving second order non-homogeneous differential equation 4 please help me to answer this differential equation :
$
y''-2y'+2y= \cos(t)
$
$
y(0)=1,y'(0)=0
$
I tried to solve this by assuming $r^{2}-2r+2=0$ but it ended up to minus $\Delta$ which wasn't problem to me until I reached to particular solution and $u_{1}=\int{-\sin x \cos x}$

I try to solve particular solution by variation of parameter

 A: Hint: You can try 
$$A\cos t+B\sin t$$ 
for your particular solution, because your right hand side is $\cos t$. 
Edit: I think you know how to solve the homogeneous equation to get the complementary solution $y_c$. The general solution for this ODE is then $y=y_c+y_p$, where $y_p$ is a particular solution. When the right hand side is $\cos at$ or $\sin at$, you can use $A\cos at+B\sin at$ as a trial solution and determine the coefficients $A,B$. 
To do that, you let $y_p=A\cos t+B\sin t$. Find $y_p'', y_p'$ and plug all these into the original equation. Then equate the coefficients of $\cos t$ and $\sin t$. From this, you can solve for $A,B$ and find your $y_p$.
Edit2: Variation of parameters can also be used, but is much more complicated. The homogeneous solution turns out to be $c_1 e^x\cos x+c_2e^x \sin x$. So we should let 
$$y=u_1 e^x\cos x+u_2e^x \sin x$$
Setting up system of equations we will get
$$u_1'=-e^{-x}\sin x\cos x\\
u_2'=e^{-x}\cos^2 x$$
You then need to use integration by parts to solve for $u_1,u_2$.
A: First, let's work with the homogeneous case:  
$y^{''}-2y^{'}+2y=0$
$P(r)=r^{2}-2r+2=0$ $\hspace{20 mm}$ $r=1\pm{i}$
So, the homogeneous solution for this second order DE is:
$y_{h}=c_{1}e^{(1+i)t}+c_{2}e^{(1-i)t}=e^{t}(c_{1}cos(t)+c_{2}sin(t))$
Second, let's find a particular solution for the non-homogeneous case:
Let's complexify the non-homogeneous DE:
$z^{''}-2z^{'}+2z=e^{it}$
Using exponential response formula (ERF):
$P(i)=i^{2}-2i+2=1-2i$
The complex particular solution, $z_{p}$ is:
$z_{p}=\frac{e^{it}}{1-2i}=\frac{1}{5}e^{it}(1+2i)$
Now, we are interested in the real solution $y_{p}$
$y_{p}=Re(z_{p})=\frac{1}{5}(cos(t)-2sin(t))$
To find the general solution $y_{g}$:
$y_{g}=y_{h}+y_{p}=e^{t}(c_{1}cos(t)+c_{2}sin(t))+\frac{1}{5}(cos(t)-2sin(t))$
$y_{g}=c_{1}e^{t}cos(t)+c_{2}e^{t}sin(t)+\frac{1}{5}cos(t)-\frac{2}{5}sin(t))$
Finally, we will use the given initial conditions to find $c_{1}$ and $c_{2}$
$y(0)=c_{1}+\frac{1}{5}=1\hspace{20mm}$then$\hspace{20mm}c_{1}=\frac{4}{5}$
The first derivative $y^{'}$is:
$y^{'}=-c_{1}e^{t}sin(t)+c_{1}e^{t}cos(t)+c_{2}e^{t}cos(t)+c_{2}e^{t}sin(t)-\frac{1}{5}sin(t)-\frac{2}{5}cos(t))$
$y^{'}(0)=c_{1}+c_{2}-\frac{2}{5}=0\hspace{20mm}$then$\hspace{20mm}c_{2}=-\frac{2}{5}$
And the answer is:
$y=\frac{4}{5}e^{t}cos(t)-\frac{2}{5}e^{t}sin(t)+\frac{1}{5}cos(t)-\frac{2}{5}sin(t))$
