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 a3 = G (M1 + M2) P2 (1)

M1 a1 - M2 a2 = 0 (2)

where M1,2 are the masses of the two stars, a1,2 are the distances of the two stars from the center of mass at a given time, a = a1 + a2 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 an values, for example,

a = a2(M1 + M2) / M1 (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 K1,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 an as

an = Kn 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 an 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 a1 for example)

4 π2 a23 (M1 + M2)2 / M13 = G P2

You can then substitute a2 from equation (4), to obtain the mass functions, f1,2

f1 = K13 P / (2 π G) = M23 (sin3 i) / (M1 + M2)2

f2 = K23 P / (2 π G) = M13 (sin3 i) / (M1 + M2)2

f1,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.