Solving non-autonomous system of differential equations Given the following 2x2 system of differential equations,
$\begin{cases} \dot{x} = 4x-y \\ \dot{y} = 2x+y \end{cases}$
A solution is easy to fins by computing eigenvalues and eigenvectors of the associated matrix A
$A = \begin{bmatrix} 4 & -1 \\ 2 & 1 \end{bmatrix}$.
Therefore, knowing that eigenvalues are 2 and 3, and the related eigenvectors are $\begin{bmatrix} 1 \\ 2 \end{bmatrix}$ and $\begin{bmatrix} 1 \\ 1 \end{bmatrix}$ respectively, the solution is of the form
$Ae^{2t}\begin{bmatrix} 1 \\ 2 \end{bmatrix}+Be^{3t}\begin{bmatrix} 1 \\ 1 \end{bmatrix}$.
What about if I make the initial system of equations non-autonomous? Resulting in something as follows
$\begin{cases} \dot{x} = 4x-y \\ \dot{y} = 2x+y +f(t) \end{cases}$
where f(t) can be either a polynomial on t, an exponential ($e^{at}$) or a trigonometric function ($sin(at)$ or $cos(at)$).
What is now the procedure to follow this system of differential equations? For example, let $f(t)=t^2$.
How do I solve the following system of differential equations?
$\begin{cases} \dot{x} = 4x-y \\ \dot{y} = 2x+y+t^2 \end{cases}$
 A: $$\begin{cases} x' = 4x-y \\ {y'} = 2x+y +f(t) \end{cases}$$
Note that if you substract both DE you have:
$$x'-y' =2(x-y) -f(t) $$
$$u' -2u= -f(t) $$
$$(u(t)e^{-2t})'= -e^{-2t}f(t) $$
$$u(t)e^{-2t}= -\int e^{-2t}f(t) \,dt $$
Where $u(t)=x-y$.
$$x(t)=y(t)-e^{2t}\int e^{-2t}f(t) \,dt $$
Plug this in the second equation and solve.

Continuing from your result of integration in the comment:
$$u(t)=\frac{1}{4}(2t^2+2t+1)+Ce^{2t}$$
$$x-y=\frac{1}{4}(2t^2+2t+1)+Ce^{2t}$$
We have the first differential equation:
$$x'=4x-y$$
$$x'-4x=-x+\frac{1}{4}(2t^2+2t+1)+Ce^{2t}$$
$$x'-3x=\frac{1}{4}(2t^2+2t+1)+Ce^{2t}$$
$$(xe^{-3t})'=e^{-3t}\frac{1}{4}(2t^2+2t+1)+Ce^{-t}$$
Integrate. Don't forget the second constant of integration.
A: You can express your non$-$autonomous  differential equation in the form $$\frac{d\vec{x}}{dt}-A\vec{x}=\vec{f}(t)$$ where $\vec{x}=\big(\begin{smallmatrix} x \\ y  \end{smallmatrix}\big)$, $A=\big(\begin{smallmatrix} 4 & -1\\ 2 & 1 \end{smallmatrix}\big)$, and $f(t)=\big(\begin{smallmatrix} 0 \\ t^2  \end{smallmatrix}\big)$. It turns out that $$\vec{x}=e^{At}\int e^{-At}f(t)dt$$ just as you might expect!
