We derived the 1D wave equation in section
Section 8.2. We will now solve this as an initial value problem. Consider
\begin{equation*}
\frac{\partial^{2} u}{\partial{t}^{2}}= c^{2} \frac{\partial^{2} u}{\partial{x}^{2}}
\end{equation*}
with boundary conditions
\begin{equation*}
\begin{aligned} u(0,t)\amp = u(L,t) = 0, \amp \amp \text{for $t \geq 0$}\\ \qquad u(x,0)\amp = f(x) \amp \amp \text{for $0 \leq x \leq L$ }\\ u_{t}(x,0) \amp= 0 \amp \amp \text{for $0 \leq x \leq L$} \end{aligned}
\end{equation*}
The technique of separation of variables is the standard way to solve this and other linear PDEs. First start by assuming that the solution \(u(x,t)\) can be written as a product of functions solely of \(x\) and \(t\) or \(u(x,t) = X(x) T(t)\text{.}\) Then substituting this into the PDE:
\begin{equation*}
\begin{aligned} \frac{\partial^{2} (X(x)T(t))}{\partial{t}^{2}}\amp= c^{2} \frac{\partial^{2} (X(x) T(t))}{\partial{x}^{2}}\\ XT''\amp= c^{2} X'' T \end{aligned}
\end{equation*}
or
\begin{equation*}
\frac{1}{c^{2}}\frac{T''}{T}= \frac{X''}{ X}
\end{equation*}
Now since \(T\) (and therefore \(T''\)) depends only on \(t\) and \(X\) (and also \(X''\)) only depends on \(x\text{,}\) each side of the PDE must be equal to a constant (independent of either \(x\) or \(t\)). Let’s say it is \(-\lambda\) or
\begin{equation*}
\frac{1}{c^{2}}\frac{T''}{T}= \frac{X''}{X}= -\lambda
\end{equation*}
This results in two equations:
\begin{align}
T'' +c^{2}\lambda T \amp = 0\tag{9.2.1}\\
X'' + \lambda X \amp= 0 \tag{9.2.2}
\end{align}
The boundary conditions are \(u(0) = u(L) = 0\) for all \(t\text{,}\) so substituting \(u=XT\) we get
\begin{equation*}
X(0)T(t) = X(L) T(t)= 0
\end{equation*}
for all
\(t\) or
\(X(0)=X(L)=0\text{.}\) The ODE for
\(X\) is that in
(9.2.1) with these boundary conditions. This is a Sturm-Liouville problem that was solved in example
Example 8.5.2. We know that the only form of the solution is when
\(\lambda \gt 0\) and from the problem that we solved above we know that
\begin{equation}
\lambda= \frac{n^{2} \pi^{2}}{L^{2}}\tag{9.2.3}
\end{equation}
and the solution for \(X\) are the eigenfunctions of the problem:
\begin{equation*}
X_{n}(x) = \sin \frac{n \pi x}{L}
\end{equation*}
for \(n=1,2,3,\ldots\text{.}\)
\begin{equation*}
T'' + c^{2} \frac{n^{2} \pi^{2}}{L^{2}}T = 0
\end{equation*}
The solution to this is found by assuming \(T(t) = e^{r t}\) and getting the characteristic equation
\begin{equation*}
r^{2} + c^{2} \frac{n^{2} \pi^{2}}{L^{2}}= 0
\end{equation*}
and thus
\begin{equation*}
r = \pm i \frac{n c \pi}{L}
\end{equation*}
and the solution to this is
\begin{equation*}
T_{n}(t) = a_{n} \cos \biggl( \frac{n c \pi }{L}\biggr) t + b_{n} \sin \biggl( \frac{n c \pi }{L}\biggr) t
\end{equation*}
We know then that the following is a solution to the PDE:
\begin{equation*}
u_{n}(x,t)= X_{n}(x) T_{n}(t) = \biggl( a_{n} \cos \biggl( \frac{n c \pi }{L}\biggr) t + b_{n} \sin \biggl( \frac{n c \pi }{L}\biggr) t \biggr) \sin \frac{n \pi x}{L}
\end{equation*}
The principle of superposition states that a sum of these solutions is also a solution to the original PDE and in fact the most general solution is
\begin{equation*}
\begin{aligned} u(x,t)\amp= \sum_{n=1}^{\infty}u_{n}(x,t) \\\amp= \sum_{n=1}^{\infty}\biggl( a_{n} \cos \biggl( \frac{n c \pi }{L}\biggr) t + b_{n} \sin \biggl( \frac{n c \pi }{L}\biggr) t \biggr) \sin \frac{n \pi x}{L} \end{aligned}
\end{equation*}
Lastly, we use the initial conditions \(u(x,0)=f(x)\) and \(u_{t}(x,0)=0\) for \(0 \leq x \leq L\) to solve for \(a_{n}\) and \(b_{n}\) above. We will look at the second condition first:
\begin{equation*}
u_{t}(x,t)= \sum_{n=1}^{\infty}\frac{n c \pi}{L}\biggl( -a_{n} \sin \biggl( \frac{n c \pi }{L}\biggr) t + b_{n} \cos \biggl( \frac{n c \pi }{L}\biggr) t \biggr) \sin \frac{n \pi x}{L}
\end{equation*}
and evaluated at \(t=0\text{:}\)
\begin{equation*}
u_{t}(x,0) = \sum_{n=1}^{\infty}\frac{n c \pi}{L}\biggl( 0 + b_{n} \biggr) \sin \frac{n \pi x}{L}
\end{equation*}
and since \(u_{t}(x,0)\equiv 0\text{,}\) then \(b_{n}=0\text{.}\) The first condition:
\begin{equation*}
u(x,0) = f(x) = \sum_{n=1}^{\infty}a_{n} \sin \frac{n \pi x}{L}
\end{equation*}
is the Fourier sine series for \(0 \leq x \leq L\text{.}\) Thus
\begin{equation*}
a_{n} = \frac{2}{L}\int_{0}^{L} f(x) \sin \frac{n \pi x}{L}\, dx
\end{equation*}
We summarize the solution to the wave equation.
The solution to the wave equation
\begin{equation*}
u_{tt}=c^{2} u_{xx}
\end{equation*}
with boundary conditions
\begin{equation*}
u(0,t) = u(L,t) = 0
\end{equation*}
and initial conditions
\begin{equation*}
\begin{aligned} u(x,0)\amp= f(x), \amp u_{t}(x,0)\amp= 0 \end{aligned}
\end{equation*}
is
\begin{equation*}
u(x,t)= \sum_{n=1}^{\infty}a_{n} \cos \biggl( \frac{n c \pi }{L}\biggr) t \sin \frac{n \pi x}{L}
\end{equation*}
where
\begin{equation*}
a_{n}= \frac{2}{L}\int_{0}^{L} f(x) \sin \frac{n\pi x}{L}\, dx
\end{equation*}
The following two examples show specific solutions for given functions
\(f(x)\text{.}\)
Example 9.2.1.
Find the specific solution to the wave equation if
\(f(x) = 0.1 \sin (\pi x/L)\)
Solution.
Specifically, we only need to find the coefficients \(a_{n}\) above:
\begin{equation*}
\begin{aligned} a_{n}\amp= \frac{2}{L}\int_{0}^{L} 0.1 \sin \frac{\pi x}{L}\sin \frac{n\pi x}{L}\, dx \\\amp= \begin{cases}0.1 \qquad \text{if $n=1$}\\ 0 \qquad \text{otherwise}\end{cases} \end{aligned}
\end{equation*}
Thus the full solution to the PDE is:
\begin{equation*}
u(x,t)= 0.1 \sin \frac{\pi x}{L}\cos \frac{\pi t}{L}
\end{equation*}
Example 9.2.2.
Find the solution to the wave equation above if the initial shape of the string is
\begin{equation*}
\begin{aligned} f(x)\amp= \begin{cases}kx,\amp\text{if $0\leq x< L/2$}\\ k(L-x),\amp\text{if $L/2 \leq x \leq L$}\end{cases} \end{aligned}
\end{equation*}
As before, we only need to find the coefficients of \(a_{n}\) given by
\begin{equation*}
\begin{aligned} a_{n}\amp= \frac{2}{L}\int_{0}^{L} f(x) \sin \frac{n \pi x}{L}\, dx \\\amp= \frac{2}{L}\int_{0}^{L/2}kx \sin \frac{n \pi x}{L}\, dx + \frac{2}{L}\int_{L/2}^{L} k(L-x) \sin \frac{n \pi x}{L}\, dx \\\amp= \begin{cases}\frac{4k L}{n^2 \pi^2}(-1)^{(n-1)/2},\amp\text{if $n$ is odd}\\ 0,\amp\text{otherwise}\end{cases} \end{aligned}
\end{equation*}
And thus the full solution to the wave equation is:
\begin{equation*}
\begin{aligned} u(x,t)\amp= \sum_{n=1}^{\infty}a_{n} \sin \biggl(\frac{n \pi x}{L}\biggr) \sin \biggl(\frac{n \pi t}{L}\biggr) \\\amp= \sum_{n=1}^{\infty}\frac{4 k L (-1)^{n+1}}{\pi^{2} (2n-1)^{2}}\sin \biggl( \frac{(2n-1) \pi x}{L}\biggr) \sin \biggl(\frac{(2n-1) \pi t}{L}\biggr) \end{aligned}
\end{equation*}
Subsection 9.2.1 Solution to the Wave Equation with a free boundary condition
We now look at the wave equation with what is termed a free boundary condition. Consider
\begin{equation*}
\frac{\partial^{2} u}{\partial{t}^{2}}= c^{2} \frac{\partial^{2} u}{\partial{x}^{2}}
\end{equation*}
with boundary conditions
\begin{equation}
\begin{aligned} u(0,t)\amp= 0 \qquad u_{x}(L,t) = 0, \qquad \text{for $t \geq 0$} \end{aligned}\tag{9.2.4}
\end{equation}
and initial conditions
\begin{align}
u(x,0)\amp= f(x) \amp \amp \text{for $0 \leq x \leq L$ }\tag{9.2.5}\\
u_{t}(x,0)\amp= 0 \amp \amp \text{for $0 \leq x \leq L$}\tag{9.2.6}
\end{align}
and the difference between this and the initial value problem at the beginning of the section is the boundary condition at \(x=L\text{.}\) Above, the function \(u\) was forced to be 0 there and in this case, the derivative is 0 at \(x=L\text{.}\)
Using separation of variables by assuming that \(u(x,t)=X(x)T(t)\text{,}\) and substituting into the wave equation and dividing through by \(c^{2} XT\text{,}\) we again get the equation
\begin{equation*}
\frac{1}{c^{2}}\frac{T''}{T} = \frac{X''}{X}= -\lambda^{2}
\end{equation*}
where again since each term only depends on \(t\) or \(x\text{,}\) it must be a constant, which we say is \(-\lambda\text{.}\) The differential equation in \(X\) is
\begin{equation*}
\begin{aligned} X'' + \lambda X\amp= 0\amp X(0)\amp= 0, X'(L)=0 \end{aligned}
\end{equation*}
where the boundary conditions came from
(9.2.4). The solution to this Sturm-Liouville problem is similar to those in Examples
Example 8.5.2 and
Example 8.5.5, however the details of this are not shown. The eigenfunctions and eigenvalues of this are
\begin{equation*}
\begin{aligned} X_{n}(x)\amp= \sin \lambda_{n} x\amp\lambda_{n}\amp= \frac{(2n-1)\pi}{2L} \end{aligned}
\end{equation*}
Next, we seek the solution to \(T''+c^{2} \lambda^{2} T = 0\) which again, similar to solution of the wave equation with fixed boundary conditions, is
\begin{equation*}
T= a \cos c \lambda t + b \sin c \lambda t
\end{equation*}
which has a solution for each value of \(n\) or
\begin{equation*}
T_{n} = a_{n} \cos c \frac{(2n-1)\pi}{2L}t + b_{n} \sin c \frac{(2n-1)\pi}{2L}t
\end{equation*}
Using the principle of superposition, the sum of solutions is also a solution, so
\begin{equation*}
u(x,t) = \sum_{n=1}^{\infty}\biggl(a_{n} \cos c \frac{(2n-1)\pi}{2L}t + b_{n} \sin c \frac{(2n-1)\pi}{2L}t \biggr) \sin \frac{(2n-1)\pi x}{2L}
\end{equation*}
To find the particular solution, we need to find the constants
\(a_{n}\) and
\(b_{n}\) which can be found using the initial conditions of the problem. Similar to the problem above with the fixed boundary conditions, we will use the initial condition in
(9.2.6) first, which requires that we know the derivative. And
\begin{equation}
u_{t}= \sum_{n=1}^{\infty}c \lambda_{n} \biggl(-a_{n} \sin c \frac{(2n-1)\pi}{2L}t + b_{n} \cos c \frac{(2n-1)\pi}{2L}t \biggr) \sin \frac{(2n-1)\pi x}{2L}\tag{9.2.7}
\end{equation}
Applying the initial condition in
(9.2.6),
\begin{equation*}
u_{t}(x,0)=0 = \sum_{n=1}^{\infty}b_{n} c \lambda_{n} \sin \frac{(2n-1)\pi x}{2L}
\end{equation*}
which implies that
\(b_{n}=0\) for all
\(n\text{.}\) Next, if we substitute this into
(9.2.7)) and apply the boundary condition in (
(9.2.5),
\begin{equation*}
u(x,0)= f(x) = \sum_{n=1}^{\infty}a_{n} \sin \frac{(2n-1)\pi x}{2L}
\end{equation*}
and the coefficients can be found using Theorem
Theorem 8.5.3, to be
\begin{equation*}
\begin{aligned} a_{n}\amp= \frac{\langle f(x), X_{n}(x) \rangle}{\langle X_{n}(x), X_{n}(x) \rangle}\\\amp= \frac{\int_{0}^{L} f(x) \sin (2n-1)\pi x/(2L) \, dx }{\int_{0}^{L} \sin^{2} (2n-1)\pi x/(2L) \, dx }\\\amp= \frac{2}{L}\int_{0}^{L} f(x) \sin \frac{(2n-1)\pi x}{2L}\, dx \end{aligned}
\end{equation*}
To summarize, the solution to the 1D wave equation
\begin{equation*}
\frac{\partial^{2} u}{\partial{t}^{2}}= c^{2} \frac{\partial^{2} u}{\partial{x}^{2}}
\end{equation*}
with boundary conditions
\begin{equation*}
u(0,t) = 0, \quad u_{x}(L,t) = 0, \qquad \text{for $t \geq 0$}
\end{equation*}
and initial conditions
\begin{equation*}
\begin{aligned} u(x,0)\amp= f(x) \qquad \text{for $0 \leq x \leq L$ }\\ u_{t}(x,0)\amp= 0 \qquad \text{for $0 \leq x \leq L$} \end{aligned}
\end{equation*}
is
\begin{equation*}
u(x,t)= \sum_{n=1}^{\infty}a_{n} \cos c \frac{(2n-1)\pi}{2L}t \sin \frac{(2n-1)\pi x}{2L}
\end{equation*}
where
\begin{equation}
a_{n}= \frac{2}{L}\int_{0}^{L} f(x) \sin \frac{(2n-1)\pi x}{2L}\, dx\tag{9.2.8}
\end{equation}
Example 9.2.3.
Find the solution to the 1D wave equation with free boundary condition at \(x=1\) if
\begin{equation*}
f(x)= x^{2}\qquad\text{for $0 \leq x \leq 1$}
\end{equation*}
Solution.
In this case, we only need to find the constants
\(a_{n}\) as defined in
(9.2.8),
\begin{equation*}
\begin{aligned}
a_{n}\amp= 2 \int_{0}^{1} x^{2} \sin \frac{(2n-1)\pi x}{2}\, dx \\\amp= \frac{(-1)^{n} (8\pi + 16\pi n) -16}{(2n-1)^{3} \pi^{3}}
\end{aligned}
\end{equation*}
So the full solution to this wave equation is
\begin{equation*}
u(x,t)= \sum_{n=1}^{\infty}\frac{(-1)^{n} (8\pi + 16\pi n) -16}{(2n-1)^{3} \pi^{3}}\cos c \frac{(2n-1)\pi}{2L}t \sin \frac{(2n-1)\pi x}{2L}
\end{equation*}