Programmers and Teachers:
Lesson on Factorials
Why Factorials are Useful
A factorial is a number multiplied by every positive integer smaller than itself. It is notated as:
n! = n×(n – 1)×(n – 2) …×2×1
Where n is a positive integer. The factorial results in the product of all positive integers less than or equal to n. For example:
4! = 4×3×2×1 = 24
Factorials are very useful for shortening formulas and notations. An example of a factorial allowing a formula to be written in a shorter format is the Taylor series. Here is the Taylor series formula written in its fully expanded form:
And here is the same Taylor series formula, but shortened by using a factorial and sigma notation:
Notice how much shorter the formula becomes while maintaining its equivalence! Factorials have other uses as well, but this is a great example of how to leverage them.
There is only one rule for applying a factorial to a number. The value of n must be a positive integer. If n is zero, such that the notated factorial is 0!, then the result is 1. This is due to the empty product principle, which tells us the product of multiplying no factors is 1.
Remember to never include zero in the sequence of factors in a factorial. For example, 3! = 3×2×1. The incorrect version of this factorial is 3! = 3×2×1×0. If a factorial is written out this way, it will always result in zero and be incorrect.
Examples of Expanded Factorials
1.) 5! = 5×4×3×2×1 = 120
2.) 1! = 1
3.) n! = n×(n – 1)×(n – 2)×(n – 3) …×2×1
4.) 7! = 7×6×5×4×3×2×1 = 5,040
5.) 3! = 3×2×1 = 6
6.) Y! = Y×(Y – 1)×(Y – 2)×(Y – 3)×…×2×1
How the Calculator Works
When you click the “calculate” button, your inputted number is filtered and fed to the CAS. The CAS computes the factorial result and sends that solution back to the main calculator routine. Then, the answer is converted to LaTeX which allows it to be rendered visually. The LaTeX gets rendered in the answer area as the factorial result.