How does one derive the equation for the speed of sound?

In my acoustics books I see

$$c^2 = \frac{\mathrm{d}P}{\mathrm{d}\rho}$$

where $c$ is the speed of sound, $P$ is the pressure and $\rho$ is the density. Where does this equation come from? In my books it appears almost as a definition. Could you explain this, or at least point me to an article or a book that addresses this question? Thanks.

-
It's from the ideal gas law and the defn of specific heats = Newton-Laplace formula. the derivation isn't hard but is lots of latex and i have to go in a minute –  Martin Beckett Apr 11 '12 at 2:43
@MartinBeckett: It is not. You are just quoting the suboptimal presentation on Wikipedia. The ideal gas law has nothing to do with it. –  Ron Maimon Apr 11 '12 at 7:18
It starts with PV^(Cp/Cv) = constant, which is a pretty fundemental gas law and then considering a small change in volume –  Martin Beckett Apr 11 '12 at 14:55
@MartinBeckett: Except it works in more generality than ideal gasses-- it works in any material where there is a $dP/d\rho$, and this is what OP is asking. –  Ron Maimon Apr 11 '12 at 19:14

This derivation is often neglected, because it is slightly involved (for an ungergraduate presentation) in Newton's way of thinking, with explicit forces, although this is how Newton did it, and it is a little too trivial if you use stress tensor concepts. I will use the stress tensor concept.

Momentum is a conserved quantity, and you should be familiar with the conservation law in differential form:

$$\partial_t \rho + \partial_i J^i = 0$$

Where the repeated i index is summed (Einstein convention). This is clearest in space-time, where the density $\rho$ becomes the time component of a 4-vector, but it is just as true in Galilean Newtonian mechanics.

For momentum, you have three separate conserved momentum densities $p^i$ which obey a conservation law:

$$\partial_t p^j + \partial_i T^{ij} = 0$$

Where the interpretation of $T^{ij}$ is that it is the flow of the i'th component of p in the j direction. There are three equations, since there are three separate conserved quantities--- the x,y,z momentum.

If you compress a region of air, you get a little bit more pressure. The form of pressure is a diagonal stress density, by rotational symmetry (it is also intuitive--- pressure pushed out--- so x-momentum goes in the x direction, y-momentum goes in the y-direction and so on).

The stress T for a pressure is therefore

$$T^{ij} = P(\rho) \delta^{ij}$$

If the material starts out at position x (at each x there is a different infinitesimal volume of material) and the material which would be at x when everything is still is moved at time t to x+\delta X(x,t), then the momentum density is

$$p^{i} = \rho {\partial_t X(x,t)}$$

Assuming $\rho = \rho_0(1 - \delta v)$ where the infinitesimal volume compression, which gives the change in the density, is given by the divergence of X (this is geometrically clear if you draw a picture, or just from the definition of divergence)

$$\delta v = \partial_j X^j$$

To first infinitesimal order, then the pressure is

$$P (\rho) = P(\rho_0) - C\delta v = P(\rho_0) - C \partial_i X^i$$

Where $C= {dP\over d\rho}$

Now, for mathematical convenience (I do not want to deal with transverse sound), consider reducing to one dimension. In this case X(x) is just a one-dimensional function that tells you the displacement, and the stress is just $T^{11} = \rho_0 \partial_x X$ (the flow of x-momentum in the x-direction).

The continuity equation in 1d gives you

$$\rho_0 \partial^2_t X - \rho_0 C \partial^2_x X = 0$$

And this is the wave equation with the speed of sound squared equal to C. You can repeat the 1d analysis with detailed forces, not using the slightly more abstract continuity equation, and this is what Newton did to find the speed of sound way back when.

To see that the one dimensional equation above describes waves moving with a speed $\pm \sqrt{C}$, consider the functional form of such a wave moving with velocity c:

$$\phi(x,t) = f(x-ct)$$

where f is a function of one dependent variable. Differentiate twice in time

$$\partial^2_t \phi = c^2 f''$$

and twice in space:

$$\partial^2_x \phi = f''$$

and you see that it satisfies the wave equation:

$$\partial^2_t \phi - c^2 \partial^2_x \phi = 0$$

The general solution to the 1d equation can be expressesed as the sum of a left-moving and a right-moving wave. This can be used to match any initial conditions of $\phi$ and $\partial_t\phi$, and is therefore the general form. You can derive the general solution from a systematic general theory using Fourier transforms, by considering plane waves.

-
Elegant enough, Ron, +1. Maybe one should also explain why the wave equation at the end implies the right speed, e.g. by taking the solutions $\cos(kx-\omega t)$ and showing that $\omega/k=v$ has to agree with the coefficient obtained from $C$ for the equation to hold. –  Luboš Motl Apr 11 '12 at 8:33
@LubošMotl: Ok, I'll do it, if you think its necessary –  Ron Maimon Apr 11 '12 at 15:38
Stop mucking with this--- $\delta v$ is not a change in volume, it is a dimensionless factor defined in the answer. I do not like $\delta v\over v$, this is introducing an extra symbol for no reason. –  Ron Maimon Sep 25 '12 at 8:46