Factorials

By Martin McBride, 2022-09-01
Tags: factorial permutations maclaurin series
Categories: number theory


The factorial of n is written as n! and is defined for all non-negative integers. For positive integers n! is defined as the product of every positive integer less than or equal to n, for example:

$$ 4! = 4 \times 3 \times 2 \times 1 = 24 $$

More generally:

$$ n! = n \times (n - 1) \times (n - 2) \times \cdots \times 3 \times 2 \times 1 $$

The factorial of 0 is a special case, as we will see below.

Relationship between successive factorials

The factorial of n is equal to n times the factorial of (n - 1):

$$ n! = n \times (n - 1)! $$

What is the factorial of 0?

The factorial of 0 is equal to 1. This is a special case, and might not make sense at first.

So why is the factorial of 0 equal to 1?

One way to understand this is to look at the previous equation:

$$ n! = n \times (n - 1)! $$

When n equals 1, this becomes:

$$ 1! = 1 \times 0! $$

Since 1! is 1, it follows from this equation that 0! must also be 1.

Another way to understand it is in terms of the empty product.

Empty sums and empty product

We can find the sum of a set of numbers by adding all the numbers in the set together:

  • The sum of the set {2, 4, 5} is 11. We just add the numbers together.
  • What about the sum of the set {3}? We can't add the numbers together because there is only one number, but intuitively we would say the sum is 3.
  • What about the sum of the empty set {}? Again, we can't add the numbers together because there aren't any numbers at all, but intuitively we would say the sum is 0. We call this the empty sum.

We can check that these results make sense in the following way:

  • The sum of the set {2, 4, 5} plus the sum of the set {3} would be 11 plus 3, which is equal to the sum of the set {2, 4, 5, 3} as you would expect.
  • The sum of the set {2, 4, 5} plus the sum of the set {} would be 11 plus 0, which is equal to the sum of the set {2, 4, 5} as you would expect. Adding an empty set has no effect.

We can also find the product of a set of numbers by multiplying all the numbers in the set together:

  • The product of the set {2, 4, 5} is 40. We just multiply the numbers together.
  • What about the product of the set {3}? Intuitively, once again we would say the product is 3.
  • What about the product of the empty set {}? It makes sense to define this to be 1. We call this the empty product. Why is it 1? Because 1 is the multiplicative identity - x times 1 equals x.

We can check that these results make sense in the same way as before:

  • The product of the set {2, 4, 5} times the product of the set {3} would be 11 times 3, which is equal to the product of the set {2, 4, 5, 3} as you would expect.
  • The product of the set {2, 4, 5} times the product of the set {} would be 11 times 1, which is equal to the product of the set {2, 4, 5} as you would expect. Multiplying by an empty set has no effect.

We can apply that to factorials. 3! is the product of {1, 2, 3}, 2! is the product of {1, 2}, 1! is the product of {1}, and 0! is the product of {}, which as we have seen is also 1.

It also turns out that treating 0! as being equal to 1 is very convenient. We will see two examples below.

Uses of factorials in combinatorics

Factorials occur a lot in combinatorics, including permutations.

For example, how many different ways (permutations) are there to arrange the digits 1 to 4? Different permutations of these 4 digits include 1234, 2143, 4321, and so on.

There are 4 factorial permutations because you have 4 choices for the first item, but only 3 choices for the second item (because one digit has been used), 2 for the third item, and only 1 choice for the final item.

In general the number of permutations of n distinct items in n!.

What if you have a set of 0 items? How many different ways are there to arrange that set? The factorial tells us there is exactly 1 way to arrange a set of 0 items, which kind of makes sense.

Uses of factorials in the Maclaurin series

The Maclaurin series of a function f(x) can be written as:

$$ f(x) = f(0) + \frac{f^\prime(0)}{1!}x + \frac{f^{\prime\prime}(0)}{2!}x^2 + \frac{f^{\prime\prime\prime}(0)}{3!}x^3 + \frac{f^{\prime\prime\prime\prime}(0)}{4!}x^4 \cdots $$

where f'(0) is the value of the first derivative of f when x is zero, f''(0) is the value of the second derivative, and so on.

This can be written as:

$$ f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!}x^n $$

But only if 0! is equal to 1.

See also



Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

adder adjacency matrix alu and gate angle area argand diagram binary maths cartesian equation chain rule chord circle cofactor combinations complex modulus complex polygon complex power complex root cosh cosine cosine rule cpu cube decagon demorgans law derivative determinant diagonal directrix dodecagon eigenvalue eigenvector ellipse equilateral triangle euler eulers formula exponent exponential exterior angle first principles flip-flop focus gabriels horn gradient graph hendecagon heptagon hexagon horizontal hyperbola hyperbolic function hyperbolic functions infinity integration by parts integration by substitution interior angle inverse hyperbolic function inverse matrix irrational irregular polygon isosceles trapezium isosceles triangle kite koch curve l system line integral locus maclaurin series major axis matrix matrix algebra mean minor axis nand gate newton raphson method nonagon nor gate normal normal distribution not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutations polar coordinates polynomial power probability probability distribution product rule proof pythagoras proof quadrilateral radians radius rectangle regular polygon rhombus root sech set set-reset flip-flop sine sine rule sinh sloping lines solving equations solving triangles square standard curves standard deviation star polygon statistics straight line graphs surface of revolution symmetry tangent tanh transformation transformations trapezium triangle turtle graphics variance vertical volume volume of revolution xnor gate xor gate