 All right, so if we're going to be able to use the tools that we've developed to study problems with lots of molecules, let's say Avogadro's number of molecules, then we need to know how to take the factorial of large numbers so that we can use them in the binomial coefficient or the multinomial coefficient. So to show why that's a problem, let's think about this example. What is the value of n factorial when n is 1,000? So what is 1,000 factorial? So if you have a calculator nearby, of course, you could try to use your calculator to answer this question. So why don't you go ahead and pause the video for a second and type in 1,000 and find the factorial button on your calculator and see what you get when you do that. So if you've paused and come back, what you found is that when you type 1,000 factorial into your calculator, you get an error. That number is so large that your calculator can't calculate it, can't display it. And the reason for that is if I calculate 1,000 factorial, what that means is 1,000 times 999 times 998 times, et cetera, until I get down to 3, 2, 1, and then I can stop multiplying. So those numbers, this number is like 10 to the third. That number is pretty close to 10 to the third. There's a lot of numbers in a row that are pretty close to 10 to the third. They're not all of that big. But if they were all 10 to the third, then that would get 10 to the third 1,000 times. That's something like 10 to the 3,000. It's not quite that large, but 10 to the 3,000, there's not enough digits in the exponent for your calculator to display that number. So your calculator simply can't display a number as large as the result of that calculation, which is why we can't use a calculator to calculate this problem. What we can do instead is something physical chemists do a lot. And there's a question we can't calculate the answer to. We decided we wanted to ask a different question in the first place anyway. So instead, let's imagine that I want to know what the natural log of 1,000 factorial is. So this is the log of the factorial. So that's the log of 1,000 times 999 times, et cetera, 3, 2, 1. If you remember your log rules, in particular, if you remember that log of a product, a times b is equal to log of a plus log of b. So a log of a product is the sum of the natural logs. So this log of this complicated product is the log of 1,000 plus the log of 999 plus. And so on, down to the log of 3, log of 2, log of 1, right? So that's progress. That's something we can do on the calculator. So all I'm doing is adding together 1,000 numbers. They won't overflow the calculator. If I had the patience, we could sit down and calculate log of 1,000, add it to the log of 999, add it to the rest of these logs. And we'd get a number that the calculator can, in fact, display. That's tedious, of course. We don't want to sit down and add the plus button 999 times in order to find the answer to this question. So we'll find a way around that. Let me point out first that if I weren't doing this for 1,000, if I were doing it for some arbitrary number, then what I'd get is log of n plus log of a number 1 smaller plus. And then keep doing this until I get log of 3, log of 2, log of 1. For any arbitrary n, a more compact way of writing that down, of course, is sum up the log of every number where that number runs from k all the way up to n, log of 1, 2, 3, 4, all the way up to log of n. So that's using summation notation to write down what the log of n factorial is. So that's beginning to suggest how we can use a simpler method to find this answer. The sum of all these logs, let me show you what that would look like if I were to graph it. So here's k in this direction. I'll show what log k looks like in this direction. Log k has that sort of shape. Log of 1 is 0, log of 2, log of 3 are other numbers. So I'm combining log of 1 plus log of 2 plus log of 3. I'm adding those numbers up, and I'm doing that all the way up until I get to whatever number I'm interested in, which has its own logarithm. So another way of writing this sum, the sum of all these logarithms, log of 1 is 0, add to that log of 2, add to that the log of 3, and so on until I get up to the log of n. So I want to sum up the areas of each of these little rectangles that I've drawn that have a height of log 2, log 3, log 4, and so on, and have a width of 1. But we know how to calculate the area under this curve, which is exactly what I've described here. The area of these rectangles is very similar to, not exactly the same as, but very similar to the area under that green curve. That's what we know from calculus is calculating the area under the curve is like doing an integral. So when I say the sum of a bunch of things, letting k range through a range of values, that's an awful lot like, let's say, ln of n factorial is not exactly equal to but is close to the integral of log k. So the sum has become an integral. The value of k is still ranging from 1 to n, except now I say integral of log k dk, where k runs from 1 to n. So all I've done here is I've converted the sum to an integral, kept the integral the same as the inside of the sum, and now I'm integrating over values of k instead of summing over different values of k. And the picture is just there to illustrate that why these are both doing the same thing. It's worth pointing out that in calculus class, the way we initially calculated integrals is using a sum to approximate the true area often in calculus, what you want to do is find the area under the green curve and you approximate it with a bunch of skinny rectangles. In this case, what we actually want is the sum of the rectangles. And we're approximating that with the value of the integral. So this is the approximate result. That's the result we actually want. But now that we've written it as an integral, we can do the integral. That's not integral of log k is perhaps not one that's easily commonly memorized, but it turns out the answer to the integral of log k is k log k minus k. If you want to double check, that's true, and I would encourage you to do this. Positivity right now, take the derivative of k log k minus k. A little bit of simplification happens, and you'll find that the derivative of this quantity is log k, which proves that I'm right in telling you that the integral of log k is k log k minus k. I want to evaluate that in this definite integral between 1 and n. So plug in a capital N. I've got n log n minus n. And from that, I subtract 1 log 1 minus 1. So the logarithm of 1 is 0. So that term goes away. This minus 1 term doesn't go away. There's two negative signs. So my end result is that this is equal to n log n minus n plus 1 after the two negative signs combined. So what I've found is that the log of n factorial is not exactly equal to, but is approximately equal to n times the log of n minus an n plus a 1. And in fact, the only time we're going to use this formula is when n is a pretty large number like 1,000. If n is a small number, 6 factorial, you wouldn't use this formula. You'd work it out by hand or you'd plug it into your calculator. If n is 20 or 50, your calculator can handle it. But when n gets to be very large numbers in your calculator can't handle it, then we're going to use this formula. And if n is a number like 1,000 or much larger, then including this 1 is not very important compared to the n. The 1 is lost in the least significant digits of this number. So we often ignore that 1 because it's so much smaller than n. And if we write that the log of n factorial is n log n minus n, this equation put in a box, that's the expression we call Sterling's approximation. So this is a way of estimating the value of the log of n factorial when we can't get it by direct multiplication or from a calculator. So I can show you an example of how that works. Let's go back to our initial problem. We wanted to know what 1,000 factorial was. And we then changed the problem and said, OK, maybe we'd be happy enough knowing what the log of 1,000 factorial was. So when n is 1,000, the log of 1,000 factorial, according to Sterling, is 1,000 log of 1,000 minus 1,000. So that's easy enough to do on the calculator. We can plug those numbers into the calculator. And we find when we do that, then we get 5,908 points, something or other. So roughly 5,908. What that tells us, log of 1,000 factorial is 5,908. If I really want to know what 1,000 factorial is, all I have to do is undo the logarithm by taking the exponential of both sides, so e to the 5,908. So 1,000 factorial has the value of e to the 5,908. You might now think, OK, that's great. Now all I have to do is go to the calculator and ask what e to the 5,908 is. But then we're back to this problem. e to the 5,908 is a larger, large enough that your calculator can't display it. So don't be tempted to ask your calculator what that number is. What we'd really like to know is e to the 5,908. We're not used to thinking of powers of e. We're much more used to thinking of scientific notation, powers of 10. We'd like to know is that 10 to the what? So I'll tell you that is another one of the log rules to remember is that is 10 to the 5,908 divided by the logarithm of 10. Because that's a formula that I often have to rederive for myself, I'll assume that you don't remember it either. So the trick I used right there was to say, if I have e to the something, and I want to know is that equal to 10 to the something else, I'd like to know what the value of x is. The trick to remember to derive this formula is let's take the natural log of both sides of this expression. So if I take the natural log of e to the a, that's just a. So I'm taking ln of both sides of this expression. So natural log of e to the a is a. Natural log of 10 to the x is x times natural log of 10. So then if I rearrange this equation to figure out what x is equal to if I divide by log 10, so the power I have to raise 10 to get the same thing as raising e to the power of a, that power is a divided by log 10. So that's where I got this result. e to the 5,908 is 10 to the 5,908 divided by log 10. So if I continue with that problem, I find that 1,000 factorial is 10 to the 5,908 over log 10. If I ask the calculator what 5908 divided by log of 10 is, that works out to be 2,566 or so. So in the end, what we figured out is that we can find an estimate for the value of 1,000 factorial. 1,000 factorial is 10 to the 2,566. So a number that is 2,566 digits long, a number with four digits up in the exponent. So it's large enough your calculator can't display it, but we can still on paper derive an estimate for what that number is. And it's important to remember that this is only an estimate. It's wrong by a little bit because of this approximation of approximating the sum with an integral, but it's often good enough for us to do some calculations with. So now that we know how to use Strowing's approximation for calculating large factorials, we can start using that to calculate some chemical properties of real systems.