Factorial Calculator Formula
Understand the math behind the factorial calculator. Each variable explained with a worked example.
Formulas Used
Factorial N
factorial_n = factorial(n)Factorial R
factorial_r = factorial(r)Permutations
permutations = n >= r ? factorial(n) / factorial(n - r) : 0Combinations
combinations = n >= r ? factorial(n) / (factorial(r) * factorial(n - r)) : 0Variables
| Variable | Description | Default |
|---|---|---|
n | n | 10 |
r | r (for P and C) | 3 |
How It Works
Factorial, Permutations, and Combinations
Factorial
n! = n × (n-1) × (n-2) × ... × 2 × 1
0! = 1 by convention.
Permutations (order matters)
P(n, r) = n! / (n-r)!
Number of ways to arrange r items from n distinct items.
Combinations (order doesn't matter)
C(n, r) = n! / (r! × (n-r)!)
Number of ways to choose r items from n without regard to order.
Worked Example
Calculate 10!, P(10,3), and C(10,3).
- 0110! = 3,628,800
- 02P(10,3) = 10!/7! = 10×9×8 = 720
- 03C(10,3) = 720/3! = 720/6 = 120
Frequently Asked Questions
What is a factorial?
n factorial (n!) is the product of all positive integers from 1 to n. For example, 5! = 120. By convention, 0! = 1.
What is the difference between permutations and combinations?
Permutations count ordered arrangements (ABC is different from BCA). Combinations count unordered selections (ABC is the same as BCA).
Why does 0! equal 1?
By convention and to make formulas work consistently. There is exactly one way to arrange zero objects: do nothing.
Ready to run the numbers?
Open Factorial Calculator