Deriving the Wave Equation
From a vibrating guitar string to the equation that governs wavesJune 10th, 2026In the last post I built the heat equation from scratch and discussed how a neural network learns to mimic its smoothing behaviour. I ended that post on a remark that I want to pick back up here, because it turns out to be the whole story: the heat equation is only one PDE among many, and the thing that gives a PDE its physical personality is the spatial operator sitting on the right-hand side, paired with the time derivative sitting on the left. There is three types of PDEs that are most common in physics, which are defined as:
- Parabolic PDEs: first time derivative, second spatial derivative (e.g. the heat equation), where information spreads out infinitely fast and everything eventually settles down to a uniform state.
- Elliptic PDEs: no time derivative, second spatial derivative (e.g. Laplace's equation), where information is instantaneously balanced across space and the solution is a static equilibrium.
- Hyperbolic PDEs: second time derivative, second spatial derivative (e.g. the wave equation), where information travels at a finite speed and disturbances can bounce around without ever settling down.
Which type of PDE we are talking about, always comes down to what happens if we keep almost everything the same, but change one small thing on the left side. The heat equation has a first derivative in time. What if we put a second derivative in time instead?
Let me put the two side by side so you can see exactly how small the change looks on paper:
\(\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2}\)(1)where \(u\) denotes the quantity we are tracking (temperature in the heat case), \(t\) denotes time, \(x\) denotes position in space, \(\frac{\partial u}{\partial t}\) denotes the first derivative in time (how fast the value changes), \(\alpha\) denotes the thermal diffusivity constant, and \(\frac{\partial^2 u}{\partial x^2}\) denotes the spatial curvature (how much the value at a point differs from the average of its neighbours).
\(\frac{\partial^2 u}{\partial t^2} = c^2 \frac{\partial^2 u}{\partial x^2}\)(2)where \(\frac{\partial^2 u}{\partial t^2}\) denotes the second derivative in time (the acceleration of the value, not just its rate of change), \(c\) denotes a constant that will turn out to be the speed the wave travels at, and the right-hand side \(\frac{\partial^2 u}{\partial x^2}\) is the exact same spatial curvature term as before.
That single swap — first time derivative becomes second time derivative — is the entire difference between heat and waves. And yet the behaviour could not be more different. The heat equation takes any sharp bump and irons it flat until everything is uniform. The second equation, the wave equation, takes a bump and makes it travel, holding its shape, bouncing off walls, refusing to settle down.
What Is a Wave?
Before any math, I want to clear up the single most part, that confused m about waves. The question is simple: what is it that actually moves when a wave travels?
The answer is that the material does not travel. Only the disturbance pattern travels through the material. Now I know, that you probably somewhat knew that already, but really think through it in detail.
Take a guitar string. When you pluck it, nothing about the string flies across the room — every point of the string stays roughly where it was, attached at both ends, just moving up and down a little. What changes along the string is the shape: the pattern of which parts are currently up and which are currently down. The string is what we call the medium. The travelling shape is the disturbance, or the wave itself.
That vibrating string again, emits a completely seperate signal into the air, which is a sound wave. But now the air suddenly becomes the medium and all the little molecules start getting displaced by the vibration.
However, the guitar string and the sound wave are governed by the same wave equation. All it cares about is that there is some quantity that gets displaced from rest, and some restoring force that tries to pull it back. We will see this restoring force appear explicitly when we derive the equation — for the string it is the tension pulling sideways, for air it is the pressure pushing back when you compress it.
One more thing that confused me: If the disturbance pattern travels along the string, why does a plucked guitar string look like it is just sitting there vibrating in place, rather than the shape visibly bouncing off the ends? The answer is that the string is fixed at both ends, so the travelling wave hits an end, reflects, and comes back. At any moment you actually have two waves on the string at once — one travelling left, one travelling right — passing through each other. When they overlap, they add together into a pattern that appears to stand still and merely pulse up and down. This is called a standing wave, and the illusion of a stationary vibration is just two travelling waves interfering. The specific frequency at which this happens is what your ear hears as the pitch of the note. So even the "stationary" guitar string is really made of travelling waves — they are just trapped.
The Physical Setup
Let us pin down the object we are studying. Picture a guitar string stretched horizontally and held between two fixed points at the same height: the left end at position \(x = 0\) and the right end at position \(x = L\), where \(L\) denotes the total length of the string.
We describe the string's shape with a function \(u(x, t)\) where \(u\) denotes the vertical displacement of the string — how far up or down a given point has moved away from the flat resting line — \(x\) denotes the horizontal position along the string, and \(t\) denotes time. This is exactly the same kind of object as the temperature field in the heat post: a value defined at every point in space and every moment in time. Feed it a position and a moment, and it hands you back the height of the string there and then.
As always, rather than try to reason about the whole function at once, we zoom in on one tiny piece of it, the little segment sitting between position \(x\) and position \(x + \Delta x\), where \(\Delta x\) denotes a tiny step in position. If we can work out exactly what forces act on this one tiny piece, and apply the law that connects force to motion, we will end up with an equation describing how \(u(x,t)\) behaves everywhere.
Newton's Second Law
The law we need is Newton's second law, usually written \(F = ma\). You most likely learned about it in school, but I will still build it piece by piece, because the wave equation is essentially just these three letters, unpacked and applied to a vibrating string, which in return generalizes to all kinds of waves. Think of it this way> If you know what force acts on every tiny piece of the string, then you can also predict in which state it will be a moment from now, and then you repeat. Same Euler method used for ODEs, now applied to a literal piece of vibrating string.
- Mass. Mass is, first of all, just how much physical stuff an object is made of, measured in kilograms. But there is a second, deeper meaning that matters far more for us: mass measures how strongly an object resists being moved. This resistance is called inertia. A fully loaded shopping trolley is much harder to get rolling — and much harder to stop — than an empty one, even though you push both the same way.
- Force. A force is simply a push or a pull acting on an object. Forces are the cause of acceleration — they are the only thing that can change an object's velocity.
- Velocity. Velocity is how fast something is moving and in which direction, measured in metres per second. A car going 30 metres per second north has a different velocity from one going 30 metres per second south, even though their speeds are equal.
- Acceleration Acceleration is the rate of change of velocity — how quickly the velocity itself is changing, measured in metres per second squared. The crucial thing is that acceleration does not only mean speeding up. Slamming the brakes is acceleration. Turning the steering wheel at constant speed is acceleration, because the direction changed. Any change in velocity at all — faster, slower, or a new direction — counts as acceleration. A car waiting at a red light has zero acceleration; the instant the light turns green and it starts to pull away, its velocity is climbing from zero, and that climb is the acceleration.
Now we can assemble the law:
\(F = m \cdot a\) where \(F\) denotes the total force pushing or pulling on the object, \(m\) denotes the object's mass, and \(a\) denotes its acceleration. In words: the force on something equals how heavy it is multiplied by how fast its velocity is changing. Pause and ponder that for a moment what this really means.
Three Assumptions Before We Touch the Math
Real strings are messy. To get a clean equation, we make three simplifying assumptions. I want to be very explicit about each, because each one quietly removes a complication that would otherwise wreck the derivation.
Assumption 1 — Gravity is negligible. Two kinds of force act on every tiny piece of string: the tension pulling along the string (the taut, stretched-out pull that holds the string tight), and gravity pulling straight down. But the tension in a guitar string is enormous compared to the feather-light weight of a millimetre-long snippet of that string. So we simply pretend gravity is not there. The same move works for sound: the pressure forces inside a sound wave are vastly stronger than the effect of gravity on the air molecules, so acoustics ignores gravity too.
Assumption 2 — Deflections are small. First the word: a deflection is how far something has moved away from its original resting position. The string at rest is a flat horizontal line; when it vibrates, each point deflects a little above or below that line, and that distance is the deflection. Our assumption is that the string never swings wildly — it only ever displaces by a tiny amount compared to its length. Why does this matter so much? Because when the deflections are small, the angles the string makes with the horizontal are also small, and small angles let us make a clean mathematical simplification later (the "small angle approximation").
Assumption 3 — Tension is constant throughout the string. Tension is the magnitude of the taut pulling force along the string; we will call it \(T\). In reality, as a string vibrates, the tension varies slightly from point to point. But because the deflections are small (assumption 2), those variations are also tiny, so we treat \(T\) as having the same value at every point along the string at every moment. This matters because our tiny piece is being pulled by tension at both of its ends; if \(T\) were different at each end, we would have two separate unknowns to juggle. Constant tension means it is one single number \(T\), pulling equally hard at both ends.
The Mass and Acceleration of the Tiny Piece
Now we build the two sides of \(F = ma\) for our tiny piece, starting with the easy \(ma\) half.
First the mass of the piece. We describe how heavy the string is using its linear density \(\rho\), where \(\rho\) denotes the mass per metre of string (kilograms per metre) — a thick heavy string has a large \(\rho\), a thin light one a small \(\rho\). Our tiny piece has length \(\Delta x\), so its mass is just the mass-per-metre times its length:
\(m = \rho \cdot \Delta x\)(3)Now the acceleration of the piece. Remember the piece only moves vertically — up and down — so its position is just its vertical displacement \(u(x, t)\). Velocity is the rate of change of position, which is the first time derivative \(\frac{\partial u}{\partial t}\). Acceleration is the rate of change of velocity, which is the time derivative of that — the second time derivative \(\frac{\partial^2 u}{\partial t^2}\). So the vertical acceleration of our piece is \(\frac{\partial^2 u}{\partial t^2}(x, t)\), which denotes the vertical acceleration of the string at position \(x\) at time \(t\). Notice the second time derivative has appeared naturally — not because we forced it in, but because acceleration is inherently the second derivative of position. This is already a hint about why the wave equation looks the way it does.
Multiplying mass by acceleration gives the whole right-hand side of Newton's law:
\(m \cdot a = \rho \cdot \Delta x \cdot \frac{\partial^2 u}{\partial t^2}\)(4)where \(\rho\) denotes the linear density, \(\Delta x\) denotes the length of the tiny piece, and \(\frac{\partial^2 u}{\partial t^2}\) denotes its vertical acceleration.
So we now have the \(ma\) side completely. The plan from here is to find a separate, independent expression for the actual force \(F\) — the real tension forces tugging on the piece. Once we have both, we set them equal, and the wave equation falls straight out.
The Forces: Tension Pulling at Two Angles
Our tiny piece has two ends: a left end at \(x\) and a right end at \(x + \Delta x\). At each end, the rest of the string yanks on the piece with the tension force \(T\), pulling along the direction of the string at that point. Here is the key geometric fact: because the string is curved while vibrating, the direction of the string is slightly different at the two ends. At the left end the string is tilted at some angle \(\theta\) above the horizontal, and at the right end, a little distance \(\Delta x\) away, the string has curved a bit, so it is tilted at a slightly different angle \(\theta + \Delta\theta\), where \(\theta\) denotes the tilt angle of the string at the left end and \(\Delta\theta\) denotes the small change in that angle over the length of the piece.
A tension force pulling at an angle has two ingredients to it: how much of it pulls horizontally, and how much of it pulls vertically. To split it up, here is a clean way to think about it using the unit circle. The plain unit circle has radius \(1\), and a point on it at angle \(\theta\) sits at horizontal coordinate \(\cos(\theta)\) and vertical coordinate \(\sin(\theta)\) — that is just what sine and cosine mean. Our tension is like an arrow of length \(T\) pointing at angle \(\theta\), so it is the same picture scaled up from radius \(1\) to radius \(T\). Its horizontal component is \(T\cos(\theta)\) and its vertical component is \(T\sin(\theta)\).
We only care about the vertical components, because (from our setup) the piece only accelerates up and down — the horizontal pulls at the two ends essentially cancel and do not move the piece sideways. The right end pulls the piece with vertical force \(T\sin(\theta + \Delta\theta)\), and the left end pulls with vertical force \(T\sin(\theta)\) but in the opposite sense, so the net vertical force is the difference:
\(F = T\sin(\theta + \Delta\theta) - T\sin(\theta)\)(5)where \(F\) denotes the net vertical force on the tiny piece, \(T\) denotes the (constant) tension, \(\theta\) denotes the string's tilt angle at the left end, and \(\Delta\theta\) denotes the change in tilt angle from the left end to the right end.
← slide to move the segment along the string →
The Small Angle Approximation
Here is where assumption 2 (small deflections) earns its keep. When an angle \(\theta\) is very small, it is a standard fact that
\(\sin(\theta) \approx \tan(\theta)\)Recall what tangent means: It is the vertical component of the point on the unit circle at angle \(\theta\), divided by the horizontal component. It's essentially the slope of the line from the origin to that point. For small angles, the point on the unit circle is very close to the horizontal axis, so the vertical component and the slope are both almost zero and the same number.
The good thing about this is, that if you take a look at the visualization of the tension forces acting on both ends of the tiny piece, you can see that we simply scale the unit circle up to radius \(T\), so that the tension force can simply be described by the slope of the string at that point, multiplied by the tension magnitude. The small angle approximation lets us swap the sine for the tangent, which is the slope, which is something we can connect to the shape of the string.
\(\sin(\theta) \approx \tan(\theta) = \frac{\partial u}{\partial x}\)(6)where \(\sin(\theta)\) denotes the vertical fraction of the tension at tilt angle \(\theta\), \(\tan(\theta)\) denotes the string's slope at that point, and \(\frac{\partial u}{\partial x}\) denotes the spatial slope of the displacement (how steeply the string rises or falls as you move along it).
Now we substitute this back into the net-force expression from the previous section, replacing each \(\sin\) with the corresponding slope. The right end's slope is taken at position \(x + \Delta x\) and the left end's slope at position \(x\):
\(F = T \cdot \frac{\partial u}{\partial x}(x + \Delta x, t) - T \cdot \frac{\partial u}{\partial x}(x, t)\)(7)where \(F\) denotes the net vertical force on the tiny piece, \(T\) denotes the constant tension, \(\frac{\partial u}{\partial x}(x + \Delta x, t)\) denotes the slope of the string at the right end of the piece, and \(\frac{\partial u}{\partial x}(x, t)\) denotes the slope at the left end. In plain words: the net vertical force on the piece is the tension multiplied by the difference in slope between its two ends. That phrase — difference in slope between two ends — is worth holding onto, because it is about to turn into something we have already seen.
Setting the Two Sides Equal and Taking the Limit
We now have both halves of Newton's law for the tiny piece. The \(ma\) side and the \(F\) side describe the same piece, so we set them equal:
\(\rho \cdot \Delta x \cdot \frac{\partial^2 u}{\partial t^2} = T \cdot \frac{\partial u}{\partial x}(x + \Delta x, t) - T \cdot \frac{\partial u}{\partial x}(x, t)\)(8)where the left side is mass times vertical acceleration, with \(\rho\) the linear density, \(\Delta x\) the piece length, and \(\frac{\partial^2 u}{\partial t^2}\) the vertical acceleration; and the right side is the net tension force, with \(T\) the tension and the two slope terms as defined above.
Now divide both sides by \(\Delta x\):
\(\rho \cdot \frac{\partial^2 u}{\partial t^2} = T \cdot \frac{\frac{\partial u}{\partial x}(x + \Delta x, t) - \frac{\partial u}{\partial x}(x, t)}{\Delta x}\)(9)where every symbol is as before, and the right side is now the difference in slope between the two ends, divided by the distance \(\Delta x\) between them.
Look hard at that right-hand fraction, because we have seen its exact shape before. It takes a quantity — here the slope \(\frac{\partial u}{\partial x}\) — measures it at \(x + \Delta x\), subtracts its value at \(x\), and divides by the gap \(\Delta x\). That is the definition of a derivative: the rate of change of the slope as you move along the string. And the rate of change of the slope is the rate of change of \(\frac{\partial u}{\partial x}\) — in other words the second spatial derivative. As we shrink the piece down, \(\Delta x \to 0\), the fraction becomes exactly that second derivative:
\(\rho \cdot \frac{\partial^2 u}{\partial t^2} = T \cdot \frac{\partial^2 u}{\partial x^2}\)(10)where \(\rho\) denotes the linear density, \(\frac{\partial^2 u}{\partial t^2}\) denotes the vertical acceleration of the string, \(T\) denotes the tension, and \(\frac{\partial^2 u}{\partial x^2}\) denotes the spatial curvature of the string (the same curvature term from the heat equation — how much a point differs from the average of its neighbours).
One last tidy-up. Divide both sides by \(\rho\), and give the leftover constant \(T/\rho\) a name. We define \(c^2 = \frac{T}{\rho}\), and we land on the wave equation:
\(\frac{\partial^2 u}{\partial t^2} = c^2 \cdot \frac{\partial^2 u}{\partial x^2}\)(11)where \(\frac{\partial^2 u}{\partial t^2}\) denotes the vertical acceleration of the string at a point, \(\frac{\partial^2 u}{\partial x^2}\) denotes the spatial curvature of the string at that point, and \(c^2 = T/\rho\) is a constant built from the tension \(T\) and the linear density \(\rho\), which we will see is the square of the wave's travelling speed.
And here is the payoff for sound. The acoustic wave equation has the very same form, only the displacement \(u\) is replaced by the pressure wobble and the curvature is taken over all three dimensions of space, while \(c\) becomes the speed of sound (built from the air's springiness and density instead of a string's tension and density).
What the Wave Equation Is Actually Saying
Now that we have the equation, let me translate it back into plain physical language, because the math is only worth anything if you can feel it.
The left side is the acceleration of each tiny piece of string. The right side is the spatial curvature of the string at that piece, scaled by \(c^2\). So the equation says: a piece of string accelerates in proportion to how curved the string is right there. Where the string is bent into a sharp peak, the curvature is large and negative, so the piece feels a strong pull back toward flat. Where the string is straight, the curvature is zero, and the piece feels no net force at all. The string is constantly being pulled toward straightening itself out — that is the restoring force from way back at the start, now made precise.
Compare this to the heat equation, and notice the difference is only on the left side. In the heat equation, the curvature drives the first time derivative — the rate of change of temperature. In the wave equation, the very same curvature drives the second time derivative — the acceleration of displacement. That swap is everything.
In the heat equation, a hot peak is told directly "your temperature is dropping," so the peak simply sinks, smooths, and is gone. The curvature controls the value's speed of change, so as soon as the curvature flattens out, all change stops, and the system settles.
In the wave equation, a displaced peak is told instead "you are accelerating back toward flat." So the peak does start moving back toward zero — but acceleration builds up velocity, and by the time the string reaches the flat position it is moving fast and simply overshoots straight through it to the other side. Now it is displaced the opposite way, the curvature flips sign, and it gets accelerated back again. It overshoots again. Nothing ever tells the motion to stop, unless an external force damps it out.
Why a Second Time Derivative Means Finite Speed
There is one more thing the second time derivative buys us, and it is arguably the most important property for everything I want to study later: it makes information travel at a finite speed. In the heat equation, a poke anywhere is, in principle, felt everywhere instantly (the effect is tiny far away, but it is non-zero immediately). In the wave equation, a poke is felt nowhere until the wavefront physically arrives — there is a sharp boundary between the region that has heard the news and the region that has not. Why the difference? It comes down to causality, and it follows from that left-hand side.
In the heat equation the curvature at a point sets the rate of change of the value itself. Curvature acts on the value directly, with no buffer, so any disturbance immediately starts changing values around it, and the influence leaks outward at once. There is a single, direct link from curvature to change.
In the wave equation the curvature does not touch the position directly. It sets the acceleration. And acceleration is two full steps removed from position. First the curvature has to build up some velocity (acceleration integrated once over time). Then that velocity has to build up an actual change in position (velocity integrated a second time over time). That double delay — curvature has to wait for velocity, velocity has to wait for position — means influence cannot teleport. A point cannot move until its neighbour has first picked up speed and then physically nudged it, and that neighbour had to be nudged by its neighbour first, and so on down the line. The disturbance has no choice but to hand itself along the string piece by piece, like a row of dominoes that each have to topple before the next can begin. The speed of that hand-off is precisely
\(c = \sqrt{\frac{T}{\rho}}\)In the next post I will stop deriving any equations and actually solve it — first numerically, the way we discretised the heat equation, and then with the neural-network machinery this whole series has been building toward.