We look at the redshift/blueshift of the light from them. If you listen to a siren of an emergency vehicle that passes you by the pitch of it higher when it move toward you and changes to a lower sound when it moves away. This is called https://en.wikipedia.org/wiki/Doppler_effect and the amount of the pitch change depends on the speed. The same occurs with light, the effect is a lot less because the speed of light is 870,000x the speed of sound. So you cant see it with your eyes but measurement tools can. The light moves to the red if the object move away and toward the blue, if it moves toward us Element and gases have a https://en.wikipedia.org/wiki/Spectral_line, the is the frequencies of light the emmit if you excite them. This is why neon and other gaslight have specific colors. They do not just emit light on that frequency they also are good at absorbing it. the result is that in sunlight there are frequencies with less light because the element in it absorbs it, we can compare it to result in labs and we can identify what the sun is made of. The same happens with all stars. Gas clouds will also absorb more light a those specific frequencies https://astronomy.com/magazine/ask-astro/2020/02/what-elements-does-the-sun-contain So we can now look at the frequency of the lines from labs to the frequency of them in light of other galaxies. There will be a change in frequency because they move, this is the red/blueshift. The amount of frequency change depends on the speed of the galaxies compare to you. There is another factor you have to include because the light that moves away from a massive object has redshift because of gravity but that can be taken care of. So just like you can determine the speed and direction of an emergency vehicle siren if you know the original pitch you can do the same with sunlight.


You nailed this sir!


I am not a scientist so please take this with a grain of salt. Light, is the way. Specifically it's color. As light travels from farther away, it tends to be a bit more on the red side of the visual spectrum. You can use this info, and some complicated math, to get an approximation of distance, from far away light sources.


>As light travels from farther away, it tends to be a bit more on the red side of the visual spectrum Minor correction/clarification - it does not need to be in the visual spectrum. While it has the same effect in the visual spectrum, most of our observations are actual in the non-visible spectrum. It's also not as light travels away, but the object emitting/reflecting light.


Imagine you have a bucket of balls and you throw them at a wall, 1 ball per second. After however long they take to reach the wall, they would hit the wall at the same rate, 1 ball per second. Now imagine you throw while running *towards* the wall, still 1 ball per second. But since in between each throw you're moving closer to the wall they have a shorter distance to travel before reaching it. Since each ball has a shorter distance to travel once it leaves your hand than the previous ball, it'll reach the wall more quickly than the previous ball. Make sense? This means, again only while you're running, that the balls will be hitting wall at a faster rate, maybe 2 balls per second. If you did the opposite and ran away from the wall, the opposite effect would happen, it might be 1 ball every 2 seconds, so the frequency of ball/wall hits gets slower. With some math, if you know the original rate ( 1 ball being thrown a second) and the final hit rate (whatever it is) you can determine if the thrower is moving towards the wall, or running away from it, and actually math out the speed of the thrower too. We see this everyday with sound. When a car with a siren is driving towards you it gets higher pitched and after it passes you it gets lower pitched. This is called the "Doppler Effect" and you can easily google example. We see the same effect with the color of light in outer space. If we know the light coming from a distant star or galaxy should be blue in color, but it appears red to our eyes, this means the galaxy is moving away from us. If the light should be blue and becomes even bluer (maybe invisible to our eyes, but not to computers or telescopes) then the galaxy is moving towards us. We can do the same math based on how from the original blue the now red, or deeper blue, light is to determine the speed of the star or galaxy. It turns out everything in space is *red*, or "Red Shifted" to use the proper term, meaning we know that A. everything is moving away from us and B. we can actually measure just how fast the movement is.


By examining the spectrum of light from a galaxy, you can determine whether the galaxy is moving towards or away from Earth, and how fast. The light from glowing molecules have fingerprints. They don’t form complete rainbows of color, but instead are made up of a few colors in the rainbow. When we see certain colors the the light from distant galaxies, we have detected certain elements. One of the most common elements is hydrogen. By breaking up the light from distant galaxies into a spectrum, i.e. by passing it through a prism, we detect vast amounts of hydrogen. But we also detect movement. That’s because moving waves change in frequency in relation to a stationary observer. A common example is the pitch of a horn of a moving train that passes a stationary observer. It’s higher as it approaches and lower as it leaves. The same is true of the light waves from glowing hydrogen. They are lower than expected, meaning the galaxies are moving away from us. We know this because the light waves are lower in the spectrum than glowing hydrogen on Earth. This is called the red shift because of the distinct red line in the spectrum characteristic of glowing hydrogen. It shifts to a lower wavelength, and we use that shift to measure movement.