A factorial (written n!) is the product of every whole number from 1 up to n.
Factorials show up whenever you’re counting “how many ways” something can happen. How many different orders can a set of items be arranged in? How many distinct handshakes can happen in a room? How many possible PIN codes exist if digits can’t repeat? A factorial is the math shortcut that turns those questions into clean arithmetic.
This article builds your intuition first, then gives you reliable ways to compute factorials, spot patterns, and use them in counting problems. You’ll also see the two identities that make factorial work in algebra, plus what to do when you need a factorial of something that isn’t a whole number.
What a factorial means in plain words
Take a positive whole number n. The factorial of n, written n!, multiplies all whole numbers from 1 through n:
n! = 1 × 2 × 3 × … × n
That little exclamation mark doesn’t mean excitement. It’s just the symbol mathematicians chose for this operation.
Quick read on the notation
When you see “5!”, say “five factorial.” It means:
5! = 1 × 2 × 3 × 4 × 5 = 120
The multiplication starts at 1 by convention. Starting at 2 gives the same result, but writing it from 1 makes the pattern tidy.
Why factorial starts with 0! = 1
This line trips people up: 0! = 1. It’s set that way so the counting rules stay consistent. There’s exactly one way to arrange zero items: do nothing. Also, many formulas would break or need special cases if 0! were anything else.
How to compute factorials without getting lost
For small values, a factorial is just steady multiplication. The main trap is skipping a number or multiplying out of order. A simple habit helps: write the chain once, then multiply from left to right.
Step-by-step with a small number
Say you need 7!:
- Write the full product: 1 × 2 × 3 × 4 × 5 × 6 × 7
- Multiply in chunks: (1 × 2 × 3) = 6, (4 × 5) = 20, then 6 × 20 = 120
- Finish: 120 × 6 × 7 = 5040
You can chunk the product any way that keeps the arithmetic clean. The point is to stay organized.
Build factorials using the “one more step” rule
Factorials stack neatly. Each one is the previous factorial times the next number:
- 6! = 720
- 7! = 7 × 6! = 7 × 720 = 5040
- 8! = 8 × 7! = 8 × 5040 = 40320
This shortcut saves time when you already know a nearby factorial.
Factorial growth: why numbers explode so fast
Factorials rise faster than powers like 2n or 10n. After a point, even a calculator display runs out of room. This matters in real tasks: counting arrangements, computing probabilities, and estimating runtimes in computer science.
A handy way to picture the growth is digits. Each step multiplies by a new number, so the number of digits keeps climbing. That’s why 20! is already a 19-digit integer, and 50! is far beyond what you’d want to multiply by hand.
Where factorials show up in counting problems
Most “how many ways” questions fall into a few patterns. Factorials sit at the center because they naturally count orderings.
Permutations: ordering every item
If you have n distinct items and you arrange all of them in a line, the number of different orders is n!. Think of lining up books on a shelf. You have n choices for the first slot, then n − 1 for the next, and so on, down to 1. Multiply those choices and you get the factorial.
Permutations of part of a set
Sometimes you arrange only r items chosen from n. The count is written as:
P(n, r) = n! / (n − r)!
Why that division works: n! counts arrangements of all n items. Dividing by (n − r)! cancels the extra tail you don’t use when you stop after r positions.
Combinations: choosing without caring about order
When order doesn’t matter, you use combinations. The number of ways to choose r items from n is:
C(n, r) = n! / (r!(n − r)!)
This formula starts from the permutation count and then divides out the extra orders that refer to the same chosen group. A set of three chosen cards has 3! internal orders, yet it’s still the same set of cards.
For a definition and related identities, MathWorld’s page on the factorial function is a solid reference. Factorial function (Wolfram MathWorld) lists standard properties and links to deeper material.
What Is a Factorial? with a real counting setup
Let’s pin factorial to a concrete setup: arranging letters. Take the word TEAM. The letters are all distinct. The number of different four-letter arrangements is 4!:
- 4 choices for the first position
- 3 choices for the second
- 2 choices for the third
- 1 choice for the last
Multiply: 4 × 3 × 2 × 1 = 24, so there are 24 distinct arrangements.
That “choices per slot” logic is the beating heart of factorial. Once you see it, many counting questions turn into the same structure with small tweaks.
Common factorial values you’ll reuse
Having a few factorials memorized saves time and reduces errors. The list below also hints at where factorial counts pop up in everyday math problems.
| n | n! | Where it often appears |
|---|---|---|
| 0 | 1 | Empty arrangement, base cases |
| 1 | 1 | One-item ordering |
| 2 | 2 | Swap two items |
| 3 | 6 | Three-item ordering, small probabilities |
| 4 | 24 | Simple arrangements (letters, seats) |
| 5 | 120 | Counting orders, basic combinatorics |
| 6 | 720 | Dice outcomes in grouped tasks |
| 7 | 5040 | Calendar-like orderings, schedules |
| 8 | 40320 | Eight-step sequences, algorithm counts |
| 10 | 3628800 | Large arrangement counts, approximations |
Factorial rules that make algebra easier
Two identities handle most factorial algebra. They help you simplify fractions, cancel terms, and keep expressions readable.
Shift rule
n! = n × (n − 1)!
This is just the definition written in a compact way. It’s also the reason cancellations work so nicely in permutation and combination formulas.
Cancellation in factorial fractions
When you see a ratio like n! / (n − k)!, expand only the top part that doesn’t cancel:
n! / (n − k)! = n × (n − 1) × … × (n − k + 1)
This approach keeps numbers manageable. You avoid computing two huge factorials only to divide them later.
Factorials in probability: clean counts, clean ratios
Probability questions often boil down to “favorable outcomes divided by all outcomes.” Factorials help count both sides.
Shuffling and random order
A standard deck of 52 distinct cards can be arranged in 52! different orders. That number is so large that two real shuffles almost never match.
Choosing hands
A 5-card hand from a 52-card deck is counted by C(52, 5). That combination count uses factorials to remove ordering inside the hand, since the order you receive the cards doesn’t change which hand you have.
If you want the official, textbook-style extension that connects factorial to the Gamma function, the NIST Digital Library of Mathematical Functions section on Gamma and related functions is a reliable source with precise definitions.
When factorial isn’t a whole number: Gamma steps in
The factorial operation is defined for whole numbers. Yet math often needs a smooth version that works for values like 1/2 or 3.7. That’s where the Gamma function comes in.
Gamma, written Γ(x), matches factorial in this exact way for positive whole numbers:
Γ(n + 1) = n!
So Γ(6) = 5!, and so on. This extension is useful in calculus, statistics, and continuous probability models. You don’t need to compute Gamma by hand for most classes, but it helps to know the relationship so the symbols don’t feel random.
How to compute factorials with tools
Once n gets past 12 or so, manual multiplication turns into busywork. A calculator, spreadsheet, or programming language can do the heavy lifting, and you can spend your time on the setup and interpretation.
Calculator input
Many scientific calculators have an n! button. You enter the number, then apply factorial. If the display uses scientific notation, that’s normal for large factorials.
Spreadsheet formulas
In common spreadsheets, you can use a factorial function. In Excel and Google Sheets, FACT(n) returns n!. Pair it with combinations and permutations functions when you’re checking homework or verifying a count in a project.
Programming notes
Languages like Python, JavaScript (with libraries), and many CAS tools can compute factorials exactly for large integers. When you only need an estimate, libraries often include log-factorial or Gamma-based functions that avoid overflow.
Common mistakes and how to dodge them
Factorial mistakes usually come from one of three places: mixing up order vs. no order, forgetting repeated items, or multiplying too far.
Order matters vs. order doesn’t
If the question is about arranging, ranking, seating, or sequencing, order matters and factorial shows up directly. If the question is only about selecting a group, you usually divide out internal order with another factorial.
Repeated items change the count
If items repeat, plain n! overcounts because swapping identical items doesn’t create a new arrangement. A common fix is to divide by factorials of the repeat counts. A word like LEVEL has repeated letters, so its arrangement count is smaller than 5!.
Factorial stops at n, not n − 1
It sounds basic, yet it’s a frequent slip. If you see n!, the chain includes n. If you need (n − 1)!, stop one step earlier.
Identity table for quick work
This set of identities is what you’ll use most in algebra and counting setups. It’s also a handy checklist when you’re simplifying a long expression.
| Use | Form | When it helps |
|---|---|---|
| Build upward | n! = n × (n − 1)! | Compute a new factorial from a known one |
| Cancel a tail | n!/(n − k)! = n × … × (n − k + 1) | Avoid huge numbers in ratios |
| Permutation count | P(n, r) = n!/(n − r)! | Arrange r items taken from n |
| Combination count | C(n, r) = n!/(r!(n − r)!) | Choose r items from n |
| Repeated items | n!/(a!b!…) | Count arrangements with duplicates |
| Gamma link | Γ(n + 1) = n! | Extend factorial beyond whole numbers |
A practical checklist for factorial questions
When a factorial appears in a problem, run this quick checklist:
- Are you arranging or selecting? Arranging points to permutations; selecting points to combinations.
- Are any items identical? If yes, plain factorial overcounts; divide by factorials of repeats.
- Can you cancel before you multiply? Expand only the part that survives cancellation.
- Do you need an exact integer or just a scale estimate? Pick a tool that matches that need.
Factorial can look like a tiny symbol with a loud result. Once you treat it as “choices per slot,” the symbol stops feeling mysterious, and it becomes a dependable counting tool you can reach for anytime a problem asks, “How many ways?”
References & Sources
- Wolfram MathWorld.“Factorial.”Lists the factorial definition and standard properties used in counting formulas.
- National Institute of Standards and Technology (NIST).“Gamma and Related Functions.”Defines the Gamma function and states its link to factorial via Γ(n + 1) = n!.