What is the motivation behind assumption when solving one dimensional harmonic oscillator? When solving motion of simple harmonic oscillator:
$$\frac{d^2x}{dt^2}+\omega^2x=0,$$
you can get:
$$x(t)=Ae^{i\omega t}+Be^{-i\omega t}.$$
You can assume that $A$ and $B$ are complex number, where:
$$A=a_1+a_2i \textrm{ and } B=b_1 + b_2i,$$
You can rewrite $x(t)$ as:
$$x(t)=(a_1+b_1+(a_2+b_2)i)\cos(\omega t)+(-(a_2+b_2)+(a_1+b_1)i)\sin(\omega t).$$
I read that in order to find final equation you have to get only real part of the equation above.
My questions are, why do we assume that $A$ and $B$ are imaginary and why do we choose only real part of $x(t)$? What does imaginary part represent then?
 A: *

*you also could just as easily find,that $a\cos (\omega t)+b\sin (\omega t)$ solves the differential equation instead of the complex functions

*every linear combination of fundamental solutions of a linear differential equation is also a solution an you want of cause a real equation

A: To solve
$$\frac{\textrm{d}^2 x}{\textrm{d}t^2} + \omega^2 x = 0$$
is a little difficult in the real numbers. So a trick we do is to try to solve two equations at once. We'll attempt at solving
$$\frac{\textrm{d}^2}{\textrm{d}t^2}(x + iy) + \omega^2 (x + iy) = 0,$$
where both $x$ and $y$ are real. This seems weird at first, since the problem is more complex (sorry for the lame joke). However, we can now use the power of complex numbers to figure out that the generic solution should be
$$x+iy = A e^{i \omega t} + B e^{- i \omega t}.$$
However, we obtained this when working with complex numbers, so our initial conditions must be specified as complex numbers. If you prefer, we are specifying the initial conditions to both $x$ and $y$ simultaneously, and hence we need four real numbers to fully specify the solution. Two of them are the ones we were interested in (they will give us $x$), the other two are not necessarily that interesting (they give $y$).
At the end of the day, we can rewrite our solution in the manner you did. Notice we then get
$$x(t) + i y(t) = (a_1 + b_1)\cos(\omega t) + (b_2- a_2) \sin(\omega t) + i(a_2 + b_2)\cos(\omega t) + i(a_1 - b_1)\sin(\omega t),$$
where I got the expression from your prescription of $A = a_1 + ia_2$, $B=b_1 + ib_2$ and simplified with WolframAlpha. In this notation, we see that the real part corresponds to $x$, the imaginary part corresponds to $y$. Their only difference is in the initial conditions you chose. Notice that, indeed, the final solution allows for separate initial conditions for $x$ and $y$.
This idea becomes more relevant when we consider a driving force. The equation of motion the becomes
$$\frac{\textrm{d}^2 x}{\textrm{d}t^2} + \omega^2 x = \frac{F_0}{m} \cos(\Omega t),$$
and once again the solution is complicated. So we consider a separate problem, given by the equation of motion
$$\frac{\textrm{d}^2 y}{\textrm{d}t^2} + \omega^2 y = \frac{F_0}{m} \sin(\Omega t),$$
and then solve them both together by doing
$$\frac{\textrm{d}^2}{\textrm{d}t^2}(x + iy) + \omega^2 (x + iy) = \frac{F_0}{m} e^{i\Omega t}.$$
In this situation, $x$ and $y$ respond to different forces, not only different initial conditions, but it is mathematically easier to solve them both at once.
In summary:

*

*you pick $A$ and $B$ to be complex because you are solving a complex differential equation, so it needs complex initial conditions. Analogously, you need to provide initial data for both $x$ and $y$, and that requires four real numbers;

*the imaginary part represents a different, but related, problem. We choose to solve two problems at once because this leads to equations that are simpler to deal with.

A: The general solution of the differential equation must have 2 arbitrary constants. In the case, $a_1 = -b_1$ and $a_2 = -b_2$, to get rid of the imaginary. From the apparent 4 constants we get only 2 as expected.
It is equivalent to say that the solution is $x(t) = A\cos (\omega t) + B\sin (\omega t)$. But operating with exponentials is more convenient.
