Speed of sound in ideal gases The equation of state for an ideal gas is given by:
$$p = \rho r T \tag{1}$$
In the other hand, the speed of sound is calculated by:
$$c = \sqrt{{\partial p\over \partial \rho}}\tag{2}$$
Using (1) we get:
$$c = \sqrt{rT}\tag{3}$$
But in most textbooks, the speed of sound in this case is given by:
$$c = \sqrt{\gamma r T}\tag{4}$$
Where did $\gamma$ in equation (4) come from? what is wrong with my derivation?
I appreciate your help.
 A: The point is that, like most partial derivatives in thermodynamics, the partial derivative $\partial p / \partial \rho$ isn't defined unless you specify what you're keeping constant. 
In your derivation, you kept the temperature constant, so your result corresponds to isothermal sound waves, i.e. sound waves that are slow enough so that thermal conduction can keep the temperature uniform. But it's much more realistic to assume adiabatic sound waves, where there isn't enough time for significant thermal conduction to occur at all (this corresponds to keeping entropy, rather than temperature, constant). The formula involving $\gamma$ assumes adiabatic sound waves.
A: The first answer is entirely correct. We most often assume a so-called isentropic condition, which means that it is adiabatic and reversible. This is a consequence of ignoring losses in our acoustic setup. However, this may not be the case. For an isothermal process there is no temperature change in the domain, and this affects the sound speed.
A: The equation (4) $c = \sqrt{\gamma rT}$ in the OP is a general equation for sound speed.
The equation (3) is achieved under the isothermal assumption where $\gamma = 1$, so that $c = \sqrt{rT} = \sqrt{\dfrac{p}{\rho}}$.
The equation (2) is achieved under the isentropic assumption, where the entropy $s = c_v \ln(Cp/\rho^\gamma)$ is a constant, where $c_v$ is the specific heat for constant volume and $C$ is a constant. In that case, we got $p/\rho^\gamma\equiv \text{const}$, so that $\left(\dfrac{\partial p}{\partial \rho}\right)_s = \dfrac{\gamma p}{\rho} = \gamma r T = c^2$.
