Introduction

People are usually introduced to string vibration in high school physics courses. The famous Giancoli textbook introduces student to fundamental frequency and harmonics of a vibrating string with fixed ends, also known as standing wave.

For example, Harmonics and Patterns from physicsclassroom.com

Personally when I learned it in high school, it didn't actually make sense to me. I was shown that strings vibrate in that particularly way without exactly knowing why or what is the implication of those vibrations until much much later.

I want to write out how to apply Newtonian mechanics on a string under tension and solve for its oscillatory motion as a function of time. Here are the prerequisites to understand what I am going to write.

  • Newton's Second Law of Motion
  • Second-order Ordinary Differential Equation
  • Fourier Analysis

The last time I did this was almost 10 years ago. I will include reference materials I used to refresh my memory.

Problem Statement

We have a guitar string that has two fixed ends. This string is under tension when properly tuned. We want to know its oscillatory motion with respect to time along y-axis along the length of the string, i.e. its vertical displacement if the a small perturbation was applied to the string. Small perturbation means we pluck the string with our finger or pick it with a flat pick.

String

The diagram above depicts a string under tension. For the purpose of simplifying mathematical derivation, we will zoom into a infinitesimal section of the string, between $x$ and $x + dx$ and derives its motion. There are two tension forces acting to pull the small string section down.

Wave Equation

The wave equation is a well studied mathematical model. It has applications in mechnical engineeing like heat and acoustic energy transfer in materials, in electrical engineering where eletromagnetic waves propagate through space, and in quantum mehanics where subatomic particles act as a wavefunction of probability.

Usually people denote $u$ as the quantity to solve for, in our case we call it $y$ because it's the vertical displacemenet of string we are interested in. Thus, our version of wave quation is stated as follows.

$$ \frac{\partial^2 y}{\partial t^2} = c^2 \frac{\partial^2 y}{\partial x^2} $$

The $c^2$ is just a constant where,

$$ c = \sqrt{\frac{T}{\mu}} $$

Model String Motion with Wave Equation

After a small perturbation, the tension of the string acts as a restoration force. If the displacement is small, the horizontal force can be approximated to zero. We only need to consider the vertical force using $y$ to denote vertical displacement.

$$ \Sigma F_y = -Tsin\theta_1 -T'sin\theta_2 = m\frac{\partial^2 y}{\partial t^2} $$

By definition, Newton's Second Law states that force is mass times acceleration.

$$ F = m\frac{\partial^2 y}{\partial t^2} $$

The $m$ stands for mass. This mass refers to the mass of the small section of the string. In general we would want to use mass density $\mu$ to represent it.

$$ \mu = \frac{\partial m}{\partial x} $$

Therefore,

$$ -Tsin\theta_1 -T'sin\theta_2 = \mu dx \frac{\partial^2 y}{\partial t^2} $$

For very small displacement, using small angle approximation, the cosine can be approximated to 1.

$$ T cos\theta_1 \approx T'cos\theta_2 = T $$

If we apply a little algebraic trick to the force equation,

$$ -\frac{F_y}{T} \approx \frac{T sin \theta_1}{T} + \frac{T' sin \theta_2}{T} \approx \frac{T sin\theta_1}{T cos\theta_1} + \frac{T' sin \theta_2}{T' cos \theta_2} = tan \theta_1 + tan \theta_2 $$

This tangent quantity is essentially difference in geometric slope of string $y$ displacement and the $x$ stretching displacement.

$$ tan \theta_1 + tan \theta_2 = -\Delta \frac{\partial y}{\partial x} $$

We arrive at,

$$ -\frac{\mu}{T}\frac{\partial^2 y}{\partial t^2} = \frac{tan \theta_1 + tan \theta_2}{dx} = -\frac{\Delta}{dx}\frac{\partial y}{\partial x} $$

The rightmost term is the definition of the derivative with respect to $x$ since the difference is over an infinitesimal interval $dx$. The expression is literally saying, the change of $\frac{\partial y}{\partial x}$ with respect to an extremely interval of $x$. Now we can simplify the whole force equation down to,

$$ \frac{\mu}{T}\frac{\partial^2 y}{\partial t^2} = \frac{\partial^2 y}{\partial x^2} $$

This is known as the wave equation for the string motion. The solution to wave equation depends on boundary conditions which we will see in the next section. Please keep in mind that we are trying to find a function that represents $y$ as a function of $x$ and time. It describes the movement of string, going up and down in time.

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

String Vibration Solution

Initial & Boundary Conditions (IC & BC)

The wave equation is a second-order ordinary differential equation. This is like the algebra for Calculus. The wave equation alone does not provide any solution to the problem at hand. Solutions are yield when we apply extra constraints like initial conditions and boundary conditions. The unknown is $y$ and this is a second order differential equation so we need at least 2 initial conditions and 2 boundary conditions for our specific case.

Initial Conditions

As one can reason that, horizontal axis $x$ along the string has no dependency on time variable $t$, and vice versa. We can using the following equation to state that observation. The vertical displacement of string is independent of time at $t = 0$.

$$ y(x, t = 0) = f(x) $$

We don't know what is $f(x)$ but we will solve for it. The same logic applies for the velocity of the string. The vertical velocity of string is independent of time at $t = 0$.

$$ \frac{\partial y}{\partial t}(x, t = 0) = g(x) $$

We don't know what is $g(x)$ and we will solve for it.

Boundary Conditions

The boundary conditions are easy to understand. We know there is no displacement at the two ends of the string because they are fixed. We use $L$ to represent the length of the string.

$$ y(0, t) = 0 $$$$ y(L, t) = 0 $$

Ordinary Differential Equation (ODE)

By definition, an ordinary differential equation is a differential equation containing one or more functions of one independent variable and derivatives of those functions. The key insight is that these variables must be independent. For example, time and $x$ are independent in our case.

Homoegenous

An ODE has the following form, where $a$, $b$, and $c$ are arbitrary differentiable functions that do not need to be linear and $y', ..., y^n$ are successive derivatives of the unknown $y$ function of $t$. This equation is said to be homogeneous[1].

$$ a(t)y'' + b(t)y' + c(t)y = 0 $$

With this form, the equation has a general solution that we can simply plug in and solve. We will expand on this general solution a bit later.

References [1]: Elementary Differential Equations, Boyce & DiPrima

General Solution Form

To simplify the mathetical derivation, let's assume $a$, $b$, and $c$ are arbitrary constants because later on the vibration equation will have them as constants. We call $r$ the root of the polynomimal equation which is coming up soon, the general solution has the following form.

$$ (ar^2 + br + c)e^{rt} = 0 $$

The following is known as characteristic equation for the differential equation.

$$ ar^2 + br + c = 0 $$

General Solution with Complex Root

There may exist a complex solution the quadratic equation above, whenever the discriminant $b^2 - 4ac$ is positive. For example,

$$ r = -3 + 6i $$

If $r$ is complex, let's remind ourselves of Euler's equation.

$$ e^{it} = cos(t) + i sin(t) $$

We reshape its form as the following. I am going to introduce some new constants like lambda and mu. If you work out the math, you can show the definition above leads to the following expression.

$$ e^{rt} = e^{(\lambda + i\mu)t} = e^{\lambda t}cos(\mu t) + ie^{\lambda t}sin(\mu t) $$

You can verify the solution by substitute this equation into the original differential equation. This is the general solution to the vibration differential equation.

Final Solution to String Vibration

Separation of variables

Since $x$ and $t$ are independent of each other, this allows us to define the following, where $p$ and $q$ are some unknown functions we need to solve.

$$ y(x, t) = p(x)q(t) $$

Therefore, the wave equation can be expressed like this.

$$ \frac{\partial^2 y}{\partial t^2} = p(x)\frac{\partial^2 q}{\partial t^2} = c^2 \frac{\partial^2 y}{\partial x^2} = c^2 q(t) \frac{\partial^2 p}{\partial x^2} $$

We re-arrange the terms.

$$ \frac{1}{c^2 q(t)} \frac{\partial^2 q}{\partial t^2} = \frac{1}{p(x)}\frac{\partial^2 p}{\partial x^2} = \text{some arbitrary constant} = K $$

We call that constant $K$ for now. Sometimes other people call it $\lambda$ but I don't want to create extra confusion by naming conflicts.

Substitute in General Solution for $p(x)$

For x dependent function, the characteristic equation is

$$ r^2 - K = 0 $$

Thus,

$$ r = \pm \sqrt{K}i $$

Then solution 1 is

$$ p_1(x) = cos(\sqrt{K} x) + i\;sin(\sqrt{K} x) $$

And solution 2 is

$$ p_2(t) = cos(-\sqrt{K} x) + i\;sin(-\sqrt{K} x) $$

But because there exists multiple solutions and any solution can be a linear combination of existing solutions. We want to have real value representation to the solution above. I am not going to dive into the details of the derivation for that mathematical trick here. Please refer to reference[1] for greater mathemtical details.

$$ p(x) = p_1(x) + p_2(x) = c_1 e^{\lambda x} cos(\mu x) + c_2 e^{\lambda x} sin(\mu x) $$

Then now we can express our solution in terms of $\lambda$ and $\mu$. Notice that $\lambda = 0$ in our case.

$$ p(x) = c_1 cos(\sqrt{K} x) + c_2 sin(\sqrt{K} x) $$

Apply Boundary Conditions

To solve for final solution, i.e. to know what $K$ is, we apply boundary conditions.

$$ y(x = 0, t) = y(x = L, t) = p(x = 0\;\text{or}\;x = L)q(t) = 0 $$

It means at the beginning and end of the string, there is no vibration, no vertical movement. This means only the sine term can stay. The following is what fits the boundary condition. Whenever $x = 0$ or $x$ is a $n$ multiple of the string length.

$$ p_n(x) = sin(\frac{n \pi}{L}x) $$

Then we can conclude that

$$ K = \frac{n^2 \pi^2}{L^2} \quad\text{for n = 1, 2, 3, ..., infinity} $$

Solve for $q(t)$

Using the same procedure above, I will skip the tedious part and jump to conclusion.

$$ q_n(t) = c_1 cos(\frac{n \pi c}{L} t) + c_2 sin(\frac{n \pi c}{L} t) $$

Final Solution Part A

$$ y_n(x, t) = p(x)q(t) = \left[ A_n cos(\frac{n \pi c}{L} t) + B_n sin(\frac{n \pi c}{L} t) \right]sin(\frac{n \pi}{L} x) $$

Recall that

$$ c = \sqrt{\frac{T}{\mu}} $$

Thus,

$$ y_n(x, t) = p(x)q(t) = \left[ A_n cos(\frac{n \pi}{L}\sqrt{\frac{T}{\mu}} t) + B_n sin(\frac{n \pi}{L}\sqrt{\frac{T}{\mu}} t) \right]sin(\frac{n \pi}{L} x) $$

Superposition principle states that for all linear systems, the net response caused by two or more stimuli is the sum of the responses that would have been caused by each stimulus individually.

We can represent our complete solution as an infinite summation series of $y_n$, where $n$ ranges from 1 to infinity.

$$ y(x, t) = \Sigma^{\infty}_{n=1} \left[ A_n cos(\frac{n \pi}{L}\sqrt{\frac{T}{\mu}} t) + B_n sin(\frac{n \pi}{L}\sqrt{\frac{T}{\mu}} t) \right]sin(\frac{n \pi}{L} x) $$

I think the most confusing part to most people is the justification for the infinite series as a solution to the wave equation. For example, justifying that infinite sum of solutions to wave equation is also a solution. I think we have to prove that this infinite series is always converging. But I don't think we want to go down that rabbit hole. We have already done plenty math.

Final Part B

We haven't figured out what are the $A_n$ and $B_n$. They are Fourier coefficients of the wave. They represent the contribution strength of each subcomponent wave. We just need to substitute in initial conditions to solve for these arbitrary constants.

Let's apply the first initial condition. We will see that this is just a Fourier series with period equals to the length of the string $L$.

$$ y(x, t=0) = f(x) = \Sigma^{\infty}_{n=1} A_n sin(\frac{n\pi}{L}x) $$

To solve for Fourier coefficient, we apply the following integral.

I am not going to show proof or derivation on Fourier methods here, just to not derail from original topic too much.

$$ A_n = \frac{2}{L} \int^{L}_{0} f(x) sin(\frac{n\pi}{L}x) dx $$

Then we apply the second initial condition. But we actually need to solve for the derivative of $y$ first with respect to time. I will use $c$ as the tension mass constant again to reduce my typing.

$$ \frac{\partial y}{\partial t}(x, t) = \Sigma^{\infty}_{n=1} A_n sin(\frac{n\pi}{L}x)\left( -\frac{n\pi c}{L}sin(\frac{n\pi c}{L} t)\right) + B_n sin(\frac{n\pi}{L}x)\left(\frac{n\pi c}{L} cos(\frac{n\pi c}{L} t)\right) $$

We plug in $t=0$, most sine terms will become zero and we are left with a simple expression.

$$ \frac{\partial y}{\partial t}(x, t = 0) = g(x) = \Sigma^{\infty}_{n=1} B_n sin(\frac{n\pi}{L}x)\frac{n\pi c}{L} $$

This is another Fourier series.

$$ B_n = \frac{2}{L}\int^{L}_{0} \frac{L}{n\pi}\sqrt{\frac{\mu}{T}}g(x) sin(\frac{n\pi}{L}) dx $$

In the subsequent sections, I will use arbitrary $A_n$ and $B_n$ to illustrate the physical phenomenon without having readers to read through another text wall of mathematical derivation.

Connection to Music

Harmonics

Each value of n gives a normal mode of vibration. We called the frequencies of these modes the natural frequencies of the string. When n=1, we call it the fundamental frequency of the string.

$$ f_n = n\frac{1}{2\pi L}\sqrt{\frac{\pi^2 T}{\mu L^2}} = n\frac{1}{2}\sqrt{\frac{T}{\mu L^4}} = n f_0 $$
  • The first harmonic is $f_0$
  • The second harmonic is $f_1$
  • The third harmonic is $f_2$
  • And etc...

If we visualize the harmonics on a string, it would look like this.

Harmonics

As a string vibrates, it produces all those harmonics at once, each harmonic stacks on top of each other. In music we assign each of these natural frequencies(harmonics) a name or interval names like octave, perfect fifth, perfect fourth and etc...

For example, the note A4 has 440Hz as its fundamental frequency.

$$ f_{A4}(n=1) = 440 $$

Its first harmonic has 880Hz which is the frequency of A5.

$$ f_{A4}(n=2) = f_{A5}(n=1) = 880 $$

Its second harmonic has 1320Hz which is the frequency of E6

$$ f_{A4}(n=3) = f_{E6}(n=1) = 1320 $$

Harmonics and Consonance

The harmonics are the normal model of vibration for a string as stated before. This actually implies that if you have two strings, and you tune one string to A4 and another string to A5. The first string is producing a fundamental frequency while the second string is producing a fundamental frequency that is a first harmonic of the first string. These two strings will ring together harmoniously. This is essentially what it means to be in harmony. We produce a set of notes that can stack on each other on the waveform constructively. Our brain will interpret these signals as pleasantly sounding.

We use the term consonance to describe how pleasantly two notes sound together. We use the term dissonance to describe how unpleasantly two notes sound together.

Consonant Intervals of Major Scale

We use a 12-tone equal temperament system in modern music instruments. We choose a note to be our root and use that root(key) as the fundamental frequency of our musical arrangement(song). Here are the 12 different possible intervals or frequency jump if you prefer the mathematical description.

Interval Name Semitones Frequency Ratio with with Respect to Root Example Frequency
Root 0 $2^{0/12}$ A4 440
Minor 2nd 1 $2^{1/12}$ A#4/Bb4 440 * $2^{1/12}$
Major 2nd 2 $2^{2/12}$ B4 440 * $2^{2/12}$
Minor 3rd 3 $2^{3/12}$ C5 440 * $2^{3/12}$
Major 3rd 4 $2^{4/12}$ C#5/Db5 440 * $2^{4/12}$
Perfect 4th 5 $2^{5/12}$ D5 440 * $2^{5/12}$
Tritone 6 $2^{6/12}$ D#5/Eb5 440 * $2^{6/12}$
Perfect 5th 7 $2^{7/12}$ E5 440 * $2^{7/12}$
Minor 6th 8 $2^{8/12}$ F5 440 * $2^{8/12}$
Major 6th 9 $2^{9/12}$ F#5/Gb5 440 * $2^{9/12}$
Minor 7th 10 $2^{10/12}$ G5 440 * $2^{10/12}$
Major 7th 11 $2^{11/12}$ G#5/Ab5 440 * $2^{11/12}$
Octave 12 $2^{12/12}$ A5 440 * $2^{12/12}$

Researches have shown which interval is most consonant.

Consonance Rank

P8 refers to the perfect 8th, or simply called octave. This is basically saying A4 and A5 are most consonant.

The next most consonant note is P5 which is perfect 5th. The ratio is approximately 3/2.

$$ \frac{3}{2} = 1.5 \approx 2^{7/12} = 1.498 $$

The second harmonics of A4 is E6 because of the integer factor of 3.

$$ f_{A4}(n=3) = f_{E6}(n=1) = 1320 $$

But E6 is equivalent to E5 if we lower it by an octave. If A4 is harmonious to E6, and E6 is very harmonious to E5, then we can conclude that A4 is harmonious to E5.

$$ \frac{1}{2} = f_{E5} = \frac{3}{2} f_{A4} $$

Using the same logic, we can show that all the harmonious intervals produce the first natural frequencies of the root note.

References [2]: A biological rationale for musical consonance