Explore the fascinating math behind wave behavior on a guitar string, from deriving the wave equation to understanding how tension and mass density influence vibrations, complete with solutions, simulations, and insights into the physics of string instruments.
The Wave Equation
Disclaimer: math-heavy article, on a topic I learnt about by writing: it might contain errors. Please comment if you see anything not making sense!
The other day, I looked at my guitar, and realized that I didn't known how waves behave on a string, mathematically speaking. How do they propagate? The string is fixed between two points. You pluck the string, by displacing it at a certain point, and letting go. What happens then?
Derivation
Imagine a string with tension T, linear mass density μ. We consider only the vertical displacements of the string, which should stay small (like on a string instrument). We will model our string as a function y, that gives the vertical displacement given coordinate x and time t.
y:[0,L]×R+(x,t)⟶[−ymax,ymax]⟼y(x,t)
Let’s forget time for now, and look at static situations. Here’s a piece of string with tension acting on it on both ends.
Not much is happening here: the string is straight, the forces acting on it even out, everything stays in place. But let’s look at what happens when there’s some curvature.
Here, we imagine the net force would make the piece of string go downwards. We can find the mass of the piece easily: mΔx=μΔx. If we can find the net force acting on it, we’ll be able to apply Newton’s second law.
We’ve made the assumption that the movement of the string is only in the y direction. This means we can consider only the vertical forces acting on the piece, at x0 and x0+Δx.
From this picture, we can see that the vertical fore acting at x0 is Fx0=−Tsin(θ). Knowing that the y displacements are small, we can make the small angle approximation physicists love, and use the slope instead of sin0, and get:
Fx0=−Tdxdy(x0)
We can find the force from the other end the same way1:
Fx0+Δx=Tdxdy(x0+Δx)
We can sum them and get the net force acting on this small piece of string.
Fnet=T(dxdy(x0+Δx)−dxdy(x0))
Great! We have everything we need to apply Newton’s second law. Let’s also put back time into the equation.
In the end, taking a general x instead of x0, our equation becomes:
T∂x2∂2y(x,t)=μ∂t2∂2y(x,t)
Or, as it is more often presented:
∂t2∂2y(x,t)=μT∂x2∂2y(x,t)
This reflects well our early intuition that the more curved the string is at some point, the faster it would move. The higher the tension, the faster, the higher the mass density, the slower. Sanity check: pass.
We can do two things from here, now that we have this partial differential equation: we can stop here, and go simulate it on a computer, or we can try to find explicit solutions.
Solutions
Of course, this equation is ideal, in that it doesn’t reflect all of reality. For example, there’s no damping, and a movement will continue forever. But it’s still useful to understand how waves propagate in this environment, especially if we can find the general form of the solutions.
Separation of variables
Let’s try to simplify the problem by “trying out” the assumption that y can be written as the product of two simpler functions, each depending on only one parameter:
y(x,t)=X(x)T(t)
This severely simplifies the problem and limits the number of forms that y can take. Let’s substitute y for this product in the wave equation:
Each side depends only on one variable, which means they are both equal to the same constant!
Solving each side
Let’s take the left-hand side first
T(t)T′′(t)T′′(t)=α∈R=αT(t)
If we’re looking for a function whose derivative is almost the same, we’re looking at the exponential. Let’s set T(t)=eat. We get that:
a2eat=αeat⟺a2=α
If α>0, we have T(t)=eαt, but we’re probably not looking for an exponential function, as it won’t satisfy our boundary conditions. On the other hand, if α<0, we have T(t)=e±it−α, which looks a lot more like the waves we’ve been talking about.
It makes sens intuitively: if T′′(t)/T(t)>0, the function has a positive curvature when it’s already positive, making it grow even more. In the other case, it has a negative curvature, which is more reminiscent of the restoring force we found in the first part.
For simplicity, let’s set α=−k2, so that we have:
T(t)=e±ikt
We can follow the exact same procedure for X, which is the same equation with a additional multiplicative constant.
X′′(x)=−k2TμX(x)
and try X(x)=ebx
b2ebx=−k2Tμebx⟺b2=−k2Tμ
So that b=±ikTμ . Let’s define λ=kTμ for simplicity.
Our two resulting “elemental” solutions (actually four, counting the signs) are:
T(t)X(x)=e±ikt=e±iλx
But the equation is linear, meaning that any linear composition of these is still a solution. That means our general form is:
We are ready to apply some boundary conditions. First, the string is fixed in place at x=0 and x=L, which means that ∀t we have y(0,t)=y(L,t)=0. The first one translates to:
y(0,t)=X(0)T(t)=(A1+B1)(A2eikt+B2e−ikt)=0
So at least one of the member is null. For the right side to be null would mean that A2=B2=0 which leads to a non-moving string. Other wise, we have B1=−A1, and
X(x)=A1(eiλx−e−iλx)=2iA1sin(λx)=Csin(λx)
Applying the condition from the other end of the string, we get:
X(L)=Csin(λL)=0⟺λL=nπ⟺λ=Lnπ
Which is valid for any n∈N∗, meaning X can be a superposition of those:
X(x)=n∈N∗∑CnsinLnπx
Temporal
If we consider the movement of a guitar string, at the initial pluck, the velocity of the string is 0 everywhere (before the player lets the string go). Which means that T′(0)=0:
Which is a more interpretable form of the solutions: for each frequency, there’s a wave going to the right, and another going to the left. In this form, we can also see that c=μT is the speed at which the wave propagates. Let’s re-write it with that simplification in mind:
y(x,t)=21n∈N∗∑an(sinLnπ(x+ct)+sinLnπ(x−ct))
Actually, we still have an unknown, or rather an infinity of them, namely all the ans. But these can be determined with the initial state of the string y(x,0). If we plug that in, we obtain:
y(x,0)=n∈N∗∑ansin(Lnπx)
Which is just the Fourrier decomposition of the initial state.
Now a bit of fun. By making the domain (both temporally and spatially) discrete, we can model the string at time t by an array y~t∈Rn, where n=ΔxL and Δx is the spatial definition. We can keep track of the vertical speed of the string at any point with another array v~t∈Rn.
This way, we can keep track of the system at time t, and update it based on the previous equation. This is done using a finite-difference approximation of the second spatial derivative (which is just the approximation you get by considering the definition of a derivative)
∂x2∂2y(x,t)≈Δx2y(x−Δx,t)−2y(x,t)+y(x+Δx,t)
From this, using the wave equation, we get an approximation a~(x,t) of acceleration. Integrating once is easily approximated:
∫tt+Δta~(x,t)dt≈a~(x,t)Δt=:Δv~t
This gives us the change of speed, with which we can update our v~t+Δt←v~t+Δv~ and by “integrating” again…
∫tt+Δtv~(x,t)dt≈v~tΔt=:Δy~t
…we get an update to our y by doing y~t+1←y~t+Δy~t and the cycle starts again, approximating the new position and speed at each time step. Of course, all that is of no use if we don’t get to see it in action!
100
4
1
Comparison with a real string
Indeed dxdy(x)=tanθ=cosθsinθ≈sinθ because cosθ≈1 when θ is close to 0.↩
The sign difference comes from the two different directions for tension.↩
Otherwise, both sides of the equation are equal to zero anyway.↩
There’s only one sum because k and λ are linearly dependent.↩