An Introduction to Factorials (n!)
The factorial function in math is written as n!, where n can be any whole number greater than or equal to zero. It is a fancy way of telling us to take the product (multiply) of all whole numbers between 1 and itself together (with zero being a special case we will discuss below).
Examples
Shown below is how we would calculate 6!
That same example could be rewritten to the following:
Factorials of 1-10
| n | n! | = | = |
|---|---|---|---|
| 10 | 10×9×8×7×6×5×4×3×2×1 | 10×9! | 3,628,800 |
| 9 | 9×8×7×6×5×4×3×2×1 | 9×8! | 362,880 |
| 8 | 8×7×6×5×4×3×2×1 | 8×7! | 40,320 |
| 7 | 7×6×5×4×3×2×1 | 7×6! | 5,040 |
| 6 | 6×5×4×3×2×1 | 6×5! | 720 |
| 5 | 5×4×3×2×1 | 5×4! | 120 |
| 4 | 4×3×2×1 | 4×3! | 24 |
| 3 | 3×2×1 | 3×2! | 6 |
| 2 | 2×1 | 2×1! | 2 |
| 1 | 1 | 1×0! | 1 |
| 0 | N/A | 0! | 1 |
Calculating a Factorial
Generally speaking, most scientific calculators will have an inbuilt factorial button often labeled n! or x! that will solve for factorials for you, but to gain a better understanding about how they work, read on.
From the example above we can see that the factorial of any number is simply itself multiplied by the factorial of the number 1 less than itself, which can be written as follows:
We could then simplify this to the following:
Then we could apply the same rule we determined above to the 5!:
This methodology can be applied to any positive integer (with the special case of zero being talked about at the bottom of this page). The general form equation we can develop from this is as follows:
Using Product Notation
Product notation is just like summation notation (represented by sigma) but instead of adding we multiply (take the product of) succeeding terms.
The factorial of any integer n>0 can be solved using the following product notation equation:
We can also write the definition as a piecewise function to include the 0! case:
The Zero Case
The factorial of zero is always one, so:
Like me, you may believe that this is a rather counter-intuitive idea, but it can be justified using the following equation which is based on the one we developed above:
Which we can then rearrange to isolate 0!:
Dividing Factorials
The equation above can be expanded to the following:
Then we can cross out like terms to simplify our fraction:
Then we can solve:
Pro Tips
- You can’t take the factorial of a negative number
- You should figure out how to solve for factorials on your calculator before test day
- Remember that 0! is a defined value
Example 1
Let’s say that we had 10 friends we wanted to place in line for ice cream and we wanted to know how many different ways we could arrange them. The equation would be as follows:
Explained: We would have 10 friends to choose from for the first spot in line, but only 9 for the second and only 8 for the third, and so on and so forth.
Example 2
Mike has 10 marbles: 5 are red, 2 are blue, and 3 are green. In how many different ways can he arrange them into a row? The equation would be as follows:
Explained: We start off by taking 10! because that is the number of marbles Mike has. We then want to divide by 5!, 2!, and 3! because those are the sets of the same marbles he has. This is because swapping 2 or more marbles of the same color will have no effect on the way the row of marbles will look, so we want to exclude those cases.
Calculator Code
For those who are interested, I have included the calculator code below:
<input type="number" id="inputFactorial" value="6">
<button onclick="findFactorial()">Find Factorial</button>
<p id="output"></p>
<script>
function findFactorial() {
var x = document.getElementById("inputFactorial").value;
if(x%1 != 0 || x<0){
document.getElementById("output").innerHTML = "please enter a valid input";
}else if(x==0){
document.getElementById("output").innerHTML = "1";
}else{
var n=1;
while(x>0){
n=n*x;
x=x-1;
}
document.getElementById("output").innerHTML = n;
}
}
</script>
THANKS FOR READING