# How to calculate the probability of an enclosed gas migrating to one side of an enclosed box

I have a hollow enclosed 1cm-sided cube. It is filled with N mols of an ideal gas.

(1) What is the probability that for one infinitesimal moment, all the gas will occupy half of the box, leaving a vacuum at the other side.

(2) What is the probability that it will stay this way for a specified length of time?

Question

Are these meaningful questions? Are they two very different questions? Can either or both be calculated and, if so, what is the result?

Assumptions

We choose a desired volume in advance that is half the volume of the entire space. It is a specific half of the cube with the dividing plane being parallel to one of the sides.

Notes

1. It seems to me intuitively that to maintain this state, rather than just reach it for an instant, is going to be next to impossible because reflections from the sides will tend to refill the other half immediately. This is why I'm asking if the question is meaningful.

2. In order to make this easier to answer, please feel free to specify any extra conditions that will make calculations simpler.

• I think you need a better title! If you have a mole of ideal gas, then if you pick which half of the box in advance then the chance of being in that half is $(1/2)^{6\times 10^{23}}$ which is an absurdly small number. If you don't pick the half in advance it's too hard for me to think about.
– user107153
Commented Aug 1, 2020 at 11:29
• @tfb - Thanks. I've changed the title. Let's say we pick which half in advance. I'll edit my question to be clearer. Commented Aug 1, 2020 at 11:38
• This question reminded me of a conversation I had in chat early last year. "Let's expand the coin tossing experiment to 320 coins. 2^10 is a little over 10^3, so 2^320 is around 10^96. The universe is just under 14 billion years old, and there's about 31 million seconds in a year. There's around 10^80 protons in the observable universe, so let's pretend we can flip each proton like a coin, 320 times per second. We'd expect a single run of 320 heads by now." Commented Aug 1, 2020 at 12:20

Here is an answer to (1) only, with the additional assumption that you pick the half of the box in advance. The half you pick can be any shape you want: you just need to select half the volume of the box. The regioun you select does not even have to be connected.

An ideal gas consists of noninteracting particles which just whizz about. The position of each particle is random, so in particular the chance that each particle is in any selected half of the volume is $$1/2$$. So the chance of all the particles being that selected half of the volume is $$(1/2)^n$$ where $$n$$ is the number of particles. If we assume there is $$N\,\mathrm{mol}$$ of gas, then the probability, $$P$$ of all the molecules being in the top half of the box is about

$$P \approx 0.5^{N\times 6\times 10^{23}}$$

Which is an absurdly tiny number. To get a feeling for how tiny it is, we can reexpress is (thanks to HicHaecHoc!) as

\begin{align} P &\approx 10^{-1.8 N \times 10^{23}}\\ &= \underbrace{0.0 \cdots 01}_\text{1.8 N \times 10^{23} zeros} \end{align}

This is not a number which can be easily represented as a conventional number on any computer system: when I calculated it I did my normal trick of 'OK, I have a programming language with bignums and rationals, let's actually compute it': don't do that, you will run out of memory, almost however big your computer is. If your machine requires a single bit to represent each digit, then you need about $$2.5\times 10^{22}$$ bytes of memory: this is about double the storage capacity that exists in the world currently (but probably quite soon we would be able to store this number, if we used all the storage in the world for it).

The volume of $$1\,\mathrm{mol}$$ of an ideal gas at $$100\,\mathrm{kPa}$$ (approximately atmospheric pressure) is about $$0.022\,\mathrm{m^3}$$ at $$0^\circ\mathrm{C}$$ or about $$0.024\,\mathrm{m^3}$$ at $$25^\circ\mathrm{C}$$: this is a cube around $$28\,\mathrm{cm}$$ on a side, or perhaps a party balloon of gas.

• Thanks - I've edited to specify N mols. I hope that is okay. I'd be grateful if you could also preserve the current answer for one mol. Commented Aug 1, 2020 at 11:56
• P.S. I think you are saying that the answer is independent of the size of the box - is that correct? Commented Aug 1, 2020 at 11:58
• @chasly-reinstateMonica: well, I expressed it in terms of $N$ now, so if you put $N = 1$ you get back the old number.
– user107153
Commented Aug 1, 2020 at 11:58
• I'd add that since $2^{-10}\simeq10^{-3}$, we have $0.5^{6\times10^{23}} = 2^{-6\times10^{23}}\simeq10^{-1.8\times10^{23}}$. Of course this is very approximated. Commented Aug 1, 2020 at 11:58
• @chasly-reinstateMonica: yes, that's correct, it just depends on $N$.
– user107153
Commented Aug 1, 2020 at 12:00

1. Insanely small.
2. Also insanely small.

To get some definite numbers here, I'll assume that the temperature is 25°C, and the pressure in the cube is 1 standard atmosphere. I'll also assume we're dividing the cube into left & right halves, and we want to know the odds of all the gas molecules being in the left side.

Using Avogadro's constant, and the molar volume data here, there are $$\approx 2.46\times10^{19}$$ molecules in the cube.

According to the Wikipedia article on thermal velocity, the mean velocity for air molecules at 20°C is around 464 m/s, at 25°C, that'd be closer to 468 m/s. So if a molecule had a free path, it could cross the cube from one face to the opposite face in around 21 microseconds. Now the molecules don't generally have a free path, they tend to bounce off each other a fair bit. But for the purposes of this question, let's assume that a given molecule won't take very long to get from the left side to the right side, or vice versa.

We can make a rough estimate for part 1 by assuming that at any given instant each molecule has a probability of 1/2 of being on the left side. The probability of $$n$$ molecules being on the left side is simply $$\left(\frac12\right)^n$$. But for our cube $$n\approx 2.46\times10^{19}$$, so the probability that all of the molecules are on the left side is $$\left(\frac12\right)^{2.46\times10^{19}}$$ It is difficult to conceive of how small that number is. There are more than $$7.4\times10^{18}$$ decimal digits in the denominator of that fraction.

As for part 2, the answer would be roughly similar for very small time intervals, i.e smaller than that figure of 21 microseconds I gave earlier.