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 shorter format is the Taylor series. Here is the Taylor series formula written out:
And here is the same Taylor series formula, but shortened by using a factorial and sigma notation:
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
Your inputted number gets sent to a program that converts it from text data to integer data. The integer then goes into a math routine that multiplies the integer by every integer smaller than it, all the way down to 1. The product of that calculation is sent back and displayed on this page. The calculator follows the exact same steps that a person would, just much faster!