I have the following equations:
$$ y_1'(t)=4y_1(t)-y_2(t)+f_1(t) $$ $$ y_2'(t)=2y_1(t)+2y_2(t)+f_2(t) $$ where:
$$f_1(t)=\frac{e^{4t}\cos{t}}{e^{2t}+1}$$
$$f_2(t)=\frac{e^{4t}(\cos{t}+\sin{t})}{e^{2t}+1}$$
$$y_1(0)=y_2(0)=\frac{\pi}{4}$$
I tried to solve it like this:
$y_2 = 4y_1 -y_1' -f_1 $
$ y_2' = 4y_1' -y_1'' -f_1'$
then I got that:
$4y_1' -y_1'' -f_1' = 2y_1 +2\cdot(4y_1-y_1'-f_1) +f_2$
and from here I got that:
$y_1''-6y_1' +10y_1 = 2f_1 -f_1' -f_2$
where $$ f_1'(t)=\frac{(e^{2t}+1)(-\sin{t}\cdot e^{4t}+4\cos{t} \cdot e^{4t})-\cos{t}\cdot e^{4t} \cdot 2 e^{2t}}{(e^{2t}+1)^2}$$
and from here I got that:
$2f_1(t) - f_1'(t) -f_2(t) = \frac{2\cos{t} \cdot e^{4t} \cdot (e^{2t}+1) + (e^{4t}\sin{t} -4e^{4t}\cos{t})\cdot(e^{2t}+1)+\cos{t}\cdot e^{4t} \cdot 2 e^{2t}-e^{4t}\cdot(e^{2t}+1)\cdot(\cos{t}+\sin{t})}{(e^{2t}+1)^2}$
and from here I got that:
$$y_1''-6y_1' +10y_1 = -\frac{e^{4t}\cdot\cos{t}\cdot(e^{2t}+3)}{(e^{2t}+1)^2}$$
and this is where I got stuck. Am I on the right path? If yes, how do you I continue from here? if no, how else should I solve this?
Thanks!
I don't think you're doing it in quite the right way. You can express it in matrix form. The methods for linear second order constant coefficient differential equations that you tried to use are analogous to those used for systems of first order linear differential equations (your case), but aren't quite the same. You start by writing your system
$$\mathbf{y}' = A\mathbf{y} + \mathbf{f}(t)$$
where $$\begin{align} A &= \left(\begin{array}{rr}4&-1\\2&2 \end{array}\right)\\ \mathbf{f}(t) &= \left(\begin{array}{cc} \frac{e^{4t}\cos{t}}{e^{2t}+1}\\ \frac{e^{4t}(\cos{t}+\sin{t})}{e^{2t}+1} \end{array}\right) \end{align}$$
This is an inhomogeneous equation, because $\mathbf{f}(t) \neq \mathbf{0}$. However you can use the principle of superposition: i.e. find the general solution of the homogeneous equation $\mathbf{y}' = A\mathbf{y}$ and find a particular integral $\mathbf{p}(t)$ that satisfies the inhomogeneous equation, and add them together to get the general solution to your inhomogeneous equation.
The solutions to the homogeneous equation are given by the eigenvalues $\lambda_1$ and $\lambda_2$ and eigenvectors $\mathbf{v}_1, \mathbf{v}_2$ of $A$. The general solution to the homogeneous equation, known as the complementary function, is
$$ \mathbf{y} = C_1\mathbf{v}_1e^{\lambda_1t} + C_2\mathbf{v}_2e^{\lambda_2t} $$
where $C_1,C_2$ are arbitrary complex constants.
In your case the eigenvalues are complex: $3 \pm i$. To restrict yourself to real solutions you need to do some trickery, which (because the constants can be complex) comes down to looking at just one eigenvector and eigenvalue, applying Euler's equation $e^{i\theta} = \cos\theta + i\sin\theta$ to convert the exponentials to trigonometric functions, and then doing the algebra to separate out the real and imaginary parts. You can then write the general solution to the homogeneous equation as: $$ \mathbf{y} = C_1\mathrm{Re}(\mathbf{v}_1e^{\lambda_1t}) + C_2\mathrm{Im}(\mathbf{v}_1e^{\lambda_1t}) $$ where $C_1,C_2$ are real.
Armed with a general solution, you would then look for a particular integral. I agree with the other answer that this isn't at all obvious, because of the complexity of $\mathbf{f}(t)$. As the other answer said, your best bet is to try to find a $\mathbf{f}$ in a similar form. I would just try some things out and try to get a feel for what the particular integral might be.
Overall, this is a complex subject that can only be introduced in this answer. You could search for "solving systems of first order linear differential equations" on the web: Pauls Online Notes seem very good. It will also be covered in plenty of textbooks.