Here's why:
* Frequency is a property of the source: The frequency of a wave is determined by the source that created it. Whether the wave is traveling through air, water, or a solid, the source continues to vibrate at the same rate, producing waves with the same frequency.
* Speed and wavelength change: While the frequency stays constant, the speed of the wave changes when it enters a less dense medium. The wave will travel faster in the less dense medium. To compensate for the increased speed, the wavelength of the wave increases.
Think of it like this: Imagine a person shaking a rope, creating waves. The speed at which the person shakes the rope determines the frequency of the waves. If the rope is tied to a heavier object, the waves will travel slower, but the person is still shaking the rope at the same frequency.