Question : Find analytical solution of ode \[y’+2y=e^(-4t)+cos(2pit)\] such that y(0)=1
Solution :
Given differential equation
\[y^\prime+2y=e^{-4t}+\cos{\left(2\pi t\right)},y\left(0\right)=1\] (1)
This equation can be written in the form \[y^\prime+P\left(t\right)y=Q\left(t\right)\]Which is Linear ODE of first order whose general solution is written as
\[y\left(t\right)u\left(t\right)=\int Q\left(t\right)u\left(t\right)dt+c \]Where u(t) is integrating factor \[u\left(t\right)=e^{\int P\left(t\right)dt}=e^{\int2dt}=e^{2t}\]Therefore general solution of equation (1) is
\[y\left(t\right)e^{2t}=\int\left(e^{-4t}+\cos{\left(2\pi t\right)}\right)e^{2t}dt\]\[y\left(t\right)e^{2t}=\int e^{\left(2-4\right)t}dt+\int e^{2t}\cos{\left(2\pi t\right)}dt\]
\[y\left(t\right)e^{2t}=-\frac{e^{-2t}}{2}+\frac{e^{2t}\left(2\cos{\left(2\pi t\right)}+2\pisin\left(2\pi t\right)\right)}{2^2+\left(2\pi\right)^2}+c\]
\[y\left(t\right)e^{2t}=-\frac{e^{-2t}}{2}+\frac{e^{2t}\left(2\cos{\left(2\pi t\right)}+2\pisin\left(2\pi t\right)\right)}{4+4\pi^2}+c\]
Dividing by e^(2t) both sides, we get
\[y\left(t\right)=-\frac{e^{-4t}}{2}+\frac{2\cos{\left(2\pi t\right)}+2\pisin\left(2\pi t\right)}{4+4\pi^2}+ce^{-2t}\] (2)
Now substituting initial condition y\left(0\right)=1
\[1=-\frac{1}{2}+\frac{2}{4+4\pi^2}+c\]\[c=\frac{3}{2}-\frac{1}{2\left(1+\pi^2\right)}\]substituting in eqn (2)
Analytical solution of the eqn (1) becomes
y\left(t\right)=-\frac{e^{-4t}}{2}+\frac{2\cos{\left(2\pi t\right)}+2\pisin\left(2\pi t\right)}{4+4\pi^2}+e^{-2t}\left(\frac{3}{2}-\frac{1}{2\left(1+\pi^2\right)}\right)