Solve \begin{cases} x'=2x+4y+\cos t\\ y'=-x-2y+\sin t \end{cases} Solve
\begin{cases}
x'=2x+4y+\cos t\\
y'=-x-2y+\sin t
\end{cases}
My solution:
First I solve :
\begin{cases}
x'=2x+4y\\
y'=-x-2y
\end{cases}
$$\begin{pmatrix} {x'}\\ {y'} 
 \end{pmatrix}=\begin{pmatrix} {2} & 4\\ {-1} & -2
 \end{pmatrix} \begin{pmatrix} {x}\\ {y} 
 \end{pmatrix}$$
The eigenvalue is $0$.
The eigevector is \begin{pmatrix} {-2}\\ {1} 
 \end{pmatrix}
The generalized eigenvector is \begin{pmatrix} {0}\\ -{1\over 2} 
 \end{pmatrix}
Then, the solution is:
$y=c_1\begin{pmatrix} {0}\\ {-1\over 2} 
 \end{pmatrix} + c_2 \bigg [t\begin{pmatrix} {-2}\\ {1} 
 \end{pmatrix}+\begin{pmatrix} {0}\\ {-1\over 2} 
 \end{pmatrix}\bigg]$
Using variation of parameters method:
$$\begin{pmatrix} {0} & -2t\\ {-1\over 2} & t- {1\over 2}
 \end{pmatrix} \begin{pmatrix} {c'_1}\\ {c'_2} 
 \end{pmatrix}=\begin{pmatrix} {\cos t}\\ {\sin t} 
 \end{pmatrix}$$
\begin{cases}
-2tc'_2=\cos t\\
-\frac{1}{2} c'_1+ (t- {1\over 2})c'_2=\sin t
\end{cases}
$c'_2=\frac{cos t}{ -2t} \implies c_2=\int \frac{\cos t}{-2t}$
I don't know how to solve it
Where am I wrong?
Thanks !
 A: The DE-system is given by
\begin{align*}
\underbrace{\frac{{\rm d}}{{\rm d}t}\begin{bmatrix} x(t)\\ y(t)\end{bmatrix}}_{X'(t)}=\underbrace{\begin{bmatrix} 2 & 4\\ -1 & -2\end{bmatrix}}_{A}\underbrace{\begin{bmatrix} x(t)\\ y(t) \end{bmatrix}}_{X(t)} +\underbrace{\begin{bmatrix} \cos t\\ \sin t\end{bmatrix}}_{F(t)}
\end{align*}

*

*Solve $X'(t)=AX(t)$:

Since
$$\det(A-\lambda I)=0 \implies \lambda=0$$
So we have $\lambda=0$ is an eigenvalue with algebraic multiplicity equals $2$, then
$$(A-0\cdot I)v=0 \implies v=\begin{bmatrix} -2\\ 1\end{bmatrix} \longleftarrow \quad \text{eigenvector}$$
and
$$(A-0\cdot I)u=v \implies u=\begin{bmatrix} -1\\ 0 \end{bmatrix} \longleftarrow \quad \text{ generalized eigenvector} $$
Hence
$$X_{1}(t)=\begin{bmatrix} -2\\ 1\end{bmatrix}e^{0\cdot t}=\color{red}{\begin{bmatrix} -2\\ 1\end{bmatrix}},\quad X_{2}(t)=\begin{bmatrix} -2\\ 1\end{bmatrix}te^{0\cdot t}+\begin{bmatrix} -1\\ 0\end{bmatrix}e^{0\cdot t}=\color{red}{\begin{bmatrix} -2\\ 1\end{bmatrix}t+\begin{bmatrix} -1\\ 0\end{bmatrix}}.$$
We get,
$$X(t)=c_{1}X_{1}(t)+c_{2}X_{2}(t)$$
$$\color{green}{X_{c}(t)=c_{1}\begin{bmatrix} -2\\ 1\end{bmatrix}+c_{2}\left(\begin{bmatrix} -2\\ 1\end{bmatrix}t+\begin{bmatrix} -1\\ 0\end{bmatrix} \right)}.$$

*

*Solve $X'(t)=AX(t)+F(t)$:

By variation of paramters,
$$\color{blue}{X_{p}(t)=\Phi(t)\int \Phi^{-1}(t)F(t){\rm d}t},$$
where
$$\Phi(t)=\begin{bmatrix}-2 & -2t-1\\ 1 & t \end{bmatrix},\quad \Phi^{-1}(t)=\begin{bmatrix} \frac{t}{2} & t+1\\ -\frac{1}{2} & -1\end{bmatrix}.$$
Hence,
\begin{align*}
X_{p}(t)&=\begin{bmatrix}-2 & -2t-1\\ 1 & t \end{bmatrix}\int \begin{bmatrix} \frac{t}{2} & t+1\\ -\frac{1}{2} & -1\end{bmatrix}\begin{bmatrix} \cos t\\ \sin t\end{bmatrix}{\rm d}t,\\
&=\begin{bmatrix}-2 & -2t-1\\ 1 & t \end{bmatrix}\int \begin{bmatrix}\frac{t}{2}\cos t+(t+1)\sin t\\ -\frac{1}{2}\sin t-\sin t \end{bmatrix} {\rm d}t\\
&=\begin{bmatrix}-2 & -2t-1\\ 1 & t \end{bmatrix}\begin{bmatrix}\left(\frac{2+t}{2}\right)\sin t-(1+2t)\cos t\\ \frac{3}{2}\cos t  \end{bmatrix}\\
&=\begin{bmatrix}-2\left[\left(\frac{2+t}{2}\right)\sin t-(1+2t)\cos t \right] +(-2t-1)\left[\frac{3}{2}\cos t \right]\\ 1\left[\left(\frac{2+t}{2}\right)\sin t-(1+2t)\cos t \right]+t\left[\frac{3}{2}\cos t \right]\end{bmatrix} 
\end{align*}
Hence,
$$\color{green}{X_{p}(t)=\begin{bmatrix}-2\left[\left(\frac{2+t}{2}\right)\sin t-(1+2t)\cos t \right] +(-2t-1)\left[\frac{3}{2}\cos t \right]\\ 1\left[\left(\frac{2+t}{2}\right)\sin t-(1+2t)\cos t \right]+t\left[\frac{3}{2}\cos t \right]\end{bmatrix}}$$

*

*Solution
$$\color{green}{X(t)=X_{c}(t)+X_{p}(t),\quad -\infty<t<+\infty}$$
A: $$\begin{cases}
x'=2x+4y+\cos t\\
y'=-x-2y+\sin t
\end{cases}$$
It's easier to add both equations:
$$x'+2y'=\cos t +2 \sin t$$
$$x+2y=\sin t -2 \cos t +C_1$$
$$
\begin{cases}
x(t)&=-2y+\sin t -2 \cos t +C_1 \\
x'(t)&=-2y'+\cos t +2 \sin t
\end{cases}
$$
$$x'-2x=4y + \cos t$$
$$ y'=2\cos t -C_1$$
$$\implies y(t)=2\sin t -C_1t+C_2$$
