Why does the speed of sound decrease at high altitudes although the air density decreases? I understand that the speed of sound is inversely proportional to the density of the medium as shown here and as answered for this question.
The problem now is that the speed of sound in air actually decreases with altitude although the density of the air decreases. This is shown here and here.
I understand that the speed of sound also depends on the elasticity, but I'm not sure how this can change for air.
So what is actually happening? How can the speed of sound decrease although the density has also decreased?
 A: Sound is simply a compression wave. The velocity of the wave is inversely related to the square root of fluid pressure, and directly proportional to the materiel’s Young modulus. A lower density means a lower pressure, which increases the wave velocity as you noticed.
Traveling through a compressible medium such as air, the simple equation for the velocity (v) of a compression wave is the square root of the Young’s modulus (B) divided by pressure (p)
$$v=\sqrt{\frac{B}{p}}.$$
Please see the following link for the derivation of this formula.
https://youtu.be/qVusackhzBs
But as the materiel becomes less dense, it reduces the surface area where the force is applied, the Young modulus decreases. 
Increasing altitude thins the air out (reduces the surface area over which the force is applied) faster than it reduces pressure, resulting in a net decrease in the ratio, and therefore wave speed.
A: Wikipedia gives a pretty much straightforward answer. In an ideal gas, the speed of sound depends only on the temperature:
$$ v = \sqrt{\frac{\gamma \cdot k \cdot T}{m}} $$
So it neither decreases, nor increases with altitude, but just follows air temperature as can be seen in this graph:

A: The speed of sound in a gas is given by $\sqrt{ \dfrac {\gamma \,P}{\rho}}= \sqrt{\gamma \, R \, T}$ where the temperature, $T$,  is in kelvin, $\gamma$ is the ratio of the specific heat capacities of a gas at constant pressure and constant volume and $R$ is the specific gas constant.  
With increasing altitude there is a decrease in the density but also a decrease in the pressure, but not at the same rate because there is also a change in the temperature.
As the altitude increases, the temperature decreases and so does the speed of sound and then when the temperature increases so does the speed.

Source - Engineering Toolbox
A: In laymen terms, sound propagation depends on air particles colliding.  The closer the particles to each other the quicker they can collide.  In a less dense environment, the particles must travel farther to collide.  Particle size has an effect as well as can be heard in glove boxes containing Helium vs Argon.  Temperature also has an effect in the amount of energy available to the particles and therefore excitability.  This is very a simplistic and generalized  answer without any mathematical or scientific proofs.
