Preamble
Consider a damped harmonic oscillator, with his well know differential equation
\begin{equation*}
m \ddot{x} + c \dot{x} + kx=0
\end{equation*}
and let's find the solution that satisfies $x(0)=x_0$ and $\dot{x} (0) = v_0$. The problem admit a lovely exact solution (exploiting the considerations I found in books, I derived the complete explicit solution I write below). We have three cases. In the particular case in which $c=2\sqrt{mk}$, we have
\begin{equation*}
x(t) = \left[ x_0 + \left( v_0 + x_0 \sqrt{\frac{k}{m}} \right) t \right] e^{- \sqrt{\frac{k}{m}} t}
\end{equation*}
Otherwise we have to consider separately the two cases $c \gtrless 2\sqrt{mk}$, and to don't make heavier equations we have to introduce this parameters (we can observe that $\alpha$ and $\beta$ are length and depend to initial conditions too, while $\gamma$ e $\xi$ are adimensional and depend only by physical characteristics of the system)
\begin{equation*}
\alpha \equiv \frac{x_0}{2} \qquad \beta \equiv \frac{m v_0}{c} \qquad \gamma \equiv \frac{4mk}{c^2} \qquad \xi \equiv \frac{ct}{2m}
\end{equation*}
In the case $c>2\sqrt{mk}$ (i.e. $\gamma<1$) we have
\begin{equation*}
\begin{split}
\displaystyle
x(t) = & \frac{ \alpha \left(\sqrt{1 – \gamma } + 1 \right) + \beta}{\sqrt{1 – \gamma }} \cdot \exp \left[ {\left({-1 + \sqrt{1 – \gamma}} \right) \cdot \xi} \right] +
\\ \displaystyle
&\frac{ \alpha \left(\sqrt{1 – \gamma } – 1 \right) – \beta}{\sqrt{1 – \gamma }} \cdot \exp \left[ {\left({-1 – \sqrt{1 – \gamma}} \right) \cdot \xi} \right]
\end{split}
\end{equation*}
While if $c<2\sqrt{mk}$ (i.e. $\gamma>1$) the solution is
\begin{equation*}
x(t) = 2 \alpha \cdot
\frac{{\sin \left[ \tan^{-1} \left( \frac{\sqrt{\gamma – 1}}{1+\frac{\beta}{\alpha}} \right) +
\sqrt{\gamma – 1} \cdot \xi
\right]}}
{\sin \left[ \tan^{-1} \left( \frac{\sqrt{\gamma – 1}}{1+\frac{\beta}{\alpha}} \right) \right]} \cdot {\exp(-\xi)}
\end{equation*}
Note that in this expressions, time dependence is included in $\xi$.
Question
Is it possible to do the same with the sinusoidal forced case? We have
\begin{equation*}
m \ddot{x} + c \dot{x} + kx= F \cos(\omega t + \phi)
\end{equation*}
but what is the solution of this differential equation that satisfies the condition $x(0)=x_0$ and $\dot{x} (0) = v_0$? I can't write it, even in the simpler case with $\phi = 0$.
Best Answer
You just need to find a particular solution of that equation, then general solution will be a linear combination of the particular solution and the general solution of the homogeneous differential equation. Well, let $\phi = 0$, to simplify.
Let a complex equation: $m\ddot z + c\dot z + kz = Fe^{i\omega t}$. Your equation is just the real part of this. If you make the substitution $z(t) = Ae^{i\omega t}$ in the differential equation, you will find the value of $A$.
Now you can write $A$ this way: $A = |A|e^{i\theta}$. Now your particular solution is just the real part of $z(t)$: $$ x_p(t) = |A|\cos(\omega t + \theta). $$
Therefore, you can have a particular solution explicity using the values of $|A|$ and $\theta$ you have found. Now, do a linear combination of the general solution, and plug the initial condition values for the initial position and initial velocity. Then you have the general solution you are looking for.