Using this site for binary system orbital period calculations: https://www.omnicalculator.com/physics/orbital-period

The formula given there is

$$T_{binary} = 2 \pi \sqrt{\frac{a^3}{G (M_1+M_2)}} $$

Entering numbers into the calculator on that page works fine, but I'm having trouble reproducing the above formula on my (physical) calculator as I'm not sure which of the units allowed on that page should be used. Ideally I'd want to use solar masses for M1, earth masses for M2, and AU for a. However I'm not getting anything resembling the right answers. I'm also entering G as 0.0000000000667408.

So my question is: is the formula as stated above correct, and if so which units are used?

I'm a total layman with this kind of thing, so apologies if this question seems dumb.

  • 4
    $\begingroup$ You have to use the same units everywhere. You cannot directly use solar masses for M1 and earth masses for M2; they have to be in the same units. The calculator on that page is obviously converting everything to the same set of units behind the scenes (e.g., both M1 and M2 are probably converted to kg, the SI version of G is used, and then the resulting period in seconds is converted to days + hours). $\endgroup$ Commented Feb 22, 2022 at 12:32
  • 1
    $\begingroup$ You should avoid using G (when possible), since its value is only known to around 5 digits. See en.wikipedia.org/wiki/Gravitational_constant & astronomy.stackexchange.com/q/13587/16685 $\endgroup$
    – PM 2Ring
    Commented Feb 22, 2022 at 19:18

4 Answers 4


You need to use the same units for both masses, M$_1$ and M$_2$.

If you use SI units for all values, then you answer will be in seconds. This means using kg for mass and m for distance. As an example...

The orbital period is given by:

$\displaystyle T = 2 \pi \sqrt{\frac{a^3}{G (M_1 + M_2)}} $

Rough values for Earth/Sun mass and orbital separation:

Semi-major axis = 1 AU = $1.5 \times 10^{11}$ m
M$_1$ = 1 Earth mass = $6 \times 10^{24}$ kg
M$_2$ = 1 Solar mass = $2 \times 10^{30}$ kg

Plugging these into the equation gives:

$\displaystyle T = 2 \pi \sqrt{\frac{(1.5 \times 10^{11})^3}{(6.67 \times 10^{-11}) ((6 \times 10^{24}) + (2 \times 10^{30})) }} $

$\displaystyle T \approx 3.16 \times 10^7$ seconds

$\displaystyle T \approx 1.002$ years


You should avoid using $G$ (when possible), since its value is only known to around 5 digits. From Wikipedia, $$G \approx 6.67430(15)×10^{-11}\,\rm{N\,m^2\cdot kg^{-2}}$$

That means there's an uncertainty of $15$ in the last two digits ($30$). In this notation, the uncertainty is one standard deviation, so the probability is around $68\%$ that the true value is between $6.67415×10^{-11}$ and $6.67445×10^{-11}$. There are more details on this notation here.

With modern technology, we can make very precise measurements of orbital periods and distances in the Solar System. This allows us to use the orbital period equation or the vis-viva equation to make very good calculations of $GM$ for the major bodies of the Solar System, especially if they have satellites. But to calculate the masses of the bodies involves dividing $GM$ by $G$. So any values you see for the masses of astronomical bodies that are given in mass units like kilograms are limited by our poor $G$ value.

One way to work around this problem is to use mass ratios. That is, you state the mass as a number of Earth masses or solar masses. A better way is to simply use the value of $GM$ itself. This value is known as the standard gravitational parameter, and sometimes written using the Greek letter $\mu$ (mu), although that can be a little confusing because $\mu$ is also used for the reduced mass.

That Wikipedia article has a table of $GM$ values for the Solar System, but I prefer to use the values given by JPL in the body data files produced by Horizons. You can get that data using this script: Horizons object data. It can be used for any body that Horizons knows, either by name or ID number. If the body name is ambiguous, Horizons will print a list of matching bodies, with their ID numbers. Please see the Horizons manual for further details.

Here are some $GM$ values from Horizons. The units are $\rm{km^3/s^2}$.

Body GM
Sun 132712440041.93938
Earth 398600.435436
Moon 4902.800066

To convert those values to $\rm{m^3/s^2}$, multiply by $10^9$.

Using that data, $1$ solar mass equals $332946.048834$ Earth masses.

The JPL Astrodynamic Parameters lists newer $GM$ values, which come from The JPL Planetary and Lunar Ephemerides DE440 and DE441, Ryan S. Park et al (2021). The value given there for the Sun is $132712440041.279419 \, \rm{km^3/s^2}$, which differs at the 13th digit from the value given earlier.

Since 2012, the astronomical unit has been defined to be exactly $149597870700$ metres. Working in kilometres, we can do your period calculation using this pseudocode:

au = 149597870.7
period = 2 * pi * sqrt((a * au)^3 / (M1 * GMsun + M2 * GMearth))

where period is in seconds, M1 is in solar masses and M2 is in Earth masses, and a is in AU.

Using $a=1$ AU in that formula, and standard double-precision arithmetic, the Earth's orbital period is $365.256349805$ days. That's quite close to the true sidereal year, which is approximately $365.256 363 004$ days.

Incidentally, in units of astronomical units and Julian years, $GM$ of the Sun is approximately $4\pi^2$. Using the value from Park et al, we get $GM = 39.47692642117668951 \, \rm{au^3/y^2}$. A Julian year is exactly $365.25$ days of $86400$ SI seconds.

  • $\begingroup$ FWIW, here's a bookmark for the Horizons body data: javascript:(function(){let%20s=prompt('Body');if(s)location.href='https://ssd.jpl.nasa.gov/api/horizons.api?format=text&OBJ_DATA=YES&MAKE_EPHEM=NO&COMMAND='+encodeURIComponent(s)})() If the body name string contains spaces or commas, you must enclose it in single quotes. $\endgroup$
    – PM 2Ring
    Commented Feb 22, 2022 at 21:17
  • $\begingroup$ Note that M2 in your pseudocode should be about 1.0123 rather than one because of the Moon, which is about 0.0123 Earth masses. Also, the Earth-Moon system orbits at slightly more than one au due to the prior definition of the au, which is a particle of negligible mass that would orbit the Sun alone in one sidereal year. Gauss used a slightly different value for a year in what would become the Gaussian gravitation constant than you did. It's not coincidental at all that $GM_{\odot}$ is $4\pi^2$ in units of astronomical units and years. It's how the astronomical unit was originally defined. $\endgroup$ Commented Feb 22 at 7:30
  • $\begingroup$ @David Good points. To get the year length we really should use the Earth-Moon barycentre. OTOH, the OP wants a formula for a simple binary system in terms of solar & Earth masses, so that's what I wrote. And I gave mu for the Moon in case the reader wants to do an EMB calculation. Of course, that also needs a suitably precise value for the semi-major axis of the EMB. And the calculated period ought to be the anomalistic year, but in my answer I didn't want to go too deeply down the astronomical year rabbit-hole. FWIW, here's an EMB calculation. It's still not quite right... $\endgroup$
    – PM 2Ring
    Commented Feb 22 at 10:54
  • $\begingroup$ sagecell.sagemath.org/… $\endgroup$
    – PM 2Ring
    Commented Feb 22 at 10:55
  • 1
    $\begingroup$ Those numbers for GM_Sun all agree with one another to 11 digits. Everything beyond that is fiction. We don't yet know GM_Sun to 12 digits, let alone 18 digits (the DE 440/441 value you used). Even though the Sun is estimated to lose about $10^{-13}$ solar masses per year, JPL has yet to represent GM_Sun as a time-varying parameter in their ephemerides computations because the variations remain in the noise. $\endgroup$ Commented Feb 24 at 22:43

If the masses are in solar masses, $a$ is in AU and T is in years, then just use $G=(2 \pi)^2$. (hat tip to PM2Ring)

$$T/year = \sqrt{\frac{(a/AU)^3}{(M_1+M_2)/M_{Sun}}} $$

This won’t be absolutely exact because of the ways that years, AUs and solar masses are defined, but we don’t know $G$ that well either!

  • 4
    $\begingroup$ If anyone is wondering how on Earth this works out - remember that ~1 AU is the distance at which a body in orbit around a ~1 solar-mass body has an orbital period of ~1 year. $\endgroup$
    – TLW
    Commented Feb 23, 2022 at 1:21
  • 2
    $\begingroup$ ...and, put another way, we can see this explicitly by simply converting units (ie, there's nothing exotic going on). $G=6.67x10^{-11} N.m^2.kg^{-2} = 6.67x10^{-11} m^3.s^{-2}.kg^{-1}$. With the unit conversions above, that turns directly into $39.47 AU^3.yr^{-2}.Msun^{-1}$. Lovely: I'd never thought of $G=(2\pi)^2$ in the right units (of course, it's also G=1 in the other right units...) $\endgroup$ Commented Feb 23, 2022 at 20:18
  • 3
    $\begingroup$ This is more exact than using SI units, since $GM_{Sun}$ is much more precisely known than either $G$ or $M_{Sun}$. $\endgroup$
    – Walter
    Commented Feb 24, 2022 at 18:50
  • 1
    $\begingroup$ @Walter potentially, but an AU is defined by the speed of light and the second and not Earth's semi-major axis, and year is based on a second which is based on "transition between the hyperfine levels of the unperturbed ground state of the 133Cs atom" and not Earth's period, so I'm not sure in the end which one is is going to turn out to be closer. Because of all the perturbations from Venus and Jupiter et al. I'm not sure how periodic Earth's orbit even is. $\endgroup$
    – uhoh
    Commented Feb 24, 2022 at 23:40
  • 1
    $\begingroup$ @uhoh That's how the au is defined since 2012. The astronomic unit formerly was defined as the distance from the Sun at which a particle of negligible mass would have an unperturbed circular orbit about the Sun with a mean motion of 0.0172020989500 radians per day, or $2\pi$ radians per 365.256898326 days, the value that astronomers at the start of the 19th century thought to be the length of a sidereal year. (The currently accepted value is 365.256363004 days.) Note that 0.0172020989500 is the numerical value of the Gaussian gravitational constant. $\endgroup$ Commented Feb 24 at 14:54

You can figure it out by looking at the equation and using simple dimensional analysis.

$$T_{binary} = 2 \pi \sqrt{\frac{a^3}{G (M_1+M_2)}} $$

We know that $T_{binary}$ needs to be time, $a$ is a unit of distance, and $M_1$ / $M_2$ are units of mass. We can easily look up $G$ to find that it has units of $\frac{m^3}{kg\cdot s^2}$, which are distance cubed over mass and time squared.

Plug that into the equation and get:

$$\text{time} \propto \sqrt{\frac{\text{distance}^3}{\frac{\text{distance}^3}{\text{mass}\cdot\text{time}^2} (\text{mass+mass})}}$$

From here, it's pretty clear that the sum of masses cancels with the mass from $G$, the distances cancel from $a$ to $G$, and you're left with the root of the square of time, hence why you end up with a unit of time.

If you want to add solar masses to Earth masses, you'll have to convert one of them. Let $k=\frac{\text{solar mass}}{\text{Earth mass}}\approx 333000$, then we can turn the sum into $(kM_1+M_2)$. The result of the sum will be Earth masses, so we need the mass in $G$ to be Earth masses.

A standard definition is $G=6.67408\cdot10^{-11} \frac{m^3}{kg\cdot s^2}$, so we need to multiply by an appropriate factor to convert from $\frac{1}{kg}$ to $\frac{1}{\text{Earth mass}}$.

$1\text{ Earth mass}= 5.9736\cdot 10^{24} kg$ $\rightarrow 1=\frac{5.9736\cdot 10^{24} kg}{1 \text{ Earth mass}}$.

Next, you want $a$ in AU, so we need to convert that. $1\text{ AU}=149,597,870,700 m$, which gives us $1=\frac{1\text{ AU}}{149,597,870,700 m}$.

Finally, we need a factor for time. Given the other units, I'm thinking days or years would be appropriate temporal units. Let's say we want days, then $1\text{ day}=86400 s$, giving $1=\frac{86400 s}{1\text{ day}}$.

Now we just need to multiply
$=6.67408\cdot10^{-11} \frac{\cancel{m}^3}{\cancel{kg}\cdot \cancel{s}^2}$ $\cdot\frac{5.9736\cdot 10^{24} \cancel{kg}}{1 \text{ Earth mass}}$ $\cdot\left(\frac{1\text{ AU}}{149,597,870,700 \cancel{m}}\right)^3$ $\cdot\left(\frac{86400 \cancel{s}}{1\text{ day}}\right)^2$
$=\frac{6.67408\cdot10^{-11}\cdot 5.9736\cdot 10^{24}\cdot 86400^2}{149,597,870,700^3}$ $\cdot\frac{\text{AU}^3}{\text{Earth mass}\cdot\text{days}^2}$
=$8.8895\cdot10^{-10}$ $\cdot\frac{\text{AU}^3}{\text{Earth masses}\cdot\text{days}^2}$

We can plug this into a computer program or calculator using:
$a$ is the semi-major axis, in AU.
$M_1$ is the large body mass, in $M_☉$.
$M_2$ is the small body mass, in $M_🜨$.
$T$ is the orbital period, in Earth days.
$T=2\pi\sqrt{\frac{a^3}{8.8895\cdot10^{-10}(333000\cdot M_1+M_2)}}$

We can bring the numeric portion of $G$ out if we want, for:
$T=2.1074\cdot 10^5\sqrt{\frac{a^3}{333000\cdot M_1+M_2}}$

Voila! We now have an equation that uses custom units. You can do the same thing for any units you want, including made-up units like "the mass of an average Klingon spit-wad", as long as you can convert it to something standardized.

We can sanity check the equation with:
$a=1$ AU.
$T=2.1074\cdot 10^5\sqrt{\frac{1^3}{333000\cdot 1+1}}$
$=2.1074\cdot 10^5 \cdot 1.7329 \cdot 10^{-3}$
$=365.19$ days.

Which is quite close to the 365.242-ish days in a real year.

Obviously, accuracy will depend greatly on how good your source numbers are.

  • 1
    $\begingroup$ The first part of this answer is excellent. But you lose a lot of precision by using G instead of GM. FWIW, more precise values of your constants are 8.88769244512e-10 and 210758.626456 (see my answer for a more precise Sun/Earth mass ratio). $\endgroup$
    – PM 2Ring
    Commented Feb 25, 2022 at 9:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .