Tag: probability

  • Why do wet clothes dry?

    Why do wet clothes dry?


    In the Northern Hemisphere, summer has arrived. The time has come for us to chase the general public with water guns, jump through the neighbour’s garden sprinklers’ water rays, and either carefully place a soggy, wet sea cucumber on a human’s belly during their beach nap(beginfootnote)The author does not approve of this. Sea cucumbers should be left alone.(endfootnote), or simply dump them (the human) in the actually-still-too-cold seawater, especially if you love them. At the end of the day, after all those wet adventures, nothing will beat hanging your clothes out to dry in a soothing breeze of fresh alpine air.

    A few years ago, a friend asked what exactly causes wet clothes to dry. How does that work, exactly? I thought it was a great question because what may seem like a simple problem actually exposes one of the fundamental aspects of the way our universe works and, at the same time, forms one of the main causes for headaches among undergraduates: the second law of thermodynamics.

    TL;DR? Don’t like mathematics (high school level) and prefer to read the ‘dashboard’ version? Skip to the bottom. Everyone else, please read on!


    A box of gas

    Let’s first paint ourselves a simpler picture than the actual situation where we wear whatever is the latest summer catwalk beach fashion. For now, we will also ignore the Sun, we will ignore the wind, and we will ignore the humidity of the air.

    Imagine, your colourful pair of swimming trunks is actually a simple box with a hundred gas molecules. The particles bounce chaotically back and forth against each other and the walls of the box itself.

    Now, let there be a hole in the wall. Imagine, by pure chance, one molecule escaping the box through the hole, arriving in another container of exactly the same size. This obviously means there are now only 99 gas molecules left in the original box.

    Figure 1. Two boxes with gas molecules bouncing around inside. In box (a), one has escaped, 99 remain. In box (b), 98 remain, two have escaped.
    Figure 1. Two pairs of boxes with gas molecules bouncing around inside. In (a), one molecule has escaped to the right box through the hole, 99 remain in the left box. In (b), two have escaped to the right box, 98 remain in the left box.

    Have a look at Figure 1a. Assuming all gas molecules look exactly alike, how many ways do we have to arrange them in order to get the same result? Well, instead of this particular molecule having escaped, any other one of these hundred molecules could have escaped just as well. And so, as each one of the hundred gas particles was capable of escaping the box, exactly a hundred possibilities could have led to the same outcome (i.e. 1 escaped, 99 remain). In other words, exactly one hundred different configurations, or microstates, will entail the microstate of the box where it lost one molecule while 99 remain inside. Let’s call this number $W$. And let’s call that number for the microstate where one molecule escaped (and 99 remain inside), $W(1)$. So, $W(1)=100$.

    Now, imagine not one, but two particles flew out, as is depicted in Figure 1b. Well, this means that a different number of arrangements would have led to this situation or microstate. As concluded above, for the first particle, one hundred possibilities existed as there were as many particles in the box, originally. For the second particle, however, only 99 possibilities existed since one had left the building already! Since for every 100 possibilities for the first molecule, 99 other possibilities exist for the second molecule, we calculate that the total number of possibilities leading to this particular state (i.e. 2 escaped, 98 remain), is $100 \times 99 = 9900$. However, since it doesn’t matter which of the two particles leaves the box first and which second, as they look exactly alike, we can divide that number by two, giving a total number of $4950$ possibilities. And so, $W(2) = 4950$.

    More accurately, in general, to calculate the possible combinations in a situation like this, we use the formula

    \begin{equation} W(k) = \frac{n!}{k!(n – k)!}, \end{equation}

    where $n$ is the number of molecules in the box initially, which is 100, and $k$ is the number of molecules having escaped through the hole. $W$ is the letter we will further use to denote the number of possible arrangements of our gas molecules for each situation (e.g. 0 escaped & 100 remain, $W(0)$, or 4 escaped & 96 remain, $W(4)$, et cetera).

    Here is a table with a few results. We included the situation where no single molecule has left the box. Obviously, the number of possible arrangements of the molecules leading to this situation, i.e. 0 escaped & 100 remain, is exactly one. We also included two more configurations where three and four particles have left the box. Note how quickly the possible arrangements increase.

    [table id=1 /]

    Probabilities

    How far can we take this? In this simplistic model, we can imagine the number of molecules remaining in the box becoming equal to the number having escaped into the other box: 50 escaped, 50 remain. So, let’s add $W(50)$ to the table. Also, let’s add more configurations to the table and have even more molecules escape the box until none are left, just to see what happens to the number of possible arrangements.

    [table id=2 /]

    As you can see, the number of possible arrangements decreases again after the box has reached its natural state of equilibrium (i.e. 50 escaped, 50 remain). This is, of course, only logical as the situation ‘flips’, as it were. More and more molecules end up escaping the box rather than remaining.

    If we were to calculate the probability of one or the other situations occurring, how should we go about this? Well, for instance, take the situation, or state, in which precisely zero gas molecules escaped. What is the probability of this state occurring?

    We would need to know the number of possible arrangements ($W$) in the state where there are 0 which escaped and 100 remain (that number is exactly 1, so, $W(0) = 1$), divided by the total of all possible arrangements in all states (the sum of all $W$’s). Mathematically, what we are calculating is the possibility $P$ where 0 molecules have escaped, in other words, for $P(0)$, we write:

    \begin{equation} P(0) = \frac{W(0)}{\text{total of all }W} = \frac{1}{\text{total of all }W}. \end{equation}

    Of course, the total of all $W$ still needs calculation. To do that, we use equation (1) to write down an equation for the sum of all $W$ in the previous table:

    \begin{align} \text{total of all }W &= \text{the sum of }W(0)\text{ to }W(100), \\ &= \sum_{n=0}^{100} \frac{100!}{n!(100-n)!}. \end{align}

    The answer to equation (4) is 1 267 650 600 228 229 401 496 703 205 376.

    That is a large number of total possible arrangements of all possible states. So, you can imagine that the probability of $P(0)$ occurring is inconceivably small: following equation (2), we get about $8 \times 10^{-29}$%. This would be 0% rounded to the nearest whole percentage.

    Likewise, we can calculate the probability of 50 escaping, 50 remaining, or P(50). This turns out to have a probability of 8% (to the nearest whole percentage). In the following plot of probabilities for each state, you can see which state is most likely to occur.

    A diagram showing that the equilibrium state (50 escaped, 50 remain) has the highest probability of just shy of 8%. Any other state has a drastically lower probability of occurring.

    So, in a way, given enough time, the arrangements of water molecules will converge to the state with the highest probability. Here, this is the situation where 50 molecules escaped, 50 remain. This is the so-called equilibrium point. Though there may be fluctuation around its equilibrium—plus or minus one or a few particles—it is perfectly fair to say that the probability of no molecules remaining, P(0), and the probability of all molecules escaping, P(100), are near zero. Intuitively, this is what you would expect: while it is theoretically possible, in practice, you will never live long enough to ever witness all the molecules randomly gathering in just one box.

    Back to our wet clothes

    In real life, however, our pair of swimming trunks are not a box nor are there only one hundred water molecules. There are billions of water molecules in a liquid phase held together by the fabric of our garment. Also, there is the Sun. And there might be wind or even just a slight breeze. Besides, not looking like a box, swimmers don’t have a hole attached to a second box.

    However, if the box is a metaphor for our wet clothes, then the second box is a metaphor for its environment, the open air. And now, it gets interesting.

    In our example of the two boxes, no further external forces played any role(beginfootnote)A system that is thermally isolated from its surroundings is called an adiabatic system.(endfootnote). There was no wind, no Sun, no air humidity to consider. In reality, of course, they should be taken into account. Here’s what they do: Sun heats up the water in the trunks, causing its molecules to gain energy, aiding escape from the fabric. Wind causes the air molecules to bump into water molecules, removing excess water vapour around the clothes, aiding the water molecules to evaporate even further. As long as the relative air humidity isn’t too high, drier air helps to evaporate the water even further.

    So, what do these circumstances do, exactly? They shift the equilibrium point in our plot to the right. States where more and more molecules escape and less remain in the box, that is, stay in the swimming trunks, get a higher probability of occurring due to these circumstances.

    In other words, if our boxes would be subjected to the elements, it would cause the equilibrium point to shift from 50 escaped, 50 remain, towards 95 escaped, 5 remain, for instance.

    Ludwig Boltzmann (1844-1906)
    Ludwig Boltzmann (1844-1906)

    Moreover, since the air outside is practically infinitely large compared to our swimming trunks—and not at all like the spatially limited second box of our metaphor—the number of ways water molecules can be arranged by random motion, in a system of clothes hanging in the air outside, is significantly leaning towards the state where most escape into the air, even without wind and sunshine. Even though it may take longer, that state is practically inevitable.

    It was the Austrian physicist Ludwig Boltzmann who elaborated on this very statistical nature of states of a system, specifically in terms of its possible configurations of microscopically small molecules per one and the same end state.

    Entropy and the second law of thermodynamics

    Grave of Ludwig Boltzmann on Zentralfriedhof (Central Cemetery), Vienna, Austria

    Now, because the number of possible arrangements, $W(k)$, gets very big very fast, Boltzmann calculated their natural logarithm value. This is a very neat function when dealing with incredibly large numbers and exponential growth. On any respectable high school calculator, this can be done using the ‘ln’-button.

    Boltzmann then proceeded to multiply these log values with a constant $k$(beginfootnote)which is a different $k$ than the one we used earlier. The value of this $k = 1.380649 \times 10^{-23}\text{JK}^{-1}$.(endfootnote) to link the phenomenon of mechanically mixing stuff (arrangements of molecules) with the thermodynamical phenomenon of entropy of heat. We now call this constant $k$ the Boltzmann constant. He then wrote down the famous expression which we now call Boltzmann’s equation for entropy. In Vienna, in the city’s Central Cemetery, his gravestone is engraved with this very formula:

    \begin{equation} S = k\log_e W. \end{equation}

    So, now we get a new table with values for entropy $S$:

    [table id=3 /]

    As you can see, entropy $S$ increases towards the equilibrium point, only to decrease beyond that, up to the point where it is zero again. Note that the highest value of entropy also has the highest probability value. This means that the state of the box and its surroundings (the other box) will tend to maximum entropy. This also means that an equilibrium point entails maximum entropy.

    Going back to our system of wet clothing and their surroundings (the air) this means that, here too, the state of wet clothing will tend to maximum entropy. This value will correspond to the situation where most of the water molecules have escaped the clothes.

    This is the second law of thermodynamics: the entropy of the Universe tends to a maximum.

    Why do wet clothes dry?

    While external factors such as sunshine, wind, and relatively low air humidity do cause the probability distribution to shift more towards the state where most water molecules escape the clothes, based on the random motion of molecules alone, statistically, they should leave the fabric anyway (even though this is a slower process than with sunshine, wind, et cetera).

    This is because the number of ways in which water molecules remain inside the clothes is simply almost infinitely small compared to the number of ways where they are not inside the clothes. This leads to the statistical fact that the probability of water molecules not remaining in the clothing outweighs the probability of them remaining in the clothing.

    There are simply more places for water molecules to be in the open air than there are within the constrained spatial dimensions of someone’s tight swimming trunks. Or anyone’s, really.

    Ultimately, wet clothes dry because the entropy of the Universe tends to a maximum.


    Photo of Boltzmann’s grave by Daderot, under CC BY-SA 3.0.

  • When and why do you multiply probabilities?

    When and why do you multiply probabilities?


    At high school you may have been taught that, sometimes, you have to multiply probabilities. We briefly discuss when and why you do this.

    Download PDF


    First a few notes on the notation of probabilities. When throwing with a dice, the event of throwing a six is 1 of 6 possibilities. We write this as a fraction, 1/6, or

    \[
    \frac{1}{6}.
    \]

    We then say there is a probability of 1 out of 6 to throw, for instance, a 6. The probability is 1/6, one sixth.

    This also means that the probability of throwing a number—this can thus be any number: 1, 2, 3, 4, 5 or 6—is equal to \[ \frac{6}{6} = 1. \]

    If you throw a dice, the probability is 1 for throwing a number, or 100%. In other words, if something is 100% certain to happen, the probability is 1. And if something is less certain to occur, less than 100%, the probability is an n’th part of 1.

    Lastly, an important announcement on multiplying by a fraction: if you calculate an n’th part of something, for instance, 16, you can write this in two ways. You divide 16 by 2 or you multiply 16 by 1/2. It is the same. That is: \[ \frac{16}{2} = 16\times\frac{1}{2} = 8. \]

    Two coins

    Suppose, you throw euro #1 into the air. It is going to be either heads or tails. In Figure fig:figure1, this is represented schematically. The probability of throwing heads is 1/2. The odds of throwing tails is 1/2.

    Figure 1

    Imagine throwing euro #1 and euro #2 into the air. This is represented in Figure 1.

    Now, ask yourself the question: of all the times I threw heads with euro #1, how many times would I have thrown euro #2? The answer is that half of the time euro #1 became heads and half of that time europ #2 became heads.

    What is half of a half? This is
    \[
    \underbrace{\frac{1/2}{2}}_\text{half of a half} = \frac{1}{2} \times \frac{1}{2} = \frac{1}{4}.
    \]

    Figure 2

    Part of a part

    See Figure fig:figure3. Suppose, we throw two coins 16 times. Suppose, coin number 1 turns out heads half the time; we signify this with blue circles. The question is how many times that coin number 1 is heads, do we throw heads with the second coin? This is, again, half. Half of half, that is. We paint this green.

    Of the total amount of throws, what part is green? Half (4) of half (8) of the total (16), so 4 out of 16, or 1 out of 4. So, what is the probability of throwing green (coin number 2 is heads) if you throw blue (coin number 1 is heads) half of the time. \[ \frac{1/2}{2} = \frac{1}{2}\times\frac{1}{2} = \frac{1}{4}. \]

    Figure 3

    A euro and a dice

    Another example. Suppose, you throw a euro and a dice into the air. The probability distribution of heads and tails is 1/2, as we know. In the case of the dice this is different: it can turn out to be 1, 2, 3, 4, 5 or 6. So, the probability of throwing a six is 1/6.

    Of all the trials where the euro turned out to be heads—which is half of the total amount of trials—how many times would you have thrown a 6 with the dice? That is, thus, 1/6th of one half of the total amount of trials. Or, \[ \frac{1/2}{6} = \frac{1}{2} \times \frac{1}{6} = \frac{1}{12}. \]

    Conclusion

    Suppose, that the probability is 2/3 for event $A$ to happen, the probability is 1/6 for event $B$ to occur, and 4/5 that even $C$ will happen, then the probability of the combination of the events $A$, $B$, and $C$ to occur is equal to \[ \underbrace{\frac{2}{3}}_A \times \underbrace{\frac{1}{6}}_B \times \underbrace{\frac{4}{5}}_C = \frac{8}{90} = \frac{4}{45} \approx 0.088\dots, \] which is 8.9% rounded to one decimal.

    To know what the probability of a combination of events occurring is, we calculate the n’th time of an n’th time. And the n’th time of an n’th time (of an n’th time, etc…) is the same als multiplying the two (or more) fractions.

  • The riddle of birthdays

    The riddle of birthdays


    Probabilities can be hard to grasp. For instance, what are the chances that among a birthday party’s attendants two or more people will have their birthdays on the same day? Probably better than you might expect.

    Download PDF


    Since the day she was born, every year, my mother’s birthday has been on 1 January. This year, she celebrated her twelfth jubilee year in a cosy party room filled with about fifty people.

    Being the life and soul of any party, during my little talk, I presented the guests the fact that the probability of my mother’s day of birth being 1 January equalled 1/365. As most years consist of 365 days, I left leap years out of consideration. I also assumed a uniform distribution of birthdays in a year as this makes it easier to perform further calculations.

    Then I asked what the probability was for my father to be born on 8 July, given that there 365 days to choose from. The answer was, again, 1 out of 365, or 1/365. Of course, in this respect, a particular day is not more special than another particular day other than the cultural significance we assign to some.

    Then I asked the crucial question: what is the probability that two or more people in this room share the same birthday? Of course, irrespective of their year of birth. It was purely about the day of the year.

    In other words, there are 365 days in a year and we have 50 people whose birthdays have spread over those 365 days. What is the probability that two (or more) birthdays fall on the same day?

    Here, I am increasing the party fun by putting forward a maths riddle during my little talk.
    Here, I am increasing the party fun by putting forward a maths riddle during my little talk.

    Sometimes, people think of an example with dice. Suppose, you have two dice. The probability of throwing a six is 1/6, which is the same for throwing a six with the other dice. The chances of throwing sixes with both dice is, thus, 1/6 $\times$ 1/6 = 1/36. Logically, the probability is smaller than throwing a six with one dice. (Read When and why do you multiply probabilities?) Many people argue that the probability of two people having their birthday on 8 July, for instance, is therefore equal to 1/365 $\times$ 1/365 = 1/133225; which is, therefore, a very small probability. This would be in accordance with many people’s intuition: it would be highly unlikely if two people, within a group of fifty people, would share their birthday, wouldn’t it?

    Others think of 50 marbles in a jar with 365 marbles. You draw one marble out of the jar en put it back again. You then shake the jar. Again, you draw a marble out of the jar. What is the probability you draw the same marble out of the jar? This way, people get the answer of 50/365.

    But no, both strategies are incorrect. In reality, the probability is 97%, rounded to the nearest integer percentage. Therefore, I would want to bet a good bottle of wine on this.

    The calculation

    Often, in mathematics, it is easier to explore the opposite situation. Let us proceed accordingly. The reverse situation is that no one shares their birthday. Let us look at this more closely. What is the probability no one shares their birthday?

    We have 365 days. We have 50 humans. What is the probability that human number 1 in the group has their birthday on a day? Mind the phrasing of the question. A day, not a specific day. Hence, we are not asking what the probability is of being born on, for instance, 8 July. We are asking ourselves what the probability is of human number 1 being born on one of those 365 days. Well, that is 365 out of 365 days, or 365/365, or $365:365=1$, or 100%.

    Now, what is the probability that human number 2 in the group has their birthday on a day, but not the same day as human number 1 has theirs? Therefore, the possibilities for human number 2 to have their birthday are one fewer than 365, which is, perhaps not surprisingly, 364. Otherwise, both human number 1 and 2 could have had their birthdays on the same day. So, the probability that human number 2 is having their birthday on another day is 364 out of 365, or 364/365, or $364:365=0.997\dots$, or 99.7%.

    And so, what is the probability that both have their birthday on different days? This is

    \[ \frac{365}{365} \times \frac{364}{365} = 1 \times 0.997\dots = 0.997\dots, \]

    or 100% rounded to the nearest integer percentage. In other words, de chances are practically non-existent for them having their birthday on the same day.

    Yet, what happens if we involve a third human? What is the probability for human number 3 having their birthday on a different day than those of humans number 1 and 2? This is then 363 out of 365, or 363/365, or $363:365=0,994\dots$, or 99.4%. And so, what are the odds that humans number 1, 2 and 3 all have their birthdays on different days? This is then

    \[ \frac{365}{365} \times \frac{364}{365} \times \frac{363}{365} = \frac{132132}{133225} = 0.991\dots, \]

    or 99%, rounded.

    Just to make sure, let us involve a fourth human. The probability for human number 4 to have their birthday on a different day than those of humans number 1, 2 and 3, is 362/365, or $362:365=0.991\dots$. And so, what is the probability that humans numbers 1, 2, 3 and 4 have their birthdays on different days? This is then

    \[ \frac{365}{365} \times \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} = \frac{47831784}{48627125} = 0.983\dots, \]

    or 98%, rounded. We can now clearly observe the decreasing probability of humans having their birthdays on different days with each addition of humans.

    Imagine we would continue this process until human number 50. The probability that human number 50 has their birthday on any other day than the rest of the 49 preceding humans, then becomes 316/365. So, the probability that all fifty humans have their birthdays on different days is calculable as follows:

    \[ \frac{365}{365} \times \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} \times \dotsm \times \frac{317}{365} \times \frac{316}{365} = 0.029\dots, \]

    that is, only 2.9%!

    So, now we have our answer. The opposite situation, i.e. the probability that not all fifty humans have their birthdays on different days, is the reverse of 2.9% and this is 97.1%. Or, 97% rounded.

    Among the fifty guests, no fewer than six people turned out to share their birthday. In other words, we found three ‘pairs’ sharing their birthday.

    By the way, among a group of 23 people, the probability is already 0.504 (so, just over 50%) for two (or more) people to share their birthday. The odds grow favourably quickly.

    Might you want to read more, this phenomenon rests on the pigeonhole principle or Dirichlet’s box principle—this nineteenth century German mathematician was probably the first one to formalise it. Happy Googling! (Though we highly recommend DuckDuckGo.com.)

    You can use our calculator to quickly calculate the probability for a number of people you specify.

    Photo of the birthday cake by Will Clayton under CC BY 2.0.