More About the Relationship Between Intensity and Distance
More on Brightness as a Function of Distance
This relationship can be illustrated by the diagram below, which shows the apparent brightness of a source with luminosity L0 at distances r, 2r, 3r, etc. Notice that as the distance increases, the light must spread out over a larger surface and the surface brightness decreases in accordance with a "one over r squared" relationship. The decrease goes as r squared because the area over which the light is spread is proportional to the distance squared.
If M31 is moving with respect to the Earth, you should be able to see a change in its apparent brightness. Measuring this change would allow you to calculate its speed.