Types of Waves¶
Disturbance of a medium: sound waves, waves on a guitar string, waves propagating on the surface of water.
Quantum mechanical waves: described by complex wavefunctions, which explain the wave-like behavior of electrons and atoms.
Electromagnetic waves (e.g. light, UV, X-rays): the only kind of wave that does not require a medium! EM waves can travel in vacuum. In a sense, an EM wave “rolls out its own carpet,” creating its own medium as it moves forward.

Figure 1:1D traveling and standing waves. Traveling waves move with respect to a fixed reference frame, while standing waves oscillate in place.

Figure 2:Transverse waves carry a disturbance perpendicular to the direction of propagation. Longitudinal waves carry a disturbance along the direction of propagation.
Defining a wave mathematically¶
Since a wave is a moving disturbance , we describe this disturbance (e.g. vertical displacement) as a function of space and time via some mathematical function :
Imagine surfing on an ocean wave. For an observer (surfer) standing on the wave, the wave stays still at the same coordinate .
For an observer standing on the shore, the coordinate of the wave front moves away with a constant velocity:
Assuming that the shape of the wave stays the same, we can express the motion of the wave in the reference frame of the stationary observer:
To see why implies motion to the right, take a constant front of the wave , which shows that ; the same reasoning applied to gives motion to the left.
Source
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML, display
# Wave shape (Gaussian)
def f(x):
return np.exp(-x**2)
# Parameters
v = 1.0
x = np.linspace(-10, 10, 600)
t_step = 0.08
n_frames = 150
# Figure
fig, ax = plt.subplots(figsize=(6, 4))
(line_right,) = ax.plot([], [], lw=2, label=r"$f(x-vt)$ (right)")
(line_left,) = ax.plot([], [], lw=2, ls="--", label=r"$f(x+vt)$ (left)")
ax.set_xlim(-10, 10)
ax.set_ylim(-0.1, 1.1)
ax.set_xlabel("x")
ax.set_ylabel("u(x,t)")
ax.legend(loc="upper right")
ax.set_title("Traveling waves: $f(x\mp vt)$")
def init():
line_right.set_data([], [])
line_left.set_data([], [])
return line_right, line_left
def update(frame):
t = frame * t_step
line_right.set_data(x, f(x - v*t)) # right-moving
line_left.set_data(x, f(x + v*t)) # left-moving
return line_right, line_left
ani = FuncAnimation(fig, update, frames=n_frames, init_func=init, blit=True, interval=40)
# >>> Display as inline HTML (no saving needed)
display(HTML(ani.to_jshtml()))
plt.close(fig)<>:25: SyntaxWarning: invalid escape sequence '\m'
<>:25: SyntaxWarning: invalid escape sequence '\m'
/tmp/ipykernel_2971/574773477.py:25: SyntaxWarning: invalid escape sequence '\m'
ax.set_title("Traveling waves: $f(x\mp vt)$")
Periodic traveling waves¶

Figure 3:A wave that is periodic in both space and time.
We will work a lot with periodic waves, whose periodic shape can be described by a sine, a cosine, or their combination. Here is a general expression for a sine wave:
Let us now turn this sinusoidal form into a wave traveling along the axis:
Amplitude : specifies maximum disturbance.
Wave number : specifies periodicity in space.
Angular frequency : specifies periodicity in time.
Initial phase : where the wave starts at , . Often we just set .
When describing waves, it is much more convenient to work with the complex representation. One can always extract the real or imaginary part after the calculations.
We can visualize the sine and cosine components of the complex exponential and also visualize the phasor, the change of the exponential driven by the change in for any fixed value of .
Source
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML, display
# -----------------------
# Parameters
# -----------------------
k = 2 * np.pi / 5.0 # wavenumber
omega = 2 * np.pi / 3.0 # angular frequency
x = np.linspace(-10, 10, 600)
x0 = 0.0 # fixed position for phasor
t_step = 0.08
n_frames = 140 # keep size reasonable for inline JS
# -----------------------
# Figure with two subplots
# -----------------------
fig, (ax_wave, ax_phasor) = plt.subplots(1, 2, figsize=(10, 4))
# Left subplot: real and imaginary parts
(line_real,) = ax_wave.plot([], [], lw=2, label="Re$\\{e^{i(kx-\\omega t)}\\}$")
(line_imag,) = ax_wave.plot([], [], lw=2, ls="--", label="Im$\\{e^{i(kx-\\omega t)}\\}$")
ax_wave.set_xlim(x.min(), x.max())
ax_wave.set_ylim(-1.2, 1.2)
ax_wave.set_xlabel("x")
ax_wave.set_ylabel("Amplitude")
ax_wave.set_title("Real and Imaginary Parts vs x")
ax_wave.legend(loc="upper right")
# Right subplot: phasor
theta = np.linspace(0, 2*np.pi, 400)
ax_phasor.plot(np.cos(theta), np.sin(theta), lw=1) # unit circle
(point_line,) = ax_phasor.plot([], [], lw=2) # line from origin to tip
(point_tip,) = ax_phasor.plot([], [], marker='o', lw=0)
ax_phasor.set_aspect('equal', 'box')
ax_phasor.set_xlim(-1.2, 1.2)
ax_phasor.set_ylim(-1.2, 1.2)
ax_phasor.set_xlabel("Re")
ax_phasor.set_ylabel("Im")
ax_phasor.set_title(f"Phasor at x0 = {x0}")
def init():
line_real.set_data([], [])
line_imag.set_data([], [])
point_line.set_data([], [])
point_tip.set_data([], [])
return (line_real, line_imag, point_line, point_tip)
def update(frame):
t = frame * t_step
phase = k * x - omega * t
# Left subplot updates
line_real.set_data(x, np.cos(phase))
line_imag.set_data(x, np.sin(phase))
# Right subplot updates (phasor at x0)
angle = k * x0 - omega * t
z = np.cos(angle) + 1j*np.sin(angle)
point_line.set_data([0, z.real], [0, z.imag])
point_tip.set_data([z.real], [z.imag])
return (line_real, line_imag, point_line, point_tip)
ani = FuncAnimation(fig, update, frames=n_frames, init_func=init, blit=True, interval=40)
# Display as inline HTML JS animation; then close to avoid duplicate static rendering
display(HTML(ani.to_jshtml()))
plt.close(fig)Periodicity in space and time¶
Sine and cosine traveling waves are periodic in space and in time. We introduce two quantities that quantify these periodicities.
A periodic wave repeats itself at intervals , which is the definition of the wavelength.
Mathematically this means that every wavelength in space the wave repeats its pattern: .
A periodic wave repeats itself at regular time periods or frequencies .
Mathematically this means that after every period the wave repeats its pattern: .
The following expression makes it explicit that the wave repeats itself in space at every multiple of , and in time at every multiple of :
Wave equation¶
We obtain the equation of motion by using the chain rule and taking partial derivatives of with respect to and .
Waves satisfy a wave equation
Just as in classical mechanics, we need to take a second derivative in order to get the equation of motion, which is determined by the initial position and velocity. By using the chain rule and taking one more derivative with respect to and , we obtain:
We just obtained the 1D classical wave equation. Solutions of this equation are functions of time and space called wave functions.
Combining waves: interference¶
We are often interested in the result of multiple waves interacting with one another, which can be described mathematically by adding up the waves.
Combining waves creates a new wave that again obeys the wave equation. This is known as the linear superposition principle: if waves and are both solutions of the wave equation, then so is the wave .
Interference: a phenomenon of combining waves that results in a new wave of greater, lower, or the same amplitude.

Figure 4:Constructive vs. destructive interference of two cosine waves and differing only in phase . When the waves differ in phase by , they completely cancel each other. When the waves are fully in phase (), constructive interference doubles the amplitude: .

Figure 5:Combining waves produces a new wave, shown in both the complex and real representations.
Wave interference: derivation
Given the two waves:
We want to sum them:
Step-by-Step Derivation
Factor out the common exponential term :
Use the exponential addition identity:
We can rewrite the sum of two exponentials with different phases and as follows:
Simplify the remaining terms:
The term in parentheses is a sum of exponentials with opposite signs in the exponents, which is:
Substitute back:
Substitute this back into the expression for :
Combine the exponents:
Finally, combine the exponents into one:
Note that if the phases differ by we get zero amplitude (complete destructive interference). On the other hand, when they match, the amplitude is doubled.
Conclusion
Thus, the sum of two complex exponentials with different phases and can be expressed as a single complex exponential with the total phase and an amplitude modulated by .

Figure 6:Illustration of wave interference.
Problems¶
Problem 1: Traveling or standing¶
Which of these functions can describe a traveling wave: , , , and with what velocity?
Solution 1
If a function can be cast in the form , then it can describe a wave propagating with constant velocity along the axis.
describes a wave traveling in the direction opposite to the axis with velocity equal to 1.
describes a wave traveling in the direction of the axis with velocity equal to 2.
describes a standing wave.
Problem 2: Wavelength and frequency¶
Given a traveling sine wave , extract its wavelength, frequency, velocity, and amplitude.
Solution 2
Traveling waves have the functional form , where and .
Now we can just read off the quantities:
read off from the sine argument
, the multiplier in front of the sine function
hence
hence