The **factorial** of a non-negative integer *n*, denoted by *n*! ( called n factorial), is the product of all positive integers less than or equal to *n*. For example,

The value of 5! = 1 x 2 x 3 x 4 x 5 = 120

The value of 0! is 1, according to the convention for an empty product.

## Use of factorial function in problems

**Highest power of a prime factor in a number**

The highest power of prime number p in n! = gif(n/p) + gif(n/p^2)+ gif(n/p^3)...0 where gif(x) denotes the greatest integer less than or equal to x.For example,

To find the highest power of 10 in 51! or the number of zeros in 51!.

We first find the prime factors of 10, i.e. 5 and 2.

Highest power of 5 in 51

gif(51/5) + gif(51/25) + gif(51/125) = 10 + 2 + 0 = 12

Highest power of 2 in 51

gif(51/2) + gif(51/4) + gif(51/8) + gif(51/16) + gif(51/32) + gif(51/64) + = 25 + 12 + 6 + 3 + 1 + 0 = 49

**In combinatorics**

The number of ways in which n objects in a line can be arranged is equal to n!. For example,

The arrangement of 5 boys in 5 chairs arranged in a line from left to right can be done in 5! = 120 ways. This can be further understood by considering the individual allotment of each chair, i.e. the first chair can be filled in 5 ways, the second in 4, the third in 3, the fourth in 2 and the last in 1 way. As all these events happen together, the total number of ways is equal to 5 x 4 x 3 x 2 x 1 or 5!.

Also, the arrangement of n terms in r places is equal to n!/r! also referred to as nPr. Selection of r items out of n items can be done in n!/(r! x (n-r)!) or nCr ways.

## Binomial theorem

The binomial expansion uses the factorial in determining the coefficients of variables.

As there are 12 powers of 5 and 49 powers of 2 in 51! there are 12 powers of 10 in 51! or 51! ends with 12 zeros.