how light can be red shifted or blue shifted by the relative motion of a light source, an effect known as the Doppler effect. I also outlined how gravity can also shift light to the red or blue. There is one other way light can be red shifted, and that is due to the expansion of the universe.
One evidence for cosmic expansion comes from Hubble’s law, which demonstrates that the more distant a galaxy the more redshifted its light tends to be. This relationship between distance and redshift is roughly linear, and it is typically explained by imagining galaxies drawn on an inflating balloon. As the balloon expands, galaxies near each other move slightly apart, while widely separated galaxies separate much more quickly.
This tends to reinforce the idea that Hubble redshift is due entirely to the relative motions of galaxies, that it is cause purely by the standard Doppler effect. In actuality it’s a little more complicated. There is a redshift due to the relative motion of a galaxy when the light leaves the source, but light can travel for billions of years before reaching, and during that time the universe continues to expand. Since space itself is expanding, the wavelength of the traveling light also stretches. This means that while the light travels it continues to redshift due to cosmic expansion. You can see a demonstration of this in the video above.
Of course one could ask the question: what if this redshift isn’t caused by expansion? What if light just spontaneously redshifts over time. This idea is known as the “tired light” model, and if it were true the correlation between redshift and distance would be the same. However we know that isn’t what’s happening because the light from distance galaxies is also time dilated. In other words when we watch a supernova occur in a distant galaxy, it happens in slow motion from what we would expect. This slowdown is caused by the relative motion of the galaxy, since the faster something moves relative to us the more its time appears to slow down.
When we look at the time dilation effect for galaxies as a function of distance we see that it agrees with the expanding universe model, and not tired light. This is also how we know the visible universe has a radius of about 46 billion light years even though the universe is only about 13.7 billion years old. The light from the most distant galaxies was about 13 billion years from us when the universe was young, but during the light’s 13 billion year journey the universe has continued to expand.