On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Statistics & Probability · Grade 9-12

Factorial

The factorial $n!

n!=n×(n−1)×(n−2)×⋯×2×1

Quick Answer

The factorial n! is the product of all positive integers from 1 to n, and it counts the orderings of n distinct items. Use it to count the orders of a whole set: n choices for the first spot, n−1 for the next, down to 1. Three books on a shelf can be arranged 3!=6 ways, and 10 books 10!=3,628,800 ways. Factorials also sit inside the permutation and combination formulas, and 0! is defined as 1 so those formulas still work when nothing is left over.

Why This Matters

Factorials grow faster than any power: 10! is already over 3.6 million, and 52!, the number of ways to shuffle a deck, has 68 digits. That growth explains why checking every possible order fails for scheduling and route problems, and the cancelling of factorials is what makes n!(n−r)! and n!r!(n−r)! easy to work out by hand.

Intuitive Explanation

Line up 5 friends for a photo. Any of the 5 can stand on the left. Once that spot is filled, 4 friends remain for the second spot, then 3, then 2, and the last friend takes the final spot. The number of line-ups is 5×4×3×2×1=120, written 5!.

Each new item multiplies the count by the new total. Add a sixth friend: in each of the 120 line-ups, the newcomer can slot into any of 6 places, so 6!=6×5!=720. That rule, n!=n×(n−1)!, is why factorials explode: 8!=40,320 and 12! is about 479 million. Run the rule backwards and it explains 0!=1: since 1!=1×0!, the value of 0! must be 1, which matches the single way to arrange nothing.

A factorial is not a power. 4!=4×3×2×1=24, but 44=4×4×4×4=256: a power repeats the same factor, while a factorial steps down by one each time. The power counts 4-letter strings when letters may repeat; the factorial counts orders that use each item exactly once. Arranging only some of the items, such as 2 of 4, is a permutation, 4×3=12, not 4!.

Think of it like this. A factorial counts down a shrinking menu. Hand out n different chocolates to n friends, one each: the first friend picks from all n, the next from n−1, and the last friend gets the one that remains. Multiply those menu sizes and you have n!, the number of ways the chocolates can be shared out.

Core idea. n! is the product of every whole number from n down to 1, and it counts how many ways to arrange n things in a row.


When to Use

Use a factorial when you arrange all of a set of distinct items in order: books on a shelf, a full finishing order of runners, the letters of a word with no repeated letters. Phrases like in how many orders or arrange all point here. If only some of the items are placed, use a permutation P(n,r); if order does not matter, use a combination; if items can repeat, use a power such as nr.

Tip. Ask: Am I counting the ways to arrange all n distinct items, multiplying n down to 1?

How to Recognize It

Before writing n!, check whether every item gets a place, whether the items are all different, and whether any item can be used twice.

  1. Does every item in the set get a place in the order, with none left out?

    If yes, the count is n!: 6 songs in a full playlist can be ordered in 6!=720 ways. If only some get places, such as the top 3 of 6, use a permutation, 6×5×4=120.

  2. Are any of the items identical, like the two O's in BOOK?

    If yes, n! counts some arrangements more than once, because swapping identical items changes nothing you can see. Divide by the factorial of each repeat: BOOK has 4!2!=12 arrangements. With all items different, n! is exact.

  3. Can an item be used again after it is placed, like a digit in a code?

    If yes, the choices never shrink, so the count is a power, nr, not a factorial: 3-letter strings from A, B and C number 33=27, while orderings of A, B and C number only 3!=6.

  4. Does the question ask only which items are chosen, with no order at all?

    If yes, the answer is a combination, which uses factorials to divide out the orders: (62)=6!2! 4!=15. A factorial on its own always counts orders.

Factorial compared with Permutation, Exponent, and Combination

Factorials, permutations, powers and combinations all multiply runs of numbers, and permutation and combination formulas are built from factorials. Ask whether the factors drop by one each time (factorial, permutation) or stay the same (exponent), and whether the group's orders are divided out (combination).

Factorial

Meaning
Use this when you are arranging an entire set of distinct items in order, or you need a building block for permutation/combination formulas.
Key test
Am I counting the ways to arrange all n distinct items, multiplying n down to 1?
Formula
n!=n×(n−1)×(n−2)×⋯×2×1
Example
In how many orders can the 4 distinct letters A, B, C, D be lined up?

Permutation

Meaning
Arranges only r of n items, using factorials as parts.
Key test
Use when you order a subset, not the whole set.
Formula
P(n,r)=n!(n−r)!
Example
Top 3 of 8 finishers

Exponent

Meaning
Repeated multiplication of the same base, not descending integers.
Key test
Use for repeated equal factors, like growth or area.
Formula
nk
Example
25=32

Combination

Meaning
Selects r items unordered, dividing factorials.
Key test
Use when picking a group where order is irrelevant.
Formula
C(n,r)=n!r!(n−r)!
Example
Choosing 2 from 5

Formula & Notation

n!=n×(n−1)×(n−2)×⋯×2×1
n!=∏k=1nk for n≥1, with 0!=1 by convention; equivalently n!=n⋅(n−1)!

How to read it: n! reads 'n factorial'; by convention 0!=1

Worked Examples

Example 1 — Arrange the letters

Easy

In how many orders can the 4 distinct letters A, B, C, D be lined up?
Show the steps and the answer
  1. Fill the first position: any of the 4 letters.

    Nothing has been used yet, so all 4 are available.

  2. Fill the rest: 3 letters left for the second position, 2 for the third, 1 for the last.

    Each letter is used once, so every position has one fewer choice than the position before it.

  3. Multiply: 4×3×2×1=24.

    Each choice at one position combines with every choice at the next.

  4. Check one slice of the list: the orders starting with A are ABCD, ABDC, ACBD, ACDB, ADBC, ADCB.

    That is 3!=6 orders for each starting letter, and 4×6=24.

Answer: 24

Takeaway: Arranging all n distinct items gives n! orders: multiply from n down to 1.

Example 2 — Only some, not all

Standard

From 4 letters, how many ways to fill just 2 ordered slots?
Show the steps and the answer
  1. Notice that only 2 of the 4 letters are placed.

    A full factorial, 4!=24, would count orders of all four letters.

  2. Count slot by slot: 4 choices, then 3, so 4×3=12.

    The counting stops after the second slot.

  3. Match the formula: 4!2!=242=12.

    Dividing by 2! removes the orders of the two letters that are not placed.

  4. List to confirm: AB, AC, AD, BA, BC, BD, CA, CB, CD, DA, DB, DC.

    There are 12 ordered pairs, and both AB and BA appear because order matters.

Answer: P(4,2)=4!2!=12

Takeaway: A factorial arranges the whole set; arranging only r of the items is P(n,r)=n!(n−r)!.

Example 3 — Find the mistake: zero factorial

Application

Lia uses P(5,5)=5!(5−5)! to count the ways to arrange 5 books on a shelf and writes: "The bottom is 0!=0, so the formula breaks when r=n." Find the mistake and correct it.
Show the steps and the answer
  1. Recall the convention: 0!=1, not 0.

    The rule n!=n×(n−1)! at n=1 gives 1=1×0!, which forces 0!=1.

  2. Recompute: P(5,5)=5!0!=1201=120.

    With 0!=1 the formula divides by 1 and simply returns 5!.

  3. Check by direct counting: 5×4×3×2×1=120 ways to shelve 5 books.

    Arranging all 5 books is exactly 5!, so the formula and the direct count agree.

Answer: P(5,5)=120

Takeaway: 0!=1, the one way to arrange nothing, and it keeps formulas like P(n,n)=n! and C(n,0)=1 working.

Where You'll See It

  • Shuffling a deck of cards

    A 52-card deck can be ordered in 52! ways, about 8×1067. That number is so large that a well-shuffled deck is almost certainly in an order that no deck in history has been in before.

  • Planning a delivery route

    A driver with 10 stops could visit them in 10!=3,628,800 orders. With 15 stops, 15! is about 1.3 trillion, which is why route-planning software uses clever shortcuts instead of checking every possible order.

Common Mistakes

  1. The slip: Setting 0!=0

    Instead: by definition 0!=1, which keeps the permutation/combination formulas consistent.

  2. The slip: Multiplying only down to a wrong stopping point

    Instead: go all the way to 1 (e.g. 4!=4⋅3⋅2⋅1, not 4⋅3⋅2).

  3. The slip: Confusing n! with n2 or 2n

    Instead: factorial multiplies a descending run, not a square or a double.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. A coach wants to know how many ways 6 runners can be ordered. Compute 6!.

    Hint: Multiply every whole number from 6 down to 1.

  2. Simplify 10!8! without a calculator.

    Hint: Write 10! as 10×9×8!.

  3. In how many orders can 7 students line up for a photo?

    Hint: There are 7 choices for the first spot, 6 for the next, and so on.

  4. Solve for the whole number n: n!(n−2)!=56.

    Hint: Cancel to get a product of two consecutive whole numbers.

  5. You must do 5 different chores, each exactly once. Is the number of possible orders 5! or 55?

    Hint: Can a chore be picked again after it is done?

  6. Mia says C(5,5)=5!5!⋅0! is undefined because 0!=0. Correct her.

    Hint: Check the definition of 0!.

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

How big is 52!, the number of ways to order a deck of cards?

About 8×10678 \times 10^{67}, a number with 68 digits. If every person who has ever lived had shuffled a deck once a second since the universe began, they would not have produced even a tiny fraction of the possible orders. So a thoroughly shuffled deck is almost certainly in an order no deck has ever been in before. Factorials eventually outgrow any power such as 10n10^n: 20!20! is already over 2 quintillion.

Is 0!=1 just a rule someone made up?

It is a definition, but a forced one. Each factorial is the next one divided by its top number: 4!=5!54! = \frac{5!}{5}, 3!=4!43! = \frac{4!}{4}, and so on. Following the pattern down, 1!=2!2=11! = \frac{2!}{2} = 1 and 0!=1!1=10! = \frac{1!}{1} = 1. Any other value would break that pattern, along with results such as (nn)=n!n! 0!=1\binom{n}{n} = \frac{n!}{n!\,0!} = 1, which says there is exactly one way to choose all nn items.

How many zeros are at the end of 25!?

Six. Each zero at the end comes from a factor of 10, which is 2×52 \times 5, and a factorial always has more 2s than 5s, so count the 5s. The multiples of 5 up to 25 are 5, 10, 15, 20 and 25, and 25 contains two 5s, giving 6 in all. You can check a smaller case: 10!=3,628,80010! = 3{,}628{,}800 ends in two zeros, from the 5 and the 10.

Can I take the factorial of a fraction or a negative number?

Not with the counting meaning, since you cannot arrange half an object. Mathematicians did find a smooth curve, the gamma function, that passes through every factorial, and it gives (12)!=π2≈0.886\left(\tfrac{1}{2}\right)! = \tfrac{\sqrt{\pi}}{2} \approx 0.886. It works for fractions and most negative numbers, but it has no value at −1,−2,−3-1, -2, -3 and the other negative whole numbers, so (−1)!(-1)! stays undefined.

Learning Path

← Before

Multiplication
Factorial

You are here

You need Multiplication and some comfort with long products. Factorial adds the count of orderings of a whole set and the rule n!=n×(n−1)!. Next, Permutation uses factorials to count arrangements of part of a set, n!(n−r)!, and Combination divides by one more factorial to count groups where order does not matter.

See Also