# Units for orbital period and gravitational constant

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.

• 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). Feb 22, 2022 at 12:32
• 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 Feb 22, 2022 at 19:18

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.

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.

• 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. Feb 22, 2022 at 21:17
• JPL has a convenient table of GM and various other astrodynamic parameters here: ssd.jpl.nasa.gov/astro_par.html May 23, 2022 at 14:49

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!

• 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.
– TLW
Feb 23, 2022 at 1:21
• ...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...) Feb 23, 2022 at 20:18
• This is more exact than using SI units, since $GM_{Sun}$ is much more precisely known than either $G$ or $M_{Sun}$. Feb 24, 2022 at 18:50
• @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.
– uhoh
Feb 24, 2022 at 23:40

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
$$\require{cancel}G\cdot\text{ratio}_{mass}\cdot{\text{ratio}_{distance}}^3\cdot{\text{ratio}_{time}}^2$$.
$$=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.
$$M_1=1M_☉$$.
$$M_2=1M_🜨$$.
$$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.

• 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). Feb 25, 2022 at 9:25