Factorials. The most emphatic operation. It’s notated x!
It’s defined as:
x!=\prod_{i=1}^{x}i=x\times(x-1)\times(x-2)\times\cdots\times3\times2\times1
with 0! defined to be equal to 1. We’ll get to why in a moment.
Now, one interesting consequence of the way the factorial is defined is that x!=x\times(x-1)!. (Why? Think about it.)
What’s the point of factorials? Say you have five ambiguously-shaped objects, and you want to arrange them.
So you have five slots to arrange the five objects. One way to approach the problem is to realize that you can put any of the five objects in the first slot.
But for the second slot, you only have four options, since one object is already taken (it’s in the first slot). This same argument applies for the other three slots, so:
The total number of arrangements (in this case, a permutation) is equal to 5\cdot4\cdot3\cdot2\cdot1. This is equal to 5!=120.
If you fiddle around with the slots idea (what if I only want to arrange four objects out of my five? see the footnote1You have five options for the first slot, four for the second, etc., but you stop at four slots, so you have 5\cdot4\cdot3\cdot2 ways to arrange the fruit. To generalize this is a little trickier, but eventually you’ll find the formula below.), you will eventually figure out the formula for general permutations: if you have n objects and you want to arrange them in k slots, there are \frac{n!}{(n-k)!} ways to arrange them. Read Wikipedia a bunch, and you’ll realize that factorials factor in2haha quite a lot in probability.
Another thing about the factorial is that is grows fast. 0! is 1, 1! is also 1, 2! is 2, 3! is 6, but 5! is 120, 6! is 720, and 10! is 3628800. 20! has 19 digits, and 59! is greater than the number of protons in the observable universe.3This number (the protons number, not 59!) pops up so often it’s been given a name: the Eddington number. I’ve plotted x! for integer x, and this is the result:
One weird thing about x! is that based on what has already been said here, the graph should look like the above: a bunch of disconnected points at the nonnegative integers.
But if you ask Desmos for “x!“, you get this:
Seeing this should raise some Questions4Yes, with a capital Q.. First of all, what is that function doing being continuous? This means that the Desmos people had somehow defined operations like \pi! and 42.367!. And they’ve defined it over the negative numbers! This means that they’ve figured out how to calculate -3.24\times-4.24\times-5.24 and continue until they’ve reached 1. Needless to say, that’s impossible. Oh, and this includes the fact that this feat has not been replicated for the negative integers, so -2! remains undefined. So what’s really going on here?
The answer lies in a function known as the gamma function (notated with a capital Greek letter gamma, Γ). Look at the graph of \Gamma(x):
This is, of course, the x! graph above, but shifted to the right by one unit, so that \Gamma(x) is undefined at zero as well as the negative integers. But how is it defined?
The gamma function is defined with the use of a technique known as analytic continuation. It’s sort of like connect-the-dots with calculus. Of course, this is hard to follow if you don’t rope in the complex plane, and life is too short to use the complex plane all the time, so luckily we can sidestep all the calculus with our good friend Euler.
Euler discovered the following:5This formula was taken from the first few pages of this document, which does go into the analytic continuation route later on (although it’s not called that by name), so if you’re interested in that I’d recommend it – it’s interesting reading.
\left[\left(\frac{2}{1}\right)^{\!n}\frac{1}{n+1}\right]\left[\left(\frac{3}{2}\right)^{\!n}\frac{2}{n+2}\right]\left[\left(\frac{4}{3}\right)^{\!n}\frac{3}{n+3}\right]\dots=n!
The more terms on the left-hand side, the more accurate the approximation gets.(Explanation for why this product works in the footnote.6Think about it as an infinite product and ignore the left side of each term, the one with the exponent. If you put in, say, 3 for n, the right-hand sides become \frac{1}{4}\cdot\frac{2}{5}\cdot\frac{3}{6}\cdot\frac{4}{7}\cdot\frac{5}{8}\cdots. The 4s and 5s cancel out, and it becomes \frac{1\cdot2\cdot3}{6\cdot7\cdot8}. Now, the numerator is 3!, which is what we want, so we need to get rid of the denominator. This is what the left-hand sides are for. These cancel out really well, so after t terms, they’ve canceled to (t+1)^n, or in our example with 5 terms, 6^3. This approximately cancels out with the 6\cdot7\cdot8 in the denominator in the right-hand side (this approximate cancellation gets better the more terms you add; \frac{100^3}{100\cdot101\cdot102} is a lot closer to 1 than \frac{6^3}{6\cdot7\cdot8}), making the result really close to 3!, the only thing that hasn’t been canceled.
Wow, you read through this whole thing! You must be a dedicated reader. Go treat yourself to a cookie. If you don’t understand the formula, do yourself a favor and read the footnote. If you don’t understand the footnote, then whoops, looks like I’m bad at explaining.)
The whole point of this formula (why multiply increasingly convoluted fractions when I could just be multiplying integers?) is that it’s not just defined on the nonnegative integers; we can now find 2.5! or 1.12358132134! or \frac{\sqrt{\pi}}{2.4} or whatever we want to our heart’s content.7Although the infinite product form does have its limitations, namely not being very precise until you reach hundreds of terms, which is why this is usually expressed in integral form (n! = \int_0^\infty t^{n} e^{-t}\,dt if you really want to know). The integral has its own problems, though, so if you don’t want to trust Desmos or Wolfram but also don’t want to use analytic continuation your life is probably going to be a giant headache.
One point to mention here is that due to the nature of the factorial function being discrete, i.e., several nonconnected points, there are necessarily an infinite number of ways to connect the dots and form a factorial extension. Observe:
Now, since there are an infinite number of ways to extend the factorial function, it is worth addressing the issue of why we can’t just make a new factorial extension that does cover the negative integers. In fact, we can; here’s one such extension:
The reason for why we don’t just use that8One weird thing about the way this function is defined is that (-1)!, which is not defined under the regular gamma function, is defined under Hadamard’s as \ln 2. I found this cool, so I put it here, in a footnote! as the standard factorial extension is twofold: one, the thing with these extensions is that nearly all of them are written in terms of the gamma function, so ultimately it is always easier to just use the gamma function instead of some convoluted expression that uses the gamma function anyways, and two: nobody really cares about noninteger factorials anyway, so math with such factorials generally is just math with the gamma function anyway, so an entirely different function would not help.
And that’s all I have to say on the gamma function, so I’ll see you next time!