Help to find the solution of $y' = \begin{pmatrix}-2 & 1 \\1 &-2\end{pmatrix} \cdot y + \begin{pmatrix}2\sin(t) \\ 2(\cos(t) - \sin(t))\end{pmatrix}$ I'm currently studying a course on numerical solutions of ODEs and I've been given this system of differential equations:
$$y'  = \begin{pmatrix}-2 & 1 \\ 1 &-2\end{pmatrix} \cdot y + \begin{pmatrix}2\sin(t) \\ 2(\cos(t) - \sin(t))\end{pmatrix}$$
Of course the derivatives are in time $t$, so $y' = [ dy_1/dt ; \; dy_2/dt]$ where $y_1, y_2$ are the two components of the $2$d vector $y$.
I've implemented all the methods to solve it numerically but the question is to study the errors of those methods, and the only way to do so is comparing the numerical solution towards the exact solution of the system.
Here is my question:

can anyone help me solving this system of equations please? Since I've been studying numerical analysis for a while I'm a bit rusted on this abstract things..

 A: Homogeneous Portion
The homogeneous part of $y$, given by $y_h(t)$, solves the following system:
$$y_h' = \begin{pmatrix} -2 & 1 \\ 1 & -2 \end{pmatrix}y_h.$$
The above system can be solved directly by looking at the eigenvalue of the matrix $\begin{pmatrix} -2 & 1 \\ 1 & -2 \end{pmatrix}$. One can check that the eigenvalues are given by $-1$ and $-3$. This yields
$$y_h(t) = e^{-t}v_1 + e^{-3t}v_2$$
where $v_1$ and $v_2$ are arbitrary vectors in $\mathbb{R}^2$ (am assuming that is what you are working with) to be determined by providing the relevant initial data.
Inhomogeneous Portion
One can check that a particular solution $y_p(t)$ is given by
$$y_p(t) = \begin{pmatrix} \sin(t) \\ \cos(t) \end{pmatrix}.$$
(Remark: One way you could have known this is to guess that $y_p(t) = \begin{pmatrix} A \sin(t) + B \cos(t) \\ C \sin(t) + D\cos (t)\end{pmatrix}$ and solve for $A,B,C,$ and $D$.)
This gives
$$\begin{aligned} y(t) &= y_h(t) + y_p(t) \\ &= \boxed{e^{-t}v_1 + e^{-3t}v_2 + \begin{pmatrix} \sin(t) \\ \cos(t) \end{pmatrix}}. \end{aligned}$$
A: This kind of matrix structure has some very simple eigenvectors. In general for circulant matrices one can use a Fourier basis.
Here consider $u_1=y_1+y_2$ and $u_2=y_1-y_2$ to get the decoupled system of scalar equations
\begin{align}
u_1'&=-u_1+2\cos(t)\\
u_2'&=3u_2+4\sin(t)-2\cos(t).
\end{align}
These you should be able to solve with your previous experiences. Reconstructing $y_1,y_2$ from their solutions is then a trivial step.
