Answer
The equation of motion of a harmonic oscillator is given by
$m\frac{d^2x}{dt^2}=–k_fx$
or, $\frac{d^2x}{dt^2}=–\frac{k_f}{m}x$
or, $\frac{d^2x}{dt^2}=–\omega^2x$ $\bigg($where $\omega=\sqrt {\frac{k_f}{m}}$$\bigg)$ ..........$(1)$
Let $x=x_0e^{kt}$ is the solution of eq, $1$, where $A$ and $k$ are two constants
Substituting $x=x_0e^{kt}$ in eq. $1$, we get
$k^2x_0e^{kt}=-\omega^2x_0e^{kt}$
or, $k^2+\omega^2=0$ $(\because e^{kt}\ne0 )$
or, $k=±i\omega$
Thus, the solutions of eq. $1$ are
$x_1=x_0^1e^{i\omega t}$ and $x_2=x_0^2e^{-i\omega t}$
Therefore, the general solution of eq. $1$ is given by
$x=x_1+x_2$
or, $x=x_0^1e^{i\omega t}+x_0^2e^{-i\omega t}$
or, $x=x_0^1(\cos\omega t+i\sin\omega t)-x_0^2(\cos\omega t+i\sin\omega t)$
or, $x=(x_0^1+x_0^2)\cos\omega t+i(x_0^1-x_0^2)\sin\omega t$
or, $x=B\cos\omega t+A\sin\omega t$
or, $x=A\sin\omega t+B\cos\omega t$
where, $A=i(x_0^1-x_0^2)$ and $B=(x_0^1+x_0^2)$ are two constants.
Work Step by Step
The equation of motion of a harmonic oscillator is given by
$m\frac{d^2x}{dt^2}=–k_fx$
or, $\frac{d^2x}{dt^2}=–\frac{k_f}{m}x$
or, $\frac{d^2x}{dt^2}=–\omega^2x$ $\bigg($where $\omega=\sqrt {\frac{k_f}{m}}$$\bigg)$ ..........$(1)$
Let $x=x_0e^{kt}$ is the solution of eq, $1$, where $A$ and $k$ are two constants
Substituting $x=x_0e^{kt}$ in eq. $1$, we get
$k^2x_0e^{kt}=-\omega^2x_0e^{kt}$
or, $k^2+\omega^2=0$ $(\because e^{kt}\ne0 )$
or, $k=±i\omega$
Thus, the solutions of eq. $1$ are
$x_1=x_0^1e^{i\omega t}$ and $x_2=x_0^2e^{-i\omega t}$
Therefore, the general solution of eq. $1$ is given by
$x=x_1+x_2$
or, $x=x_0^1e^{i\omega t}+x_0^2e^{-i\omega t}$
or, $x=x_0^1(\cos\omega t+i\sin\omega t)-x_0^2(\cos\omega t+i\sin\omega t)$
or, $x=(x_0^1+x_0^2)\cos\omega t+i(x_0^1-x_0^2)\sin\omega t$
or, $x=B\cos\omega t+A\sin\omega t$
or, $x=A\sin\omega t+B\cos\omega t$
where, $A=i(x_0^1-x_0^2)$ and $B=(x_0^1+x_0^2)$ are two constants.