Cosmic distance ladder
where m the apparent magnitude and M the absolute magnitude. For this to be accurate, both magnitudes must be in the same frequency band and there can be no relative motion in the radial direction.