# Separation of variables problem

I'm looking for solutions for the wave equation with initial conditions $u(x,0)=x(L-x), u_t(x,0)=0, u(0,t)=u(L,t)=0$. $x\in [0,L], t\in [0, \infty]$.

The wave equation is $u_{tt}(x,t)=c^2u_{xx}(x,t)$.

Attepting the separation of variables: suppose $u=p(x)q(t)\implies u_{tt}=p(x)q''(t), u_{xx}=p(x)''q(t)$,

Since $p(x)q''(t)=c^2 p''(x)q(t)$ we can have $\frac{1}{c^2}\frac{q''}{q(t)}=\frac{p''}{p(x)}=\lambda$ and the equations to solve are

$$p''=\lambda p(x)$$ $$q''=\lambda c^2q(t)$$

A general solution for the pde is given by the possible linear combinations. How do I combine this with the initial conditions?

• First, you need to get your boundary conditions in terms of $p$. For example, $$u(0,t) = 0 \implies p(0)q(t) = 0 \implies p(0) = 0$$ Now find your other condition and solve the ODE for $p$. From this, you get your eigenvalue(s) and so can solve your ODE in $q$. Your solution $u$ is then a superposition of the product of $p$ and $q$. See here for a guide on the steps listed above. – mattos Nov 30 '16 at 14:18

The basic solutions of $p''=\lambda p(x)$ and $q''=\lambda c^2 q(t)$ are $e^{\pm \sqrt{\lambda}x}$ and $e^{\pm \sqrt{\lambda}ct} \quad\to\quad e^{\pm \sqrt{\lambda}x \pm \sqrt{\lambda}ct}$

In order to fit the conditions, this will be expressed in terms of Fourier series, that is with sinusoidal terms. Hence $\lambda=-\omega^2$

$$u(x,t)=\sum_{\forall \omega} A_\omega \sin(\omega x) \sin(\omega ct) +\sum_{\forall \omega}B_\omega \sin(\omega x) \cos(\omega ct) +\sum_{\forall \omega}C_\omega \cos(\omega x) \sin(\omega ct) +\sum_{\forall \omega}D_\omega \cos(\omega x) \cos(\omega ct)$$

The conditions $u(0,t)=u(L,t)=0$ leads to $\omega=\frac{n\pi}{L}$ and $C_\omega=D_\omega=0$ :

$$u(x,t)=\sum_{\forall n} A_n \sin(\frac{n\pi}{L}x) \sin(\frac{n\pi}{L}ct) +\sum_{\forall n}B_n \sin(\frac{n\pi}{L}x) \cos(\frac{n\pi}{L}ct)$$

The condition $u_t(x,0)=0$ leads to $A_n=0$ $$u(x,t)=\sum_{\forall n}B_n \sin(\frac{n\pi}{L}x) \cos(\frac{n\pi}{L}ct)$$

The last condition is : $$u(x,0)=x(L-x)=\sum_{\forall n}B_n \sin(\frac{n\pi}{L}x)$$

Fourier series : $x(L-x)=\sum_{n=1}^{\infty} B_n\sin\left(\frac{n\pi}{L}x \right)$

$B_n=\frac{2}{L}\int_0^L x(L-x)\sin\left(\frac{n\pi}{L}x\right)dx = 4L^2\frac{1-(-1)^n}{\pi^3n^3}$

$$u(x,t)=4L^2\sum_{n=1}^\infty \frac{1-(-1)^n}{\pi^3n^3} \sin(\frac{n\pi}{L}x) \cos(\frac{n\pi}{L}ct)$$

I've done the substitution $\lambda \rightarrow -k^2$ without any loss of generality if one permits complex values of$k$. Then, your equations read:

$$p''(x) = -k^2 p(x)$$

$$q''(t) = -k^2 c^2 q(t)$$

They are solved by

$$p(x) = A\sin(kx) + B\cos(kx)$$

$$q(t) = C\sin(kct) + D\cos(kct)$$

Thus,

$$u(x,t) =\left[A\sin(kx) + B\cos(kx)\right]\left[C\sin(kct) + D\cos(kct)\right]$$

From $u(0, t) = 0$, we conclude that $B = 0$. From $u(L,t) = 0$, we conclude that $k=\frac{n\pi}{L}$ for some integer $n$.

Therefore

$$u(x,t) = A\sin\left(\frac{n\pi}{L}x\right)\left[C\sin\left(\frac{n\pi}{L}ct\right) + D\cos\left(\frac{n\pi}{L}ct\right)\right]$$

Next, we calculate $u_t(x,t)$ to evaluate our initial condition.

$$u_t(x,t) = A\frac{n\pi}{L}\sin\left(\frac{n\pi}{L}x\right)\left[C\cos\left(\frac{n\pi}{L}ct\right) - D\sin\left(\frac{n\pi}{L}ct\right)\right]$$

With $u_t(x,0) = 0$, we conclude that $C = 0$. Now, with $c := AD$, we have

$$u(x,t) = c\sin\left(\frac{n\pi}{L}x\right)\cos\left(\frac{n\pi}{L}ct\right)$$

Notice that this is a solution for any integer $n$, so the general solution is given by

$$u(x,t) = \sum_{n=1}^\infty c_n\sin\left(\frac{n\pi}{L}x\right)\cos\left(\frac{n\pi}{L}ct\right)$$

Now we have, as a final condition, that

$$x(L-x) = \sum_{n=1}^\infty c_n\sin\left(\frac{n\pi}{L}x\right)$$

The RHS is a Fourier series expansion. Since Fourier series are unique, one can expand the LHS as a Fourier series on the interval $[0,L]$ and equate coefficients to find the values of $c_n$.