I am trying to run a simple first-principles calculation to estimate the diameter of the Milky Way from what we know about the motion of the Sun around its center. In particular, from various online sources and books, we can roughly say that:

  • The period of the Sun's orbit around the center of the Milky Way is $T_{sun}\approx 200$ million years.
  • The speed of the Sun in its orbit is $v_{sun}\approx 200$ km/s.
  • The sun is located about halfway between the Milky Way's center and its edge.

This is a purely kinematic problem. I'll assume that the Sun's orbit is circular, so that we may write:

$$ \omega_{sun}r_{sun} = v_{sun}, $$

where $\omega_{sun}=2\pi/T_{sun}$ is the angular velocity of the Sun around the Milky Way center. Hence:

$$ r_{sun} = \frac{T_{sun}}{2\pi}v_{sun}. $$

The radius of the Milky Way is twice that (the Sun is halfway out to the edge), and the diameter is twice that again. So the overall diameter of the Milky Way, in light years (denoting the speed of light by $c$):

$$ d_{MilkyWay} = \frac{2T_{sun}v_{sun}}{c\pi}. $$

We know all the quantities on the right hand side. A short Python code evaluates the solution.

T_sun = (200e6)*365.25*24*3600 # [s]
v_sun = 200e3 # [m/s]
c = 2.99792458e8 # [m/s]
pi = 3.14159
d_MilkyWay = 2*T_sun*v_sun/(c*pi) # [ly]

print "d_MilkyWay = %.2e [light years]"%(d_MilkyWay)

The answer: $d_{MilkyWay} = 2.68\cdot 10^{12}$ light years. This is much, much larger than the current best estimate given by scientists: about $10^5$ light years.

How come there is such a huge discrepancy between the measured size, and my rough estimate? Is the assumption that the Sun's orbit is circular wrong?

  • 1
    $\begingroup$ Wait - are you missing a huge problem? Gravity is totally f'd up in galaxies, it doesn't behave anything, at all, like it "should". Google up "galaxy rotation problem!" $\endgroup$
    – Fattie
    Sep 14, 2020 at 19:22
  • $\begingroup$ The galaxy rotation problem doesn't have much to do with the Sun's revolution around the center of the galaxy. $\endgroup$
    – chepner
    Sep 14, 2020 at 22:52
  • $\begingroup$ BTW, math.pi() gets you more digits of precision. $\endgroup$ Sep 14, 2020 at 23:06
  • $\begingroup$ @Acccumulation: Using a not-so-precise value for $\pi$ could actually be considered a feature here, since it shows that it's just some back-of-the-envelope calculation, and it won't be used for rocket science. Who cares about $\frac{3.14159}{3.1415926535 8979323846 2643383279}$ when the assumptions are wrong by ~15% and the calculations are wrong by a factor 31536000? $\endgroup$ Sep 15, 2020 at 8:04
  • 1
    $\begingroup$ @EricDuminil Yeah, I thought about that. But the OP cares enough to get $c$ to the last digit. $\endgroup$ Sep 15, 2020 at 18:19

4 Answers 4


You messed up a bit in your calculation. Your answer is in light-seconds, not light-years. If you divide by the number of seconds in a year, you'll get the correct answer.

T_sun = (200e6)*365.25*24*3600 # [s]
v_sun = 200e3 # [m/s]
c = 2.99792458e8 # [m/s]
pi = 3.14159
d_Milkyway_m = 2*T_sun*v_sun/pi # [m]
d_MilkyWay = d_Milkyway_m/(c*365.25*24*3600) # [ly]

print "d_MilkyWay = %.2e [light years]"%(d_MilkyWay)
  • $\begingroup$ Or alternatively, don't convert T_sun to seconds in the first place! :) $\endgroup$
    – Philip
    Sep 13, 2020 at 20:42
  • 1
    $\begingroup$ Yep, that's probably easier when it comes to the number of operations but could be harder when it comes to figuring out the units at each step :) $\endgroup$
    – Leo Adberg
    Sep 13, 2020 at 20:43
  • 1
    $\begingroup$ Wow! Rookie mistake, thanks a lot :) $\endgroup$ Sep 13, 2020 at 21:52

Dimensional analysis is hard, and I just wanted to verify the calculations of other answers here.

Since you are using Python, you should know that there are tools that can assist in dimensional analysis; These tools can be very helpful and would in this case show you where you went wrong.

Taking your sample code and turning it into a dimensional one, using pint (other tools for dimensional analysis are available), will look as follows:

import pint
U = pint.UnitRegistry()

T_sun = 200e6 * U.years
v_sun = 200 * U.km / U.s
r_sun = (T_sun / (2 * U.pi)) * v_sun
d_milkyway = 2 * 2 * r_sun

print('d_milkyway ~ {:.1f}'.format(d_milkyway.to('light_years')))

Which yields

d_milkyway ~ 84941.4 light_year

Note that if we omit the conversion to('light_years'), we would see

d_milkyway ~ 8.0e+10 kilometer * year / pi / second
  • 3
    $\begingroup$ Ooh, what a nice-looking tool! $\endgroup$
    – rob
    Sep 14, 2020 at 15:43
  • 1
    $\begingroup$ Oh, and I should mention that if you mess up the units and try to convert to an incompatible unit, you will get an error (that's half the point of pint), e.g. should you accidentally divide by v_sun instead of multiply, pint would say Cannot convert from [time] ** 2 / [length] to [length]. $\endgroup$
    – Pål GD
    Sep 14, 2020 at 21:46
  • 1
    $\begingroup$ Excellent answer. And using the incorrect formula above, with $c$ : (2 * 200e6 * U.years * 200 * (U.km / U.s) / (U.pi * U.speed_of_light)).to('lightyear') fails with Cannot convert from 'kilometer * year / pi / second / speed_of_light' ([time]) to 'light_year' ([length]). Years aren't light-years and pint knows it. Cool little library! $\endgroup$ Sep 15, 2020 at 7:57
  • 1
    $\begingroup$ You can also use to_base_units() which converts it (in this case) to seconds. $\endgroup$
    – Pål GD
    Sep 15, 2020 at 10:44

It took me embarrassingly long to figure this out. Your calculations are mostly correct, except at the end. The "diameter" of the Milky Way would indeed be $$d = 2 \frac{T_\text{sun} v_\text{sun}}{c\pi},$$ but this is in light-seconds not years. You need to further divide this by the number of seconds in one year. And if you do this, you will find that $$d \approx 85,000 \text{ light years}.$$

(Alternatively, and perhaps much more efficiently, you could just measure $T_\text{sun}$ in years, that would give the same answer with fewer calculations.)


Problem: Wrong units

$$ d_{MilkyWay} = \frac{2T_{sun}v_{sun}}{c\pi} $$

And that's your first problem, right here. You cannot disregard units and expect to get any correct or even well-defined result from your calculations.

The left-hand side is a distance (e.g. in meters, light-years or light-seconds), the right-hand side is a duration. This cannot work, and you cannot use this equation anywhere.

Light-years are not years, just like light-seconds are not seconds.

Solution: Remove $c$

The correct formula is simply:

$$ d_{MilkyWay} = \frac{2T_{sun}v_{sun}}{\pi} $$

Order of magnitude

Before using any tool in order to calculate the exact result, you should first try to get some idea about the correct order of magnitude (see Fermi problem).

The goal should be to simplify the calculation until it becomes easy to do mentally, without being too wrong.

enter image description here

So $3 \approx 1$ and $4 \approx 10$ are perfectly acceptable, but $10^5\approx10^{12}$ isn't.

You could notice that 200 km/s is approximately $\frac{c}{1000}$.

Here's the order-of-magnitude estimate:

\begin{align} d_{MilkyWay} & \approx \frac{2v_{sun}T_{sun}}{\pi} \\ & \approx \frac{2*200\mathrm{km/s}*200\thinspace000\thinspace000\mathrm{y}}{\pi} \\ & \approx \frac{2*\frac{c}{1\thinspace000}*200\thinspace000\thinspace000\mathrm{y}}{\pi} \\ & \approx \frac{2*c*200\thinspace000\mathrm{y}}{\pi} \\ & \approx \frac{400\thinspace000}{\pi}*c*\mathrm{y} \\ & \approx 100\thinspace000 \mathrm{ly} \end{align}

This is not the exact answer. But whichever tool you use, you should expect to get a result not too far away from $10^{5}\mathrm{ly}$.


With Python

If you want to stick with Python, you could use @PålGD's excellent answer.

With Wolfram Alpha

Wolfram Alpha does a good job at converting units:

2*200km/s*200million years/pi to lightyears

You get many different units as a bonus, and even a direct comparison to the correct galactic diameter:

2200km/s200million years/pi to lightyears with WolframAlpha

With Qalculate

Qalculate! is an excellent desktop calculator, and it supports many units:

enter image description here

  • 1
    $\begingroup$ Why is the total number of limbs 10 instead of 1? $\endgroup$
    – Itsme2003
    Sep 15, 2020 at 2:39
  • 2
    $\begingroup$ @Itsme2003: Interesting question. There's more info at what-if.xkcd.com/84 (linked from the comic above). Basically, it's because we're talking about orders of magnitude, so it makes sense to use a logarithmic scale. And on this scale, $10^{0.5} = \sqrt(10) \approx 3.16$ is right in the middle of $10^{0} = 1$ and $10^{1} = 10$. So 3 rounds to 1 because it's smaller than 3.16, and 4 rounds to 10 because it's larger than 3.16. $\endgroup$ Sep 15, 2020 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.