Trouble verifying a solution to a differential equation

I am reading a physics book which has discussed one approach towards solving the differential equation

$$\frac{d^2 x(t)}{dt^2} = Cx(t)$$

as follows:

Using Mathematica to solve the equation. I tried using Mathematica to solve the equation as follows:

In[4]:= DSolve[x''[t] == C x[t], x[t], t]

Out[4]= {{x[t] -> E^(Sqrt[c] t) C[1] + E^(-Sqrt[c] t) C[2]}}


But it gives a different (and I assume more general/proper) solution than the one offered by the book.

Question: How can I verify that the solution offered in the physics book has a form which matches the solution offered by Mathematica?

Attempt: Trying

Solve[E^(Sqrt[C] t) C[1] + E^(-Sqrt[C] t) C[2] ==
C[1] Cos[Sqrt[-C] t] + C[2] Sin[Sqrt[-C] t], C]


yields

• If you just want the solution in the textbook you can DSolve[x''[t] == -ω^2 x[t], x[t], t]. Prove the solution involving $C$ is equivalent to that involving $\omega$ is another story, though. – xzczd Aug 4 at 3:14
• Why square ω in that DSolve equation? Isn't x''[t] == -ω^2 x[t] a different differential equation than x''[t] == C x[t]? – George Aug 4 at 3:27
• Solve[ω == Sqrt[-c], c] => {{c -> -ω^2}} – xzczd Aug 4 at 7:31

I'd like to extend my comments to an answer. If one just want to obtain the result in textbook, we just need

ref = DSolve[x''[t] == -ω^2 x[t], x[t], t][[1]]
(* {x[t] -> C[1] Cos[t ω] + C[2] Sin[t ω]} *)


because as mentioned in the screenshot, $$-\omega^2=C$$.

However, if one wants to prove the output of

sol = DSolve[x''[t] == c x[t], x[t], t][[1]]
(* {x[t] -> E^(Sqrt[c] t) C[1] + E^(-Sqrt[c] t) C[2]} *)


is equivalent to ref given that -ω^2 == c, the process is a bit involved. We need to:

1. Substitute in -ω^2 == c and express the solution with Sinh and Cosh.

sol /. c -> -ω^2 // ExpToTrig
(* {x[t] ->
C[1] Cosh[t Sqrt[-ω^2]] + C[2] Cosh[t Sqrt[-ω^2]] +
C[1] Sinh[t Sqrt[-ω^2]] - C[2] Sinh[t Sqrt[-ω^2]]} *)

2. Expand the Sqrt[-ω^2] with PowerExpand. Notice Assumptions -> True is necessary to obtain a generally correct result.

PowerExpand[%, Assumptions -> True] // Simplify
(* {x[t] -> (C[1] + C[2]) Cos[(-1)^Ceiling[Arg[ω]/π] t ω] +
I (C[1] - C[2]) Sin[(-1)^Ceiling[Arg[ω]/π] t ω]} *)

3. At this point it's obvious that (-1)^Ceiling[Arg[ω]/π] can only be $$\pm 1$$, but still, we stick on proving with Mathematica. We simplify (-1)^… term with FullSimplify.

% /. (-1)^a_ :> FullSimplify[(-1)^a]
(* {x[t] -> (C[1] + C[2])*Cos[t*ω*Piecewise[{{-1, Arg[ω] > 0}}, 1]] +
I*(C[1] - C[2])*Sin[t*ω*Piecewise[{{-1, Arg[ω] > 0}}, 1]]} *)

4. Finally simplify the Piecewise[…] further by classified discussion.

Simplify[%, #] & /@ {Arg[ω] > 0, Arg[ω] <= 0}
(* {{x[t] -> (C[1] + C[2]) Cos[t ω] - I (C[1] - C[2]) Sin[t ω]},
{x[t] -> (C[1] + C[2]) Cos[t ω] + I (C[1] - C[2]) Sin[t ω]}} *)


C[1] and C[2] are constants, thus C[1] + C[2] and ± I (C[1] - C[2]) are constants, too. QED.

Since Mathematica uses a symbol similar to C for arbitrary constants in the solutions provided by DSolve, I suggest using a different symbol like MU to avoid confusion. If MU is positive in your original equation, you will get one type of solution, if negative another. To see this, try DSolve[x''[t]==3 x[t], x[t], t] and DSolve[x''[t]==-3 x[t], x[t], t]. With that, you should be able to understand the general solution you are getting.

Or try getting rid of the arbitrary constants by supplying initial conditions as

sol = DSolve[{x''[t] == MU x[t], x[0] == AA, x'[0] == 0}, x[t], t]

And then

sol /. MU -> 3 // ExpToTrig // Simplify

And

sol /. MU -> -3 // ExpToTrig // Simplify

to see what is going on.

Recall Cosh[x] will increase with x (look up the definition), which makes sense from the original equation.

(Normally it is best practice to not use upper-case names like MU or AA.)