Factorial: n! = nĆ(nā1)Ć...Ć1
n! is the product of all positive integers from 1 to n. 0! = 1 by convention. Used in permutations (n!), combinations (n!/(k!(nāk)!)), and probability. Stirling approximation for large n.
Why This Mathematical Concept Matters
Why: Factorial counts arrangements: n! ways to order n distinct items. Appears in permutations, combinations, Taylor series (e^x), and probability (binomial).
How: Multiply 1Ć2Ć3Ć...Ćn. For large n, use Stirling: n! ā ā(2Ļn)(n/e)^n. 0! = 1. Negative factorial is undefined.
- ān! grows very fast: 10! = 3,628,800.
- āPermutations of n objects = n!.
- āStirling: n! ~ ā(2Ļn)(n/e)^n as nāā.
š Examples ā Click to Load
Factorial Growth
Result Magnitude
š Step-by-Step Breakdown
ā ļøFor educational and informational purposes only. Verify with a qualified professional.
š§® Fascinating Math Facts
0! = 1 by convention. n! = n Ć (nā1)!.
Permutations: P(n,r) = n!/(nār)!.
š Key Takeaways
- ⢠n! = n à (n-1) à ... à 1. By convention, 0! = 1 and 1! = 1
- ⢠Factorials grow extremely fast: 10! ā 3.6 million, 70! exceeds 10^100
- ⢠Double factorial n!! multiplies every 2nd number down to 1 or 2
- ⢠Subfactorial !n counts derangements (permutations with no fixed points)
- ⢠Stirling's approximation: n! ā ā(2Ļn) Ć (n/e)^n ā accurate for large n
š” Did You Know?
š How It Works
n! is the product of all positive integers from 1 to n. By definition, 0! = 1 (empty product). For large n, we use BigInt for exact values up to 170!. Stirling's approximation gives estimates for n > 100.
š Worked Example: 5!
Expand: 5! = 5 Ć 4 Ć 3 Ć 2 Ć 1
Step 1: 5 Ć 4 = 20
Step 2: 20 Ć 3 = 60
Step 3: 60 Ć 2 = 120
Result: 5! = 120
Interpretation: 120 ways to arrange 5 distinct objects.
š Real-World Applications
š² Permutations
Ways to arrange n distinct objects: n!
š¢ Combinations
C(n,k) = n!/(k!(n-k)!)
š Probability
Counting arrangements in probability.
š¬ Taylor Series
e^x = Σ x^n/n!
š Combinatorics
Counting problems, partitions.
š» Algorithms
Complexity of sorting, permutations.
ā ļø Common Mistakes to Avoid
- Negative factorial: n! is undefined for n < 0. Use gamma function for non-integers.
- 0! = 0: Wrong. 0! = 1 by convention (empty product, recursive definition).
- Confusing n! and n!!: n!! is double factorial ā multiplies every 2nd number.
- Overflow: 171! exceeds JavaScript number precision. Use Stirling for large n.
- Trailing zeros: Count = floor(n/5) + floor(n/25) + floor(n/125) + ...
šÆ Expert Tips
š” Stirling for Large n
For n > 100, exact factorial exceeds precision. Use Stirling's approximation.
š” Double Factorial
8!! = 8Ć6Ć4Ć2 = 384. For odd n: 7!! = 7Ć5Ć3Ć1 = 105.
š” Trailing Zeros
Number of trailing zeros in n! = floor(n/5) + floor(n/25) + ...
š” Binomial Link
C(n,k) = n!/(k!(n-k)!). Factorials are essential for combinatorics.
š Reference Table
| n | n! |
|---|---|
| 0 | 1 |
| 1 | 1 |
| 2 | 2 |
| 3 | 6 |
| 4 | 24 |
| 5 | 120 |
| 6 | 720 |
| 7 | 5040 |
| 8 | 40320 |
| 9 | 362880 |
| 10 | 3628800 |
š Quick Reference
š Practice Problems
ā FAQ
Why is 0! = 1?
By convention, to make formulas like C(n,0)=1 and the empty product consistent. It also fits n! = n Ć (n-1)! when n=1.
What is the largest factorial I can compute exactly?
170! is the largest that fits in a 64-bit double. This calculator uses BigInt for exact values up to 170!.
When to use Stirling's approximation?
For n > 100 when you need an estimate. Error drops below 1% for n ā„ 10 and below 0.1% for n ā„ 50.
What is a derangement?
A permutation where no element stays in its original position. !n counts derangements of n objects.
How many trailing zeros does 100! have?
floor(100/5) + floor(100/25) = 20 + 4 = 24 trailing zeros.
What is double factorial?
n!! = n Ć (n-2) Ć ... Ć 1 (odd n) or Ć 2 (even n). 8!! = 8Ć6Ć4Ć2 = 384.
Can I compute factorial of a decimal?
Not directly. Use the gamma function: Ī(n+1) = n! for real n.
š Summary
n! = n Ć (n-1) Ć ... Ć 1 with 0! = 1. Factorials count permutations and appear in combinations, probability, and series. Use Stirling for large n. Double and subfactorial extend the concept.
ā Verification Tip
Check n! = n à (n-1)!. For small n, multiply manually. Compare Stirling with exact for n ⤠170.
š Next Steps
Explore the Permutation Calculator, Combination Calculator, or Multifactorial Calculator for n!!, n!!!, n!!!!.
ā ļø Disclaimer: For educational use. Exact factorials use BigInt; Stirling for large n. Not for cryptographic applications.