In astronomy, the *mass function* is a theoretical estimate of the masses of individual stars in a spectroscopic binary star system. It is obtained assuming some very simple physics and geometry.
Theoretically, it requires Kepler's Third Law and the definition of center of mass of a system, while observationally, it requires the measurement of the binary's period, and how fast the stars
move about the center of mass.

First, define Kepler's Third Law (1) and the center of mass (2):

4 π^{2} a^{3} = G (M_{1} + M_{2})
P^{2} (1)

M_{1} a_{1} - M_{2} a_{2} = 0 (2)

where *M*_{1,2} are the masses of the two stars,
*a*_{1,2} are the distances of the two stars from the center of
mass at a given time, *a = a*_{1} + a_{2} is the
semi-major axis of the orbit, and P is the period. Of all these
quantities, the only one we can measure directly without any other information
is the period.

First, note that we can rewrite the semi-major axis in terms of the
masses and *one* of the individual *a*_{n} values, for
example,

a = a_{2}(M_{1} + M_{2}) / M_{1} (3)

Now, any binary star system where the plane of the orbit is inclined toward
us will show regular variations of the spectrum due to red and
blue shifting of the spectrum. The amplitude of these velocity shifts is
known as *K*_{1,2}, and each star in the pair has its own
velocity amplitude. We can then use this amplitude along with the period
do define the individual *a*_{n} as

a_{n} = K_{n} P / (2 π × sin i) (4)

where *i* is the orbital inclination relative to us. (If the orbit
is not inclined towards us at all, *i* = 0 degrees, and thus
there is no radial velocity amplitude.) We've now determined
*a*_{n} except for the orbital inclination, *i*.

We can take equations (2) and (3), and substitute these into Kepler's Third
Law, to obtain (solving for *a*_{1} for example)

4 π^{2} a_{2}^{3} (M_{1} +
M_{2})^{2} / M_{1}^{3} = G P^{2}

You can then substitute *a*_{2} from equation (4), to obtain
the mass functions, *f*_{1,2}

f_{1} = K_{1}^{3} P / (2 π G) =
M_{2}^{3} (sin^{3} i) /
(M_{1} + M_{2})^{2}

f_{2} = K_{2}^{3} P / (2 π G) =
M_{1}^{3} (sin^{3} i) /
(M_{1} + M_{2})^{2}

*f*_{1,2} then give you the masses of the stars. Note that the
only observables here are the radial velocity amplitude, the period, and
the inclination angle. The first two are measurable, but the third is not
in most cases unless you can see eclipses (which imply a high
inclination angle). Therefore, when masses are determined, they are
usually given upper and lower limits with a range of inclination angles.
Sometimes, you can obtain additional information from the spectra of the
stars to determine their individual masses. For example, if one of the
stars has the spectrum of a hot, blue main sequence star, it must be more
than several times the mass of the Sun. Likewise, if it has a cool, red
spectrum, it is probably less than the mass of the Sun.

This method is how the masses of most binaries are found. For example, this
is how the mass of the black hole in Cygnus X-1 was determined. It is
also how the masses of extrasolar planets are found -- you measure both
the period and the (extremely small) radial velocity amplitude of the
star caused by the (faint) planet tugging it back and forth, and you get the
mass of the planet.