As the given equation has two different arbitrary constants so we can differentiate it twice with respect to x.
x = A cos nt + B sin nt
On differentiating with respect to t we get,
\(\frac{dx}{dt} = \) -An sin nt + Bn cos nt
Again, differentiating with respect to x,
\(\frac{d^2x}{dt^2}\) = -An2 cos nt + Bn2 sin nt
\(\Rightarrow\frac{d^2x}{dt^2}=\) -n2(A cos nt + B sin nt)
As x = A cos nt + B sin nt

Hence, \(\frac{d^2x}{dt^2}+n^2x =0\) is the required differential equation.