How can $F_0\cos\omega t$ change to $F_0e^{i\omega t}$ in driven oscillator equation? I have one thing that confuses me on deriving the solution for the Linear Forced Oscillator.
Suppose we have the equation as $$ma + rv + kx = F_0 \cos \omega t$$
What confuses me is when the driving force, $F_0 \cos \omega t$, is changed to the complex form, $F_0 e^{i\omega t}$. 
I understand that $e^{i\omega t}$ comes from Euler's identity, $e^{i\theta} = \cos\theta + i\sin\theta\;.$
However, how can  $F_0 \cos \omega t$ solely by itself change to $F_0 e^{i\omega t}\;?$ 
When the driving force is changed to the $e^{i \omega t}$ form, don't we need to satisfy the Euler identity?  
Also, how can the solution of $x$ be $ Ae^{i\omega t},$ I don't quite understand  this.
 A: This is a common trick used in linear differential equations with an inhomogeneous driving term. It's easier to algebraically manipulate complex exponentials than sines and cosines, and if you take the real part of the solution at the end, you end up at the same place anyway. One way to think of it is that by replacing the real-valued functions with complex-valued functions you're in effect solving two equation at once (one for the real part and one for the imaginary part). Because the solution is linear in x, the two parts of the equation don't interfere with each other, and both end up being valid solutions.
Here's a bit more detail about how it works out:
$$\cos(\omega t)=\textrm{Re}\left(e^{i\omega t}\right)$$
$$\sin(\omega t)=\textrm{Re}\left(-ie^{i\omega t}\right)$$
where $Re$ indicates taking the real part.
Since this is a linear ordinary differential equation with a harmonic driving term, the general solution is a sum of $\cos(\omega t)$ and $\sin(\omega t)$, which can also be expressed as:
$$x=x_0\cos(\omega t+\phi)$$ for some real-valued phase $\phi$.
And basic calculus gives us the velocity and acceleration as well:
$$v=-x_0\omega \sin(\omega t+\phi)$$
$$a=-x_0\omega^2\cos(\omega t+\phi)$$
Now, at this point we could plug all of these in and do some fairly messy algebra to match sine and cosine terms and thus solve for $x_0$ and $\phi$. But there's another way. Suppose instead we define $x_0'=x_0e^{i\phi}$, a complex constant. Then we can rewrite all of this as:
$$x=x_0\cos(\omega t+\phi)=\textrm{Re}(x_0e^{i\omega t+i\phi})=\textrm{Re}(x_0'e^{i\omega t})$$
Similarly,
$$v=\textrm{Re}(i\omega x_0'e^{i\omega t})$$
$$a=\textrm{Re}(-\omega^2x_0'e^{i\omega t})$$
$$F=\textrm{Re}(F_0e^{i\omega t})$$
and, assuming the other parameters in the equation are real numbers, the entire equation can be expressed as:
$$\textrm{Re}(((-m\omega^2+i\omega r+s)x_0'-F_0)e^{i\omega t})=0$$
This has to be true for all points in time, so we can conclude:
$$(-m\omega^2+i\omega r+s)x_0'-F_0=0$$
And this gives us the complex amplitude $x_0'$ that solves the equation. The differential equation with trig functions has been turned into a simple algebra equation with no trig functions at all! This is such a nice simplification that it's done pretty much universally. If you're curious as to how it's used in practice, I invite you to read up on the topic of impedance in electrical engineering.
Notice that, as a bonus, we also solved this equation:
$$\textrm{Im}\left(((-m\omega^2+i\omega r+s)x_0'-F_0)e^{i\omega t}\right)=0$$
or in other words, the imaginary part is zero as well. You can go back and verify this, but basically this is what you would have ended up with if you'd chosen to drive it with a sine wave instead of a cosine wave (apart from some minus signs than end up being inconsequential; you can slightly redefine things so you end up with the same physics at the end) and if all the definitions above used $\rm{Im}$ instead of $Re$.
When people get used to this trick, they do it implicitly, never bothering to write down the $Re$ operator. It's understood that, at the end, you'll take the real part to get the actual physical solution. The above algebra shows why you can get away with this.
As an exercise, you might try going through this derivation again but with an $x^2$ term added to the equation. It doesn't work out nearly so neatly! If the $x^2$ term is small, you can treat it as a perturbation that generates a small additional effect that oscillates at $2\omega$ to first order. This is called non-linear second harmonic generation and is very often used in laser systems.
A: The equation of motion for a driven oscillator is
$$m\ddot{x}+r\dot{x}+kx-F_0 \cos\omega t =0 $$
It can be rewritten as
$$ \textrm{Re}\left[m\ddot{x}+r\dot{x}+kx-F_0 e^{i\omega t}\right]=0$$
The idea is to solve the complexified equation (because it is easier), then take the real part to get a desired solution for the original equation. 

Also, how can we make a solution of $x$ to be $x=Ae^{i\omega t}$, I quietly don't understand this.

Recall that the full solution of ODE is $x=x_0+x_t$, where $x_0$ is the solution of the homogeneous ODE, in your case
$$m\ddot{x}_0+r\dot{x}_0+kx_0=0 $$
and $x_t$ is a particular solution of non--homogeneous ODE:
$$m\ddot{x}_t+r\dot{x}_t+kx_t=F_0 e^{i \omega t} $$
To find $x_t$ we make a guess $x_t=A e^{i\omega t}$.
A: TL;DR:
The use of exponential function has profuse advantages over trigonometric function. It presents a lot more intuitive visualisation of the phenomenon against the petty trigonometrical functions. It is far more easier to solve differential equations using exponential function than using the conventional trigonometric functions. However, you only should extract the real counterpart of $e^{i\theta}$ for the physical phenomenon.
Introduction:
Suppose you are defining SHM in $x$-axis; as we know SHM is the geometric projection of circular motion, we can imagine the SHM as the shadow - the projection of a body undergoing circular motion and represent the SHM as:
$$x= A\cos(\omega t+\alpha)$$ where $A$ is the radius of the circular path and also the amplitude of SHM in $x$-axis.
However, there is also a projection of this circular motion on the $y$-axis and this implies at $y$-axis, there is also going SHM represented by $$y= A\sin(\omega t+\alpha)\;.$$
But we do know this motion along $y$ has no actual existence; however, we can proceed as if we were dealing with the motion of a point in two dimensions. Nevertheless, at the end, we only extract the $x$-component only from this two-dimensional motion as this is actually the motion existing.
We need to represent this two-dimensional motion such that we can easily distinguish between the physically real and imaginary components of the motion.
Two-dimensional motion and use of Complex numbers to distinguish the real motion from the unreal:
The two-dimensional motion is expressed as:
$$\mathbf r= A\cos(\omega t+\alpha)\mathbf{\hat{i}}+ A\sin(\omega t+\alpha)\mathbf{\hat{j}}\;.$$ In order to reflect the fact that the $\bf {\hat i}$ component is the real-motion, we modify the former equation as $$\mathbf r= x\mathbf{\hat{i}}+ \color{red}{\iota} y\mathbf{\hat j}\;_;$$ inclusion of $\color{red}{\iota}$ reflects the fact that the motion in $\bf{\hat j}$ is unreal or imaginary.
Or, more formally, we can write $$\mathbf r= x+ \color{red}{\iota} y$$ provided $x$ represents the displacement in a direction parallel to $\bf {\hat i}\;.$
Interpretation of $\color{red}{\iota}$:
As A.P.French in his book writes:

The term $\color{red}{\iota} y$ is to be read as an instruction to make the displacement $y$ in a direction parallel to $y$-axis.

$\color{red}{\iota}$ is an instruction to perform an anti-clockwise rotation of $90^\circ$ upon whatever it precedes.


*

*To form the quantity $\color{red}{\iota}b_,$ we step off a distance $b$ along the $x$-axis and then rotate through $90^\circ$ as to end up with a displacement of length $b$ along $\bf{\hat j}\;.$


*To form the quantity $\color{red}{\iota}^2 b_,$ we first form $\color{red}{\iota}b$ and then apply to it a further $90^\circ$ rotation. ... But this at once leads to an important identity. Two successive $90^\circ$ rotations in the same sense convert a displacement $b$ into the displacement $-b\;.$

Hence, $\color{red}{\iota}^2 = -1\;.$ Thus we can represent the vector as $z= x+ \color{red}{\iota}y$ where $x= A\cos(\omega t+\alpha)\mathbf{\hat{i}}$ and $y=  A\sin(\omega t+\alpha)\mathbf{\hat j}\;.$
The complex exponential:
Let's take the case of circular motion whose radius is unity viz. $A= 1\;.$ Therefore, $$\mathbf r= \cos(\omega t+\alpha)+ \color{red}{\iota}\sin(\omega t+\alpha)\;.$$
Using Taylor series, we can see that $$\mathbf r= \cos(\omega t+\alpha)+ \color{red}{\iota}\sin(\omega t+\alpha)= e^{\color{red}{\iota}(\omega t+\alpha)}\;.$$

The multiplication of $e^{\color{red}{\iota}\theta}$ is describable, in geometrical terms, as a positive rotation, through an angle $\theta$, of the vector by which $z$ may be represented without any alteration of its length.

Why use $\color{red}{\iota}\;?$
Why should I use exponential function? Can't I only use those trigonometrical functions?
Well, everything has a reason.
As A.P.French asserts:

The prime reason is the special property of the exponential function-its reappearance after every operation of differentiation or integration. If, as often happens, the basic equation of motion contains terms proportional to to velocity and acceleration, as well as to the displacement itself, the use of a simple trigonometric function to describe the motion leads to an awkward mixture of sine and cosine terms.

Also you can check: What is the advantage of using exponential function over trigonometric function in analyzing waves?
Application:
Using Trigonometrical functions:
$$\ddot{x} + \nu \dot x + \omega_0^2 x= 0$$
Let's take $x= Ae^{-\gamma t/2} \cos(\omega t +\alpha)$
$$\dot x= (-\gamma /2)Ae^{-\gamma t/2} \cos(\omega t +\alpha) - \omega Ae^{-\gamma t/2} \sin(\omega t +\alpha)$$ \begin{align}\ddot x&= (-\gamma /2)^2 Ae^{-\gamma t/2} \cos(\omega t +\alpha) + (\gamma \omega /2)Ae^{-\gamma t/2} \sin(\omega t +\alpha) - \omega^2 Ae^{-\gamma t/2} \cos(\omega t +\alpha)+ (\gamma\omega/2) Ae^{-\gamma t/2} \sin(\omega t +\alpha)\\ &= \left(\frac{\gamma^2}{4}- \omega^2\right)Ae^{-\gamma t/2} \cos(\omega t +\alpha) + 2(\gamma \omega /2)Ae^{-\gamma t/2} \sin(\omega t +\alpha) \;.\end{align}
Now, the differential equation becomes;
$$\left[\left(\frac{\gamma^2}{4}- \omega^2\right)- \nu \frac{\gamma}{2} + \omega_0^2\right]Ae^{-\gamma t/2} \cos(\omega t +\alpha) + [\gamma\omega -\nu\omega]Ae^{-\gamma t/2} \sin(\omega t +\alpha)= 0$$ which implies $$\left[\left(\frac{\gamma^2}{4}- \omega^2\right)- \nu \frac{\gamma}{2} + \omega_0^2\right]= 0\\ \gamma\omega -\nu\omega= 0$$ which gives: $$\gamma= \nu \\ \omega = \omega_0^2-\frac{\gamma^2}{4} $$
Comment: Phew! My hands:/
Using Exponential function:
$$\ddot{x} + \gamma \dot x + \omega_0^2 x= 0$$
Let's turn it into $$\ddot{z} + \gamma \dot z + \omega_0^2 z= 0$$
Let's assume $z= Ae^{\color{red}{\iota}(pt + \alpha)}\;.$
Putting $z$ in the equation we get:$$(-p^2 + \color{red}{\iota} p\gamma + \omega_0^2)Ae^{\color{red}{\iota}(pt + \alpha)}\;.$$ This implies: $$(-p^2 + \color{red}{\iota} p\gamma + \omega_0^2) = 0\;.$$ It cannot be satisfied if $p$ is real, as $\color{red}{\iota} p\gamma$ would be left without being cancelled by any term. Therefore, we put $$p = n+ \color{red}{\iota}s\;.$$ Putting the value of $p^2$ in the preceding equation, we get; $$-n^2 -2n\color{red}{\iota}s + s^2 + \color{red}{\iota}n\gamma - s\gamma + \omega_0^2= 0\;.$$ Separating the real and imaginary parts, we get $$-n^2 + s^2 -s\gamma + \omega_0^2 = 0\\ -2ns + n\gamma = 0\;.$$ From this, we get; $$s= \gamma/2\\ n^2 = \omega_0^2 - \frac{\gamma^2}{4}\;.$$ Thus, \begin{align}z(t)&= Ae^{\color{red}{\iota}(nt + \color{red}{\iota}st + \alpha)}\\& = Ae^{-st}e^{\color{red}{\iota}(nt + \alpha)}\;.\end{align}
Taking the real component, we get $$x(t)= Ae^{-\gamma t/2}\cos(\omega t+ \alpha)\;.$$
Comment: See? How elegant and easier to solve the same equation using exponential function? Also, notice, how, at the end, only the real part is extracted because it is the actual motion going.
