# Using separation of variables to solve the wave equation

I'm trying to teach myself separation of variables and have been following some notes for the wave equation, but there's one part which really confuses me and I'm not exactly sure how it makes the step.

For the wave equation

$$u_{tt} - c^2 u_{xx} = 0$$

with length $$l$$ and fixed ends, $$u(0,t)=u(l,t)=0$$ we seek a solution in the form $$u(x,t)=v(x)q(t)$$ and substituting this into the equation gives $$\frac{1}{q(t)}\frac{d^2 q}{dt^2}=c^2 \frac{1}{v(x)}\frac{d^2 v}{dx^2}=-\omega ^2$$

and I understand all of this so far. But when solving the equation $$q''+\omega ^2 q = 0$$ the general solution is $$q(t)=A \cos(\omega t +\alpha)$$ where $$A$$ and $$\alpha$$ are constants - which is the part which I'm not exactly sure on how it gets to.

Could someone explain this step to me? Thanks!

• There are several different ways to write the solution of that second-order ODE: $A\sin(\omega t)+B\cos(\omega t),$ or $A\cos(\omega t+\alpha),$ or $A e^{i\omega t}+Be^{-i\omega t}.$ The angle offset ends up being mathematically equivalent to another basis function (need two for the general solution to a linear second-order ODE). Does that help? Commented Jan 31, 2019 at 17:28
• Ooh okay, it didn't occur to me that it was just a different way of writing the other solutions. Is there a reason why it's advantageous to write it like that in this case? Commented Jan 31, 2019 at 17:36
• Sometimes! It depends on where you want to go with it. In this case, the nice thing is that it's only one function to write. Commented Jan 31, 2019 at 17:37
• Ah okay, thank you for your help! Commented Jan 31, 2019 at 17:40

In "Ordinary Differential Equations" you learned that the "characteristic equation" of the differential equation $$q''+ \omega^2q= 0$$ is $$m^2+ \omega^2= 0$$ which, assuming $$\omega$$ is real, has roots $$m= \omega i$$. The general solution to that differential equation is $$q= Ae^{\omega ti}+ Be^{-\omega ti}= A(\cos(\omega t)+ \sin(\omega t))+ B(\cos(\omega t)- \sin(\omega t))= (A+ B)\cos(\omega t)+ (A- B)\sin(\omega t)$$.
In order to get the form you have, you need the trig identity $$\cos(A+ B)= \cos(A)\cos(B)- \sin(A)\sin(B)$$. So $$A \cos(\omega t+ \alpha)= A\cos(\alpha) \cos(\omega t)- A\sin(\alpha) \sin(\omega t)$$.
So lets try to work through this: Intuitively, you can see that cosine is the correct solution since by differentiating twice we get back to the cosine but only its negative. However, we can do this more formally(this is my favourite method of doing it): Suppose we can get a solution of the sort $$u(x)=\sum^{\infty}_{i=1}a_ix^i$$.Then we can write: $$u'(x)=\sum^{\infty}_{i=1}ia_ix^{i-1}=\sum^{\infty}_{i=0}(i+1)a_{i+1}x^{i}$$, and similarly : $$u''(x)=\sum^{\infty}_{i=0}(i+1)(i)a_{i+1}x^{i-1}=\sum^{\infty}_{i=0}(i+1)(i+2)a_{i+2}x^{i}$$. So we now have the following: $$\sum^{\infty}_{i=0}(i+1)(i+2)a_{i+2}x^{i}+w^2a_ix^i=0$$. This will give you that $$a_{i+2}=-(w^2)a_i/(i+1)(i+2)$$. If you solve this linear recurence relation,with the initial conditions, you will get the power series for cosine
I would get rid of $$\alpha$$ and just look at your boundary conditions to solve your constants. The first thing to note, is that you should begin in fact with: $$$$\sum_{n=1}^{\infty} A_n\cos(\omega_nt) + B_n\sin(\omega_nt)$$$$ From there you can use boundary conditions, signs and fourier series knowledge to end up with only cos and fill in the coefficients you're missing.