Here's how:
* Twinkling of Starlight: Starlight travels through vast distances in space, and it encounters different layers of air with varying densities in Earth's atmosphere. As light passes from one layer to another, it bends due to refraction. These density variations are constantly changing, causing the starlight to bend and shift directions slightly and rapidly, making it appear to twinkle.
* Focusing of Images by Lenses: Lenses are designed with specific shapes to bend light in a predictable manner. When light passes from air into a lens (which has a different refractive index), it bends at the interface. The curved shape of the lens ensures that light rays from a single point converge at another point, forming a focused image.
In both cases, the bending of light due to different refractive indices is the key factor. The difference lies in the scale and nature of the refractive medium:
* Starlight: The variations in refractive index occur on a large scale, in the atmosphere.
* Lenses: The variations in refractive index are designed into the lens itself, on a smaller scale.
Therefore, both the twinkling of starlight and the focusing of images by lenses are due to the fundamental property of light called refraction.