The String Equation

Apparently, a developing theme of this blog is that I don’t like using Newtonian methods for continuum mechanics problems.

Let’s now derive the string equation.  Wikipedia, say, does it with vector diagrams (this source uses the same derivation, too).  We’ll do it with a method that’s closer to what we’ve been using for other problems.

Here’s the model:

We divide the string into a bunch of springs.

The tension in the string is represented by the springs.  The mass of the string we’ll treat as being point masses between the springs.

(Note: There is a very high probability that I will mix up the words “spring” and “string” in this post)

The (linear mass) density of the string is rho, so the total mass of the string is rho times L, so the mass in one differential bit is rho-L / n.

We assume the string is tensioned even if it is completely flat between the two ends.  This means the string is not at its natural length, but is delta longer.  By Hooke’s law, we can find the (equilibrium) tension in the string:

T=F=k \Delta

We’ll say that k is the spring constant for the entire string, so the spring constant for the little springs is k-n.  Delta is the deviation of the entire string from its natural length, so delta/n is the share for each individual spring.

We find the additional distortion by using the diagram and the Pythagorean theorem.

This means that the potential energy in a spring (when the string is vibrating) is

dU = \frac{1}{2}kn (\frac{\Delta}{n} + \sqrt{(\frac{L}{n})^2 +(y_i - y_{i-1})^2 }-\frac{L}{n})^2

The kinetic energy of the point masses is easier to find:

KE = \frac{1}{2} \rho\frac{L}{n} \dot{y}_i^2

The total Lagrangian (we’ll call it F since we’ve already used L to mean the length of the string) is the sum of all kinetic energy terms minus the sum of all potential energy terms.

Then the Lagrange equation for the point mass at yi is

When we plug the Lagrangian into that, the kinetic energy contributes one term due to the partial-with-respect-to-ydot term.  However, the potential energy contributes two terms to the partial-with-respect-to-y term.  This is because each point has two springs connected to it, one on the left and one on the right.

So when we plug in, we get

This looks fairly complicated, but we can re-write it a little.  First, L/n is dx. We can treat the squareroot term as dL (the differential length).  Divide the whole thing by dx and we get

 \rho \ddot{y_i} -kn(-y_{i+1}+2y_i-y_{i-1}) \frac{ \frac{\Delta}{n}+dL-dx}{dL dx}=0


One thing we did when we rewrote that was assume that both dL’s (between i and i-1, and i and i+1) were equal.  This is, of course, not necessarily true.  However, we again (similar to when we derived the Euler-Bernoulli beam equation) are assuming that the angles here are small.  In other words, more like

In most situations with vibrating strings that we’d care about (eg., a vibrating guitar string), this is probably the case.

If angles are small, then dy will generally be small compared to dx, and dL will be approximately dx.  dx is a constant (L/n), so this justifies us considering both dL’s to be equal.  We can substitute all dL = dx in that equation, giving

 \rho \ddot{y_i} = kn(-y_{i+1}+2y_i-y_{i-1}) \frac{ \frac{\Delta}{n}}{dx^2}


kn times Delta/n simply equals k Delta.  We earlier showed that this is the tension in the string.  I think this is interesting:  A standard derivation of the string equation doesn’t even involve the string’s “spring constant”, but we show here that even if you include it, you can replace it with the spring tension instead.

The y terms are a second order difference.

There is one problem with the math so far:  There was a sign error.  Sign errors seem to be extremely easy to make.  I probably “should” go back and edit it out and cover it up, but maybe today I’ll use it as an opportunity to find it.

The error was made after the Euler-Lagrange differential equation was quoted.  There is a minus sign on the partial with respect to yi term, but there is ALSO a minus sign on the potential energy term in the Lagrangian anyway, and they cancel out.  So the next equation should be rho-y-doubledot plus the derivative of the potential energy with respect to yi.

So what we really have at this point is

 \rho \ddot{y_i} = T \frac{ (y_{i+1}-2y_i+y_{i-1})}{dx^2}

Due to the y’s being a second order difference, as n tends to infinity / dx tends to zero, this tends to

 \rho \ddot{y} = T \frac{d^2y}{dx^2}

This is the string equation (and also a type of wave equation).  I suppose we can go the extra distance and solve it, too.

The standard method (and from here on out this will be textbook; we are using no personal tricks here) is to assume that y is a function that is a product of one function that depends only on time, and another that depends only on position.

 y(x,t) = f(x)g(t)

If we plug that into the string equation and divide by y we get

 \rho \frac{g

The left side of the equation depends only on t while the right side depends only on x.  That means you could, for example, hold x constant and vary t.  The right side cannot change, which means the left side cannot, either, and the conclusion is that both sides must equal a constant.

We don’t know what the constant is (yet), but we’ll cheat a little (by anticipating) and say it’s a negative number.


If you’ve solved enough differential equations, it becomes “obvious” that the solution is

 f(x) = A \sin{a x} +B \cos{a x}

The boundary conditions are that the string must have  y=0 at the left and right ends, where it is held down.  If we define the coordinate system so x=0 is the left side and x=L is the right, then y(0) = 0 implies B = 0.

y(L) = 0 implies

 \sin{a L} = 0


 a =\frac{m\pi}{L}

where m is any integer.

Plugging this back into the last equation with g and we get


As before, we can solve this with a sine function.  We have no way of knowing the phase (without an initial condition), but phase has minimal or even no effect on sound.  The circular frequency is

\omega = \frac{m\pi}{L}\sqrt{\frac{T}{\rho}}

So the real frequency is

\nu = \frac{m}{2L}\sqrt{\frac{T}{\rho}}

Of course, usually the loudest frequency produced by a vibrating string is the fundamental, m = 1, unless you force it to vibrate at a higher harmonic.

There is one loose end here.  We solved the string equation by assuming y = f(x)g(t).  What if this isn’t true?  It turns out the string equation is linear, so any solutions to it can be added and produce another solution.  So the most general solution is a sum of solutions of the form we have gotten — this is a Fourier series of the general solution.   Due to the completeness properties of the Fourier series, any valid solution can be expressed this way.


2 thoughts on “The String Equation

  1. Maybe I should make a few more comments on the forensics of tracking down the sign error.

    The kinetic energy must always be positive (or zero); it doesn’t matter what direction the particle is traveling in, any motion causes positive energy. This is satisfied.

    The elastic energy must also always be positive. In general, it can be zero, too, but in this case it cannot because even in equilibrium the string is assumed to be in tension.

    Also, we kind of glossed over this, but we assumed the waves have to be transverse (consist only of y-dimension displacements), not longitudinal. A longitudinal wave consists of alternating compression and tension and can have nodes of zero (local) energy. However, we don’t have to worry about this here.

    So not only does the elastic energy need to be positive, it also must always be greater than or equal to the equilibrium energy. If y(i) = y(i+1), then the elastic energy will equal the equilibrium energy; otherwise, it must be greater.

    The written forms of the potential and kinetic energy do indeed satisfy these conditions.

    The next equation was the Lagrange equation, followed by applying it for this situation, and that was where the error was, so that’s how we could have tracked it down (knowing it couldn’t have been in an earlier step).

  2. Another issue for the guitar is note bending.

    You pull on (or push) a fretted string and the frequency changes. This increases the tension (making the frequency go up) but also the length (making it go down). I would argue that it is thus not a priori obvious which direction the frequency should change if you do this (though everyone knows from experience how it works).

    Without showing my work, the answer is if L > 2 delta, the frequency would go up. If L < 2 delta, it would go down. But think about what this means. Delta = L/2 means the string has been stretched to twice its normal length. This is a huge distortion. You can stretch rubber bands that far (but they are past their proportionality limit in that case, so the math may still need to be redone), but there's no way guitar strings are stretched that far under normal conditions. So bending a guitar string always causes the pitch to go up.

Leave a Reply