Stars appear to have a brightness which we express in magnitude. But the actual brightness or energy output of a star may be vastly different to what we see.
If someone takes two torches, one bright and the other one not so bright and walks to a distance of say 50 m, then we will see the bright torch still brighter than the less bright one, but both are less bright than at a closer distance.
Two torches at same distance
If you now leave the less bright one at that distance and walk further say to 100 m with the bright one, that bright one may now look fainter than the less bright one that is still at a distance of 50 m.
Brightest torch(left) now further away
So if we don’t know the distance to a star, the brightness we see (we call that relative brightness) may give a wrong indication of the actual brightness (we call that absolute brightness or luminosity).
The brightness of the torch or of a star diminishes with distance according to the inverse square law.
This means that if the distance increases by a factor of two, the brightness diminished by a factor of two-squared or four. If the distance is tripled, the brightness decreases with a factor of three-squared or nine, etc.
Image: http://www.smartbridges.com (edited)
Now if we can find a way to measure
then we can use the inverse square law to find the distance.
(See our module "Luminosity, Magnitude and Distance" for more details, including calculations).
In astronomy there fortunately is a variety of ways to determine absolute brightness,
also referred to as luminosity or energy output.