In many of the books talking about damped simple harmonic motion, the underdamped oscillator is treated as follows:
Newton's second law says $$m\ddot{x} + r\dot{x} + sx = 0 $$where s is stiffness constant, r is viscosity constant and m is mass of the oscillating object. The solution of the differential equation is $$x=Ce^{\alpha t} \, .$$ Putting the above solution in the differential equation, we get $$\alpha = \frac{r}{2m} \pm \sqrt{\frac{r^2}{4m^2} - \frac{s}{m}} \, .$$ In the underdamped case the term in the square root is less than 0 and we have two solutions: \begin{align} x =& e^{-rt/2m}e^{\pm i w't} \\ \text{where} \qquad w' =& \sqrt{\frac{s}{m} - \frac{r^2}{4m^2} } \, . \end{align}
After that, I have two sources where they take the solution to be $$x= e^{-rt/2m}[A \cos(\omega t)+ B \sin(\omega t)] \, .$$
In one of the sources, R.D. Gregory, the author says
The real and imaginary parts of the first complex solution are $$x=\begin{cases} e^{-rt/2m} \cos(\omega t) \\ e^{-rt/2m} \sin(\omega t) \end{cases}$$ and these functions form a basis for the space of real solutions. The general real solution of the damped SHM equation, in this case, is therefore $$x= e^{-rt/2m}[A \cos(\omega t)+ B \sin(\omega t)] \, .$$
Here is one other source where I found the above to be a solution.
Now my confusion lies where the author takes both the real and imaginary parts as the basis for the "real" solution. Can anyone explain to me how the imaginary part is in the basis?