You’re right that our galaxy represents a much denser population of stuff than intergalactic space, and that our solar system is similarly a more dense collection of stuff than the space between stars within our galaxy. However, it sounds as though you’re thinking of gravitational field strength (which is certainly correlated with the density of matter) like an atmosphere of material that light must make it through.
Now, if light is indeed travelling through a dense material (for instance, air or water), light does slow down. This slowdown is related to the index of refraction of the material, which is the technical term applied to how much light bends when it enters that material. So, light going from air to water has a certain bend to it, which we can measure, and that bend tells us how much slower light will move through water. You can do the same experiment with air. Light in air is 1.0003 times slower than light in a vacuum, which slows it all the way down from 299,792,458 meters per second to 299,702,547 meters per second. That’s a slowdown of 89,911 meters per second, which looks like a lot but is only three ten-thousandths of the speed of light. Light in water goes even slower – water’s refractive index is 1.33, so the speed of light in water is slowed by 74,384,595 meters per second. If you have a sufficiently dense material, light can slow down really considerably.
But if you’re in a vacuum, the index of refraction is precisely 1; there is no change to the speed of light in a vacuum. There’s no material in a vacuum, quite by definition, for the light to encounter. The solar system is dense, but it’s dense with material in very specific locations – to extend your metaphor a bit, compared to interplanetary space, the planet is very dense. But it’s dense with matter, the physical pieces of you and me and rocks and the atmosphere. Outside of our atmosphere’s region of influence, you are very rapidly in a vacuum.
That’s not to say that the presence of an object with a strong gravitational field won’t affect light – it certainly does, but the way that a strong gravitational field influences light is a bit different from the slowing down you get from going through a thick substance. Gravity changes the shape of the space surrounding an object, and since light always travels in locally straight lines, light is affected by this warping. The more gravitationally weighty objects between the light source and your detector, the longer a path your light must travel. However, if you know the masses and locations of the gravitationally weighty objects, you can calculate the exact shape of space that light will have to pass through, and therefore how long it should take to travel between any two points.
But how do we know that the speed is right? There’s an early experiment that tackled this question from the comfort of our own planet. You can shoot a laser down a long tube, which you know the distance of quite precisely (this one you can physically measure). To measure the speed of light, you first bounce the light off of a rotating, 8 sided mirror, and then send it down your tube, with mirrors on each end. When the light bounces back out of your tube and back onto the rotating mirror, the mirror will have rotated a bit, which means that the light bounces out at a slightly different angle than it went in. The slower the speed of light, the more time the mirror has to rotate, so the bigger the difference in angle. This experiment was run by Michelson, Pease and Pearson in the 1930s, and successfully determined the speed of light to within 11,000 meters per second! Pretty good.
There’s another way to test the speed of light, a bit further from home. We can do tests of the strength of gravity on Earth, and given Newton’s equations, we can calculate the mass of the Earth. With the mass of the earth, and the length of a month, we can figure out the mass of the moon, so we can tell the exact shape of the space between the earth and the moon. With all those pieces in place, we should be able to predict the length of time it takes for a beam of light to make it from the earth outwards (and probably back again, if we’re testing the speed of light). If light makes it out and back again in the length of time you’d expect given the shape of space, then light is behaving the way we think it should. And it does behave the way we think it should.
Every test we can think of has given us very consistent results for the speed of light in a vacuum, from experiments on earth, to the length of time it takes to communicate with our satellites out in the distant solar system, and if the speed of light depended on anything beyond the geometry of the space it’s travelling through, we’d have seen some sign of it – experiments would run fast or slow in a certain time of year, or would have changed over time. There’s been no sign of that, so the speed of light in a vacuum seems to be one of the fundamental constants to our universe.
Sign up for the mailing list for updates straight to your inbox!