How is the speed of sound related to the density of the medium?

The speed of sound in a medium is directly proportional to the square root of the medium's elasticity and inversely proportional to the square root of the medium's density. In other words, as the density of the medium increases, the speed of sound decreases. This is because in a denser medium, the particles are closer together and have more interactions that slow down the propagation of sound waves. Conversely, in a less dense medium, the particles are farther apart with fewer interactions, allowing the sound waves to travel faster.