# Calculating the size of the universe

Lower limit of the size of the Universe? (WMAP)

Determining the size of the universe to calculate its age

Size of the universe

But I would like to try a novel way to calculate this to illustrate it for middle schoolers.

I would start with the radius of a hydrogen atom calculate its volume then multiply by the number of calculated atoms in the universe.

At this point, the engaged students will point out that the whole universe is not hydrogen. I will point out that 90% of the universe is hydrogen and we are just approximating. (This teachable moment also introduces them to the utility of estimating) Once I have the volume of the universe, I calculate its radius.

I then use the following python code (again a teachable moment about the value of coding)

import math
Hv=math.pi*4/3*(53e-12**3)
print('current volume of hydrogen atom',Hv, 'cubic meters' )
print('number of atoms in the universe',1e+83)
print('current volume of the universe',1e+83*Hv, 'cubic meters' )
print('current radius of the universe',(1e+83*Hv*(3/4)/math.pi) ** (1. / 3), ' meters' )
print('meters in a light year ,',9.461e+15)
print('current radius of the universe',((1e+83*Hv*(3/4)/math.pi) ** (1. / 3))/9.461e+15, ' light years' )

the output is

current volume of hydrogen atom 6.236145193179834e-31 cubic meters
number of atoms in the universe 1e+83
current volume of the universe 6.236145193179834e+52 cubic meters
current radius of the universe 2.460042081814767e+17  meters
meters in a light year , 9461000000000000.0
current radius of the universe 26.001924551472012  light years

So my rough calculation of 26 million light years is way off. The really engaged students will point out that the hydrogen gas in the universe is not just a bunch of hydrogen atoms next to each other but there is empty space around each one. What they will try to grasp is the density of hydrogen in space. Some of the respondents here suggested using 1 atom/4 cc. So then I can calculate

import math
print (1e+83*4,'cc in the universe')
print ('current volume of the universe',1e+83*4/1e+6,'cubic meters')
print('current radius of the universe',(4e+83/1e+6*(3/4)/math.pi) ** (1. / 3), ' meters' )
print('meters in a light year ,',9.461e+15)
print('current radius of the universe',((4e+83/1e+6*(3/4)/math.pi) ** (1. / 3))/9.461e+15, ' light years' )
print('current radius of the universe',f'{(1e+83*4/1e+6*(3/4)/math.pi) ** (1. / 3)/9.461e+15:,}', ' light years' )

output

4e+83 cc in the universe
current volume of the universe 4e+77 cubic meters
current radius of the universe 4.570781497340817e+25  meters
meters in a light year , 9461000000000000.0
current radius of the universe 4831182218.941779  light years
current radius of the universe 4,831,182,218.941779  light years

So 4.8 billion light years. Still off by a factor of 10.

EDIT: So sad that I made typos that led to serious errors.

• This isn't really an answer but just providing some context for what you're doing. The figure of 90% of the Universe is hydrogen is bit misleading -- much of the Universe's baryonic mass is held in the warm-hot intergalactic medium, an ionized plasma with very low density, typically 1-10 particle per cubic meter.
– zh1
Sep 29, 2021 at 18:10
• Your question and code both still contain typos. I hadn't realized this earlier, but the volume of 1 hydrogen atom should be 0.25 cubic meters, not 2.5e-30 (as in your code) nor 1 atom/4cc (which is cubic cm, rather than cubic meter). Assuming 1e83 atoms, the volume of the universe would be 1e83*0.25 (no factor of Hv) cubic meters. Currently your posted code finds that the radius is 41 light years, but if you correct it, then it should be closer to 40 billion light years. I would also suggest changing the total # of atoms to 1e80. Sep 30, 2021 at 2:42
• 1e83*4, not 1e83*0.25. Sorry. Because 1e83 atoms * (4 cubic meter / 1 atom) if there is 1 atom per 4 cubic meter or 0.25 atom per 1 cubic meter. Sep 30, 2021 at 2:49
• if i use 1 atom per liter of space I get a radius of 30 billion light years. Isnt this estimate of the space occupied by a hydrogen atom too much? Sep 30, 2021 at 3:09
• The radius of the observable universe is 40 billion light years, so you're quite close. Anyway, if you want to guarantee the right answer, work backwards to figure out the numbers you need. R = 4.4e26 m = 46 billion light years. Then either choose the total number of atoms and calculate atom/volume, or choose atom/volume and calculate the total number of atoms. Sep 30, 2021 at 3:55

Number of Hydrogen per volume

The critical density of the universe is a handful of hydrogen per cubic meter. The actual number of hydrogen per cubic meter is roughly 0.25. 1 per cubic centimeter is okay for local space, which is much much denser than the Universe on average, because we are in a galaxy, an overdensity of the Universe.

Size of the Universe

The size of the Universe depends on how you define it. As an example, I'll use $$R = 4.4\times10^{26}$$m (46 billion light-years) corresponding to the observable Universe.

The number of hydrogen atoms in a volume corresponding to that sphere is roughly $$9\times10^{79}$$.

Hv=math.pi*4/3*(1.2e-11**1.2e-11**1.2e-11)

I believe there is an error, since ** is exponentiation, and you are exponentiating this factor of 1.2e-11 rather than multiplying.

Hv=math.pi*4/3*(1.2e-11)**3

• Can you argue number density from critical density, given critical density includes dark matter? Wouldn't you have to go the other way around, find number density, and then add dark matter until you reach critical density?
– g s
Sep 30, 2021 at 0:33
• You can read more here: en.wikipedia.org/wiki/Lambda-CDM_model The Planck model infers omega baryon which gives you the baryonic number density based on the critical density (which we only know matches the overall density because the Universe is flat). If you see the missing baryon problem, trying to add up all the matter ends up undercounting baryons. Sep 30, 2021 at 1:06
• You can see how the CMB spectrum depends on cosmological parameters here: background.uchicago.edu/~whu/metaanim.html. A higher omega_baryon increases the height of the first acoustic peak in the CMB. Another way to infer omega_baryon is deuterium abundance using the theory of Big Bang Nucleosynthesis. en.wikipedia.org/wiki/… Sep 30, 2021 at 1:30
• thank you for your comments. I made corrections to the calculations above. Sep 30, 2021 at 2:41
• Cheers :) I'm very impressed by the learning experience you've set up for your middle schoolers. Sep 30, 2021 at 2:45

I'm sorry, but your calculation was doomed from the start. To estimate number of atoms in the universe, you start with the assumption that most of the atoms in the universe are in or near galaxies. Then you count galaxies, multiply by an estimate of mass per average galaxy, and divide by hydrogen mass.

As such no amount of manipulation of that estimate can get you an appropriate calculation of the size of all the space that the estimate ignored to begin with.

Your code also has very incorrect values in it. Your estimate for atoms in the universe is under by a factor of $$10^{62}$$ to $$10^{66}$$, density of intergalactic medium over by a factor of at least $$10^6$$. I'm not sure whether your number for universe volume is supposed to be the true value, or the value you're calculating. If it's the former, it is also wrong by a significant factor. If the latter, you should be printing a variable that holds the calculated value, not a hard coded number.

• i made a typo in a couple of places. First i made an error using double asterisk for multiplication instead of single asterisk. My fingers typed the exponentiation operator on accident. The other 'copy-paste' typo is in the fourth line of code of the first bit. I used the number for meters in a light year after the label for 'atoms in the universe'. But in my calculation I used the correct value of e+83 Sep 30, 2021 at 2:13