6 Factorials

Brokk Toggerson

Learning Objectives

By the end of this chapter, you should be able to…

  • Calculate a factorial.
  • Approximate the value of a factorial using the Stirling Approximation.

What is a factorial?

Let’s begin by thinking about what a factorial is. In our next unit on thermodynamics and statistical physics, a lot of our time will be concerned with the study of entropy, what it is, and how can we quantify it. Over the course of this study, we will encounter a mathematical operation which is known as the factorial. The factorial comes up when you are looking at probabilities quite frequently. For example, when answering the question “if I flip a penny, a nickel, a dime, and a quarter, how many possible permutations of two heads are there?”, you will need to use the idea of the factorial to solve it. The factorial operation is indicated
by the !, such as 3!. How do we calculate factorials? Well, 5! just means to take 5, multiply it by 4, multiply that by 3, multiply that by 2, and finally, multiply by one giving us an answer of 120. Meanwhile, 500! means 500 times 499 times 498 times 497 and so on and so on and so on and so on, until eventually 5 times 4 times 3 times 2 times 1. Now, my calculator has a factorial button; when I try to put in 500!, it essentially burst into flames, but you can see the idea of the calculation here. You take the number, subtract 1, and multiply, and you repeat this process until you get down to 1. Because of this operation, the answer to factorials
can get very big very fast.

Before we come to a method on how to deal with such large numbers, there’s one last point to bring up; 0! = 1. This is a convention, and we won’t go into why necessarily, but you need to know that 0! = 1. Factorials give us very large numbers, so when we take the factorial of a large number, we get a ginormous number, and we need to think of ways to do this without setting our calculators on fire. In our study of thermodynamics and statistical physics will be looking at molecules. Molecules come in moles, which is 10^23 so we will be looking at 10^{23}! Again, if you try to do this with the calculator’s factorial button, you probably will get an error, and so we need a way to handle this.

The Stirling Approximation

Fortunately, in our study, we’ll only be interested in taking the natural logarithms of factorials, so if we’re interested in N!, what we’ll really be interested in is the \ln(N!). This will save us quite a bit, because if we’re interested in the natural log of the factorial of a number, then we can use what is known as the Stirling approximation.

    \[\ln(N!) \approx  N \ln (N) - N\]

This formula is on your equation sheet, so you don’t have to memorize it, however, you need to be able to use it. We’re going to try it through a few numbers to see how well it does. So, here is the calculation for a few different values of N. As you can see, at low values of N, the approximation is not very good, but when N gets to about 80 or so, the approximation is quite good indeed!

N N! ln(N!) Stirling Approximation % Difference
10 3628800 15.104 13.0259 -13.761%
20 2.43 x 1018 42.336 39.915 -5.719%
40 8.16 x 1047 110.321 107.555 -2.507%
80 7.157 x 10118 273.673 270.562 -1.137%

 

License

Share This Book