The wavelength of sound can change when it travels from one medium to another because sound waves are mechanical waves that require a physical medium, such as air, water, or solids, to propagate. When sound waves travel through different mediums, the particles in those mediums interact with the waves, causing changes in their speed and wavelength.
In denser mediums, such as solids or liquids, the particles are closely packed together, and sound waves can travel faster. As a result, the wavelength of the sound waves decreases because the speed of sound is directly proportional to the frequency times the wavelength. So, if the speed increases, either the frequency or the wavelength must decrease to maintain a constant speed.
On the other hand, light is an electromagnetic wave and does not require a medium to propagate. It can travel through a vacuum, as well as through different mediums such as air, water, or glass. The speed of light in a vacuum is constant and is denoted by "c" (~ 299,792,458 meters per second). This constant speed is a fundamental property of electromagnetic waves.
When light travels through different mediums, such as air to water or air to glass, its speed changes, but its frequency remains constant. According to the wave equation, speed is equal to frequency times wavelength (v = fλ). Therefore, if the speed decreases when light enters a denser medium, the wavelength must also decrease to maintain a constant frequency.
To summarize, the wavelength of sound can change when it passes through different mediums because sound waves require a physical medium for propagation. In contrast, the wavelength of light remains constant, while its speed changes when it travels through different mediums.