---
title: "Wave Equation"
type: concept
related: [Wave Equation, Heat Equation, Partial Differential Equations]
source: https://www.jemoka.com/posts/kbhwave_equation/
confidence: high
status: active
---

If we write it in a single set of variables:
\begin{equation} \pdv[2]{u}{t} = \pdv[2]{u}{x} \end{equation}
At a glance, for Dirichlet Conditions:
\begin{equation} u(t,x) = \sum_{k} \qty(a_{k} \sin \qty(\frac{ck\pi}{l} t) + b_{k} \cos \qty(\frac{ck\pi}{l} t)) \sin \qty( \frac{k \pi}{l}x) \end{equation}
this takes two initial condition:
\begin{equation} u(0,x) = \sum b_{k} \sin \qty( \frac{k\pi x}{l}) = f(x) \end{equation}
\begin{equation} \pdv{u}{t}(0,x) = \sum a_{k} \frac{ck \pi}{l} \sin \qty( \frac{k\pi x}{l}) = g(x) \end{equation}
meaning:
\begin{equation} b_{k} = \frac{2}{l} \int_{0}^{l} f(x) \sin \qty( \frac{k\pi}{l} x) \dd{x} \end{equation}
and:
\begin{equation} a_{k} = \frac{2}{k\pi c} \int_{0}^{l} h(x) \sin \qty( \frac{k\pi}{l} x) \dd{x} \end{equation}
which now finishes our initial conditions.
Importantly, as we have a SECOND ORDER expression now, we need two initial conditions with initial amplitude and velocity.
d&rsquo;alembert&rsquo;s formula The general solution to the wave equation, with:
\begin{equation} \pdv[2]{U}{t} = c^{2} \pdv[2]{U}{x} \end{equation}
with \(U(0,x) = f_0(x)\), and \(\pdv{U}{t}(0,x) = f_1(x)\) is:
\begin{equation} U(t,x) = \frac{1}{2} \qty(f_0 (x+ct) + f_0 (x-ct)) + \frac{1}{2c} \int_{x-ct}^{x+ct} f_1(y) \dd{y} \end{equation}
damping see damped wave equation
solving wave equation Recall:
\begin{equation} \pdv[2]{u}{t} = c^{2} \pdv[2]{u}{x} \end{equation}
where \(c^{2}\) is called the &ldquo;wave speed&rdquo;. Let&rsquo;s start with the Dirichlet Conditions.
Unlike the Heat Equation, Wave Equation are time reversible (i.e. time going forward and backwards should have no difference). Any solutions that go forward in time also satisfy for going backwards in time.
Let&rsquo;s try to solve it. Guess:
\begin{equation} u = A(t) B(x) \end{equation}
meaning, we have:
\begin{equation} A&rsquo;&rsquo;(t) B(x) = c^{2} A(t)B&rsquo;&rsquo;(x) \end{equation}
This finally gives:
\begin{equation} \frac{A&rsquo;&rsquo;(t)}{A(t)} = c^{2} \frac{B&rsquo;&rsquo;(x)}{B(X)} = \lambda \end{equation}
which gives:
\begin{equation} B&rsquo;&rsquo;(x) - \frac{\lambda}{c^{2}} B(x) = 0 \end{equation}
we can only solve this, given our boundary conditions:
\begin{equation} \lambda = \frac{-c^{2} k^{2} \pi^{2}}{l^{2}} \end{equation}
which gives:
\begin{equation} B(x) = \sin \qty( \frac{k \pi}{l}x) \end{equation}
and \(A\) will result in a second order equation (unlike before):
\begin{equation} A&rsquo;&rsquo;(t) + \frac{c^{2} h^{2} \pi^{2}}{l^{2}} A(t) = 0 \end{equation}
This gives generally a solution:
\begin{equation} A(t) = c_1 \sin \qty(\frac{ck\pi}{l} t) + c_2 \cos \qty(\frac{ck\pi}{l} t) \end{equation}
Therefore, multiplying everything out:
\begin{equation} u(t,x) = \sum_{k} \qty(c_1 \sin \qty(\frac{ck\pi}{l} t) + c_2 \cos \qty(\frac{ck\pi}{l} t)) \sin \qty( \frac{k \pi}{l}x) \end{equation}
meaning: the overall oscillation is controlled by the wave speed, which changes in time but not space.
Finally, note that:
\begin{equation} u(0,x) = \sum b_{k} \sin \qty( \frac{k\pi x}{l}) = f(x) \end{equation}
Consider the \(t\) derivative as well:
\begin{equation} \pdv{u}{t} = \sum \qty(a_{n} \frac{ck\pi}{l} \cos \qty( \frac{ck \pi}{l} t) - b_{k}\frac{k\pi}{l} \sin \qty( \frac{k\pi}{l}t)) \sin \qty( \frac{k\pi}{l} x) \end{equation}
now, this gives us another initial condition:
\begin{equation} \pdv{u}{t}(0,x) = \sum a_{k} \frac{ck \pi}{l} \sin \qty( \frac{k\pi x}{l}) = g(x) \end{equation}
which now finishes our initial conditions.
General Standing Wave Solution Because the PDE given is linear, solutions compose, and we note that any scale of \(\cos kt \sin kx\) will compose.
\begin{equation} u(t,x) = \sum_{k=0}^{\infty} a_{k} \cos kt \sin kx \end{equation}
Fourier Series \begin{equation} u(o,x) \sum_{k} a_{k}\sin kx \end{equation}
BIG stunning conclusion: every single function, including wack ones, can be decomposed. See Fourier Series
General Traveling Wave Solution \begin{equation} u(t,x) = \sin (x-t) w(x-t) \end{equation}
as long as \(w\) is a valid twice-differentiable solution, plugging its derivative in will resolve as well.
Composition \begin{equation} \sin (x-t) + \sin (x+t) = \sin x \cos t - \cos x \sin t + \sin x \cos t + \cos x \sin t = 2 \sin x \cos t \end{equation}
