Answer
The solution of the initial value problem is $y=te^{2t}+2e^{2t}$.
Work Step by Step
By, comparing the differential equation with the linear form $y'+P(t)y=Q(t)$
We get, $P(t)=-2$
Thus, the integrating factor $u(t)=e^{\int -2\, dt}$
$\implies u(t)=e^{-2t+c}=e^{-2t}e^c$
Now multiply the equation by $u(t)$ on both sides.
We get, $e^{-2t}e^cy'-2e^{-2t}e^cy=e^{-2t}e^c\cdot e^{2t}$
Now integrate on both sides
We get, $ e^{-2t}y=\int e^{-2t}\cdot e^{2t}\,dt$
Now simplify as follows;
$ e^{-2t}y=\int 1\,dt$
$\implies e^{-2t}y=t+c$
Substitute the initial condition $y(0)=2$
We get, $e^{0}2=0+c$
$\implies c=2$
Hence, the solution of the initial value problem is $y=te^{2t}+2e^{2t}$.