What Is a Factorial? Simple Definition + Examples

By

Liz Fujiwara

Aug 14, 2025

A factorial, represented by the exclamation mark (!), is the product of all positive integers from 1 up to a specific number. For instance, 5! equals 5 × 4 × 3 × 2 × 1, which results in 120. Factorials are a fundamental concept in mathematics, playing a key role in topics such as the factorial formula, combinatorics, probability theory, and even computer algorithms. They are essential for calculating permutations, combinations, and solving problems involving arrangements or sequences. In this article, we will explain what a factorial is, provide clear examples, and explore the many applications of factorials in both mathematics and real-world scenarios.

Key Takeaways

  • A factorial, represented by n!, is the product of all positive integers up to n and is essential for solving problems in probability, permutations, and combinations.

  • The factorial function has a recursive definition, where n! = n × (n – 1)!, with special cases including 0! = 1 and the fact that factorials are undefined for negative integers.

  • Factorials are widely used in various fields, including combinatorial mathematics and cryptography, and can be efficiently calculated using scientific calculators or software tools for larger numbers.

Understanding Factorials

An illustration explaining what is a factorial.

A factorial, denoted by an exclamation mark (!), is the product of all positive integers up to a given number. This function is vital in counting problems, especially for ordering objects. Historically, the term “factorial” was used to describe this multiplication of possibilities, and it underpins many areas of mathematics. Factorials play a key role in mathematics, particularly in probability, permutations, combinations, sequences, and series. They help answer the fundamental question: How many different ways can we arrange a set of objects?

Definition of Factorial

Defined for non-negative integers, the factorial function represents the product of all positive integers up to a given integer n. It is denoted by the exclamation mark (!), indicating multiplication of all positive integers up to that number. To calculate a number’s factorial, multiply it by all descending integers down to 1. For example, 5! is 5 × 4 × 3 × 2 × 1, which equals 120.

Examples of Factorial Calculations

Consider the factorial of 5: 5! equals 5 × 4 × 3 × 2 × 1, which results in 120. This means there are 120 ways to arrange 5 distinct objects. To find 6!, use 5!: 6! = 6 × 120 = 720. For 7!, use 6!: 7! = 7 × 720 = 5,040. These examples demonstrate how smaller factorials can be used to compute larger ones efficiently.

Factorial Notation and Formula

A diagram showing factorial notation and its formula.

A positive integer followed by an exclamation point, such as n!, represents factorial notation. It indicates the product of all positive integers up to n. The formula is straightforward:

n! = n × (n – 1) × (n – 2) × … × 1.

The factorial function also has a recursive definition: n! equals n multiplied by (n – 1)!. This approach simplifies calculations and highlights the connections between different factorial values.

Factorial Notation

Each entry in a factorial table shows the product of all positive integers up to that number, denoted by n!. For example, 5! is the product of integers from 1 to 5, which equals 120. The table lists factorial values sequentially, illustrating that each value is the product of all positive integers up to that number.

Recursive Formula for Factorials

The relationship between a number’s factorial and its predecessor’s factorial is defined recursively as n! = n × (n – 1)!. For example, to find 10!, use 9!: 10! = 10 × 9!. This recursive formula is particularly useful in programming and in mathematical proofs, especially when working with recurrence relations.

Special Cases in Factorials

Confused student at laptop with question mark, symbolizing special cases in factorials.

Special cases in factorial calculations include scenarios such as zero factorial and negative integers. These cases have specific definitions and rules that set them apart from regular factorial calculations. Zero factorial (0!) is defined as 1, a result supported by various mathematical patterns. Factorials are undefined for negative integers, as they lead to division by zero.

Zero Factorial

Zero factorial, denoted as 0!, is defined as 1. This may seem counterintuitive, but it represents the single way to arrange zero objects, known as the empty arrangement. This definition follows the pattern of factorials, where each step reduces the factorial function by accounting for one fewer object to arrange.

Negative Integer Factorials

Factorials are undefined for negative integers due to complications such as division by zero. This restriction highlights an important limitation in the application of factorial functions.

Practical Applications of Factorials

An illustration of practical applications of factorials in real life.

Factorials are vital in counting permutations and combinations in combinatorial mathematics, helping determine arrangements of objects in order. They are also essential in cryptography for calculating probabilities. Overall, factorials play a significant role in both combinatorics and cryptography, showcasing their diverse applications.

Factorials in Permutations and Combinations

Factorials are key in calculating permutations and combinations, helping solve combinatorial problems. The formula for permutations, nPk = n! / (n – k)!, counts the number of arrangements, while the formula for combinations, nCk = n! / (k!(n – k)!), determines the number of ways to select items. Factorials also play a significant role in number theory and are used in logistical applications for resource management in businesses, showing their practical importance beyond theoretical mathematics.

Use in Programming

For large numbers like 15, using a scientific calculator is recommended for accuracy and efficiency. These calculators are especially helpful for solving factorial problems due to their ability to handle complex calculations. Factorials are also crucial for programmers, particularly for applying algorithms involving combinations, permutations, and statistical computations. Such functions are often used in operations like sorting and calculating data arrangements.

How to Calculate Factorials

Factorials, denoted by ‘n!’, are calculated by multiplying all positive integers from 1 to n. To calculate n! manually, start with the number n and multiply it by every positive integer below it down to 1. For example, 5! is 5 × 4 × 3 × 2 × 1, totaling 120. Calculators and software tools simplify the factorial calculation process with built-in functions, which are especially useful for large numbers where manual calculations can be tedious and error-prone.

Manual Calculation

When calculating factorials by hand:

  • Write the descending sequence of numbers.

  • Multiply the numbers in the sequence.

  • Use smaller factorials to compute larger ones.

  • Pair numbers that easily multiply to ten for simplification.

This method ensures accuracy and efficiency in manual calculations.

Using Calculators and Software

A scientific calculator can expedite the calculation of large factorials using the ‘x!’ function. Many models have a dedicated button for direct factorial calculations. Software tools can efficiently handle even larger factorials without the need for manual computation.

Factorial Table for Numbers 1 to 10

Students with math tools illustrating factorials from 1 to 10.

A factorial, represented by n!, is the product of all positive integers up to n. Below is a table showing the factorial values for numbers 1 through 10:

n

n!

1

1

2

2

3

6

4

24

5

120

6

720

7

5040

8

40320

9

362880

10

3628800

Table Explanation

To use a factorial table, locate the number in the left column and find its corresponding factorial value in the adjacent right column. A factorial table provides a quick and easy reference for finding factorial values.

Double Factorials and Sub-factorials

Double factorials, denoted as n!!, refer to the product of all integers from 1 to n that share the same parity (odd or even) as n. For example, 6!! equals 6 × 4 × 2 = 48, and 5!! equals 5 × 3 × 1 = 15. Sub-factorials, denoted as !n, represent the number of derangements of n objects—permutations where no object appears in its original position.

Double Factorials

Double factorials, denoted by n!!, vary based on the integer’s parity. For even numbers, it is defined as n!! = n × (n – 2) × (n – 4) × … × 2. For odd numbers, the pattern continues similarly down to 1. For even n, the double factorial can be represented recursively as n!! = n × (n – 2)!!. The same recursive formula applies for odd n: n!! = n × (n – 2)!!.

Sub-factorials

Sub-factorials count permutations where no object appears in its starting position, known as derangements. The sub-factorial of n, denoted as !n, can be calculated using the recursive relationship:

!n = (n – 1)(!(n – 1) + !(n – 2)).

This concept applies to permutations of n objects and highlights the complexity and interesting nature of sub-factorials in combinatorial mathematics.

Advanced Topics in Factorials

A factorial n! is divisible by n when n is prime. Each factor of five in n! can pair with a factor of two to produce trailing zeros. The number of trailing zeros in a factorial is calculated by summing the quotients of n divided by powers of 5 (e.g., ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋, etc.).

Double factorials, indicated as n!!, refer to the product of all integers up to n that share the same parity as n. The sub-factorial of n, denoted as !n, can be computed using the formula:

!n = n! × ∑ (–1)^k / k! for k = 0 to n.

Stirling's Approximation

Stirling’s approximation estimates factorials for large numbers, improving computational efficiency.  The formula is typically expressed as n! ~ square root(2πn)(n/e)^n.

Refinements of Stirling’s approximation include error bounds that quantify the difference between actual factorial values and their estimates.

Gamma Function

The Gamma function generalizes factorials to non-integer values and is defined by an integral. It allows the calculation of factorials for half-integers, expanding its applicability beyond whole numbers. The Gamma function extends the concept to complex numbers and is defined for all complex numbers except non-positive integers. This makes it a useful tool in advanced mathematics and statistical calculations.

Summary

Factorials are a vital mathematical function with a wide range of applications in permutations, combinations, and probability calculations. Understanding the basic definition, notation, and formula for factorials is essential for tackling various mathematical problems. Special cases like zero factorial and the undefined nature of factorials for negative integers highlight the intricacies of this concept.

Practical applications extend to programming and advanced mathematical theories such as Stirling’s approximation and the Gamma function. By mastering factorials, you unlock the ability to solve complex problems and gain insight into deeper mathematical principles.

FAQ

What is the factorial of 0 or 1?

What is the factorial of 0 or 1?

What is the factorial of 0 or 1?

What are factorials used for in programming?

What are factorials used for in programming?

What are factorials used for in programming?

How do I write a factorial function in Python?

How do I write a factorial function in Python?

How do I write a factorial function in Python?

What is a factorial in math?

What is a factorial in math?

What is a factorial in math?

How do you calculate a factorial of a number?

How do you calculate a factorial of a number?

How do you calculate a factorial of a number?