# When To Use Factorials (6 Uses Of Factorials)

Factorials are used throughout mathematics, in topics from algebra, analysis and calculus to probability and statistics.  As a result, it helps to have an idea of how this important concept is applied in each of these areas.

So, when do you use factorials?  Factorials are used in binomial coefficients (entries in Pascal’s Triangle). They are also use in combinatorics & probability for combinations, permutations, & Poisson distributions. They are used in calculus & analysis for Power Series expansions (for ex, sin(x), & cos(x)) and the gamma function.

Of course, factorials are really just a shorthand way to express a specific product of numbers.  By using them, we are making it easier to read and write expressions that involve these products.

In this article, we’ll talk about when to use factorials.  We’ll also see what the calculations for factorials look like.

Let’s get started.

## When To Use Factorials

Factorials are recursively defined, which means that (N+1)! depends on the value of N! – for example, 5! is equal to 5*4!, or 5*4*3*2*1.

Factorials are used of various purposes throughout mathematics in analysis, combinatorics, and statistics, such as:

• Permutations
• Combinations
• Binomial Coefficients (Entries In Pascal’s Triangle)
• Poisson Distributions
• Power Series Expansions For Various Functions (such as ex, sin(x), and cos(x))
• Gamma Function

Let’s take a closer look at each of these in turn, starting with binomial coefficients.

### Permutations

Factorials are used to calculate permutations when we select r items from a group of n distinct items (when order of the objects matters – for example, if we laid the r items out in a row on a table).

Remember that the definition of a permutation for items chosen from a group of n distinct items is:

• nPr = n! / (n – r)!

or

• nPr = n(n – 1)*…*(n – r + 1)

### Example 1: Permutations Of 3 Marbles

Let’s say we have 3 marbles: a blue, a green, and a red.  We want to find out how many ways we can order the marbles if we choose two of them.

We would use the permutation formula for n = 3 (the total number of marbles we are choosing from) and r = 2 (the number of marbles we are choosing).

This gives us:

• nPr = n! / (n – r)!
• 3P2 = 3! / (3 – 2)!
• 3P2 = 3*2*1 / 1!
• 3P2 = 6 / 1
• 3P2 = 6

Since the order of the marbles matters, the six permutations are as follows:

• Blue & green
• Blue & red
• Green & blue
• Green & red
• Red & blue
• Red & green

#### Example 2: Permutations of 5 Marbles

Let’s say we have 5 marbles: a blue, a green, a red, an orange, and a yellow.  We want to find out how many ways we can order the marbles if we choose three of them.

We would use the permutation formula for n = 5 (the total number of marbles we are choosing from) and r = 3 (the number of marbles we are choosing).

This gives us:

• nPr = n! / (n – r)!
• 5P3 = 5! / (5 – 3)!
• 5P3 = 5! / 2!
• 5P3 = 5*4*3*2! / 2!
• 5P3 = 5*4*3
• 5P3 = 60

### Combinations

Factorials are used to calculate combinations when we select r items from a group of n distinct items (when order does not matter – for example, if we put the r items in a bag).

Remember that the definition of a combination is:

• nCr = n! / r!(n – r)!

or

• nCr = n(n – 1)*…*(n – r + 1) / r(r – 1)*…*2*1

Note that nCr = nPr / r!, which means that for given values of n and r, there are fewer combinations than permutations.  This is because the order of the items does not matter.

#### Example 1: Combinations Of 3 Marbles

Let’s say we have 3 marbles: a blue, a green, and a red.  We want to find out how many ways we can choose two of the marbles.

We would use the combination formula for n = 3 (the total number of marbles we are choosing from) and r = 2 (the number of marbles we are choosing).

This gives us:

• nCr = n! / r!(n – r)!
• 3C2 = 3! / 2!(3 – 2)!
• 3C2 = 3! / 2!1!
• 3C2 = 3*2*1 / 2*1*1
• 3C2 = 6 / 2
• 3C2 = 3

Since the order of the marbles does not matter, the three combinations are as follows:

• Blue & green (same as green & blue)
• Blue & red (same as red & blue)
• Green & blue (same as blue & green)

#### Example 2: Permutations of 5 Marbles

Let’s say we have 5 marbles: a blue, a green, a red, an orange, and a yellow.  We want to find out how many ways we can choose three of them.

We would use the combination formula for n = 5 (the total number of marbles we are choosing from) and r = 3 (the number of marbles we are choosing).

This gives us:

• nCr = n! / r!(n – r)!
• 5C3 = 5! / 3!(5 – 3)!
• 5C3 = 5! / 3!2!
• 5C3 = 5*4*3! / 3!2!
• 5C3 = 5*4/ 2!
• 5C3 = 20 / 2
• 5C3 = 10

### Binomial Coefficients

Factorials are also used to calculate binomial coefficients (that is, the entries in Pascal’s Triangle).  These coefficients make it much easier for us to expand powers of binomials, such as:

• (x + y)4 = x4 + 4x3y + 6x2y2 + 4xy3 + y4

Note that it would become quite time-consuming to use the Distributive Property repeatedly on (x + y)n for large values of n.

To find the binomial coefficients for (x + y)n, we calculate the values of nCr for r = 0 to n.  Note that there are n + 1 of these coefficients (the same number of entries in the nth row of Pascal’s Triangle).

For n = 4 (the example above), we calculate:4Cr for r = 0, 1, 2, 3, and 4 to get:

• 4C0 = 4! / 0!(4 – 0)! = 4! / 0!4! = 1
• 4C1 = 4! / 1!(4 – 1)! = 4! / 1!3! = 4
• 4C2 = 4! / 2!(4 – 2)! = 4! / 2!2! = 6
• 4C3 = 4! / 3!(4 – 3)! = 4! / 3!1! = 4
• 4C4 = 4! / 4!(4 – 4)! = 4! / 4!0! = 1

These are the same coefficients that we saw before: 1, 4, 6, 4, and 1.  Note that the exponents for x and y are given by n – r and r for each term.

That is, the rth term in the binomial expansion (x + y)n is given by:

• nCrxn-ryr

We can also read the binomial coefficients for (x + y)n from Pascal’s Triangle, which is pictured below:

### Poisson Distributions

Factorials are also used to define a Poisson distribution, which is used in probability & statistics.  A Poisson distribution is a discrete probability distribution defined by the probability density function

• f(k, λ) = λke / k!

Note that this is the probability that we see k occurrences of an event in a given time interval if λ is the mean (and variance) of the number of occurrences in a time interval (each event occurs independently).

The Poisson distribution can be used to model probabilities for things like:

• the number of patients admitted to a hospital emergency room in a given hour
• the number of cars passing over a bridge on a given day

### Power Series Expansions

Factorials are also used in analysis & calculus to write power series expansions for functions such as:

• ex
• 1 / (1 – x)
• sin(x)
• cos(x)

A power series is the sum of all terms (from n = 0 to infinity) of the form:

• an(x – c)n

where an is the coefficient of the nth term, and c is a constant (the center).  We can use any value for c, but it is often convenient to use a center of c = 0 (such as in a Maclaurin series, which is a Taylor series with c = 0).

This simplifies the terms to:

• an(x – 0)n = anxn

The coefficients an for the functions mentioned earlier are as follows:

• ex: an = 1 / n!
• 1 / (1 – x): an = 1

Note that we can find the value of the constant e by using x = 1, which gives us the sum of the reciprocal of every factorial from n = 0 to infinity:

• e = 1/0! + 1/1! + 1/2! + 1/3! + …

The terms of two common trig functions, sine and cosine, are given by:

• sin(x): (-1)nx2n+1 / (2n + 1)!
• cos(x): (-1)nx2n / (2n)!

These expansions make it clear that sin(0) = 0 and cos(0) = 1.

### Gamma Function

The gamma function expands the factorial function to complex numbers.  It is defined by

• Γ(n) = (n – 1)!

Note that this definition means that:

• Γ(n+1) = n!
• Γ(n+1) = n(n-1)!
• Γ(n+1) = nΓ(n)

which means that gamma is a recursively defined function.  It is used in analysis, calculus, differential equations, and statistics.

## Conclusion

Now you know when to use factorials in various areas within mathematics.