How does density impact speed of sound?

In general, the speed of sound increases with an increase in density. This is because sound waves travel faster through denser materials as the particles are closer together, allowing the vibrations to propagate more quickly. Conversely, in less dense materials, such as gases, the speed of sound is slower as the particles are more spread out and it takes longer for the vibrations to travel between them. This relationship can be seen in the equation for the speed of sound, where the speed is directly proportional to the square root of the medium's elasticity and inversely proportional to its density.