Concept

How Factorial Works (with Worked Examples)

Agarapu Ramesh — Editor and content reviewer

Factorial — written n! — is the product of every positive whole number from 1 up to n. It counts the number of ways to arrange n distinct items in order and shows up everywhere in probability, statistics, and combinatorics.

The basic definition

n! = n × (n−1) × (n−2) × … × 2 × 1. So 5! = 5 × 4 × 3 × 2 × 1 = 120. 3! = 3 × 2 × 1 = 6. 1! = 1. The factorial of 0 is defined as 1, by convention — more on that below.

Worked examples

5! = 5 × 4 × 3 × 2 × 1 = 120. 6! = 6 × 5! = 6 × 120 = 720. 7! = 7 × 720 = 5,040. 10! = 3,628,800. 12! = 479,001,600. The growth is faster than any polynomial — 10! is already over three million, and 20! is over two quintillion. Most scientific calculators hit floating-point overflow somewhere around 170!.

Why is 0! equal to 1?

Three ways to see it. (1) The empty product — multiplying no numbers together — is defined as 1 (the multiplicative identity). (2) The recursive rule n! = n × (n−1)! works at n = 1 only if 0! = 1. (3) Combinations and permutations formulas need 0! = 1 for edge cases like nCr(n, 0) = 1 to come out right. All three reasons converge on the same convention.

Factorial in combinations and permutations

nCr(n, r) = n! / (r! × (n−r)!) — the number of unordered selections of r items from n. nPr(n, r) = n! / (n−r)! — the number of ordered arrangements. Example: nCr(5, 2) = 5!/(2!·3!) = 120/(2·6) = 10. Five items, pick two without caring about order — there are 10 ways. nPr(5, 2) = 5!/3! = 120/6 = 20 — twice as many because order now matters.

Factorial in series expansions

Taylor series — sin(x) = x − x³/3! + x⁵/5! − x⁷/7! + … and cos(x) = 1 − x²/2! + x⁴/4! − x⁶/6! + … — use factorials in every term. eˣ = 1 + x + x²/2! + x³/3! + x⁴/4! + … shows the same pattern. The factorials in the denominators are what make these series converge for all real x.

Calculator method

Type the number, press the x! button (sometimes labelled n!), press =. So 7, x!, = gives 5040. On most calculators the x! sits on a SHIFT layer. Above about 170 the result overflows to Infinity — switch to logarithm-of-factorial (Stirling's approximation) for larger n.

Frequently asked questions

What does 5! equal?

5! equals 120. The working: 5 × 4 × 3 × 2 × 1 = 120. Every factorial multiplies the integers from 1 up to n, with no skipping. 5! is the smallest factorial that exceeds 100, and shows up frequently in probability problems involving five items or fewer.

Why is the factorial symbol an exclamation mark?

The exclamation-point notation was introduced by Christian Kramp in 1808. Before that, mathematicians used various symbols. Kramp's notation stuck because it was unambiguous and easy to typeset. 'n!' is read aloud as 'n factorial'.

Can factorial work for negative numbers?

No, not in the basic definition. n! is only defined for non-negative integers (0, 1, 2, 3, …). The gamma function Γ(n) extends factorial to non-integers and complex numbers — Γ(n) = (n−1)! for positive integers — but it diverges at negative integers. Standard scientific calculators do not support negative-input factorial.

What is 100 factorial?

100! is roughly 9.33 × 10¹⁵⁷ — a 158-digit number. Far beyond the range of any standard calculator display, but mathematicians use Stirling's approximation (n! ≈ √(2πn) × (n/e)^n) to get a manageable estimate. 100! exactly has 158 digits and contains many trailing zeros (24 of them, from the factors of 10).

Where do I see factorial in real life?

Card shuffles — a 52-card deck has 52! ≈ 8.07 × 10⁶⁷ possible orderings. Travelling-salesman-style routing problems. Probability of specific arrangements (passwords, locker codes). Probability density functions for discrete distributions like the Poisson. Anywhere you count ordered or unordered selections from a finite set.

Related calculators and guides

Scientific Calculator Fraction Calculator Percentage Calculator How to Use a Scientific Calculator (Complete Guide) DEG vs RAD vs GRAD — Which Mode and When What is e on a Calculator? (Euler's Number Explained) How to Enter Fractions on a Scientific Calculator How to Use nCr and nPr (Combinations vs Permutations)