explanation of notation in programming problem

329 Views Asked by At

I am trying to attempt to solve this problem but I am unsure what this equation means:

$$\frac{n!}{ r!(n-r)!}$$

What do the exclamation marks mean in the above?

5

There are 5 best solutions below

9
On BEST ANSWER

This means $^nC_r$. This is the formula for calculating the number of ways of "choosing" $r$ objects out of $n$ objects where order does not matter and $r$ is less than or equal to $n$. The $!$ you are asking about is called factorial. Which means the product of all the numbers before it. We define $0!=1$. Also to calculate factorials of $1, 0.5$ etc, gamma function is used. Talking about the $^nC_r$ formula, you can take the example of finding the number of ways of choosing a committee of $3$ people from $5$ people $A,B,C,D$ & $E$. So answer is $^5C_3=\frac{5!}{3!(5-3)!}=10$. So $10$ is the answer here.
You may want to take a look at these-
$0!=1$
$1!=1$
$2!=2$
$3!=6$
$4!=24$
$5!=120$
$6!=720$
$7!=5040$
$8!=40320$

0
On

They mean factorial, defined as

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

Like $$4! = 1 \cdot 2 \cdot 3 \cdot 4 = 24 $$

1
On

As @johannesvalks said, the formula is $$n! = 1\times 2 \times 3 \times 4 \cdots \times n$$

And the function is named factorial. We define $0!=1$.

However there is also a combinatorial description. $n!$ is namely the number of ways to order $n$ different objects. We can see that as following: there are $n$ possibilities for the first place. Then we've used already 1 object, so there are $n-1$ possibilities for the second place. Then we've used already 2 objects, so there are $n-2$ possibilities for the third place. This goes on until there are no objects left, so we indeed multiply the numbers 1 through $n$.


The expression

$$\frac{n!}{(n-r)!\cdot r!}$$

Also has a combinatorial description. This is the ways to choose $r$ objects out of $n$ where the order of choosing doesn't matter.

0
On

As explained, its a symbol meaning factorial and defined as:

$$ n! =\prod_{k=1}^{n}k = n(n-1)(n-2)\cdots 2 \cdot1 $$

e.g.

$$3! = 3\times2\times1, \ 0! = 1$$

They have very interesting applications in probability theory (see binomial theorem), series (see definition of trigonometric functions, taylor series), combinatorics, etc.

0
On

$n!$ is the factorial function, defined on natural numbers by

$$ n! = n \cdot (n-1) \cdot \ldots \cdot 2 \cdot 1 $$

(the empty product is $1$; consequently $0! = 1$).

The particular formula

$$ \frac{n!}{r!(n-r)!} $$

computes the binomial coefficient $\binom{n}{r}$ whenever $n,r$ are integers with $0 \leq r \leq n$, which has many applications, such as computing combinations: $\binom{n}{r} = {}_nC_r$, the number of ways to choose a set of $r$ elements out of a set of $n$ (distinguishable) elements.

Sometimes this notation is mildly abused to mean

$$ \frac{n}{1} \cdot \frac{n-1}{2} \cdot \frac{n-2}{3} \cdot \ldots \cdot \frac{n-r+2}{r-1} \cdot \frac{n-r+1}{r} $$

which is still the binomial coefficient $\binom{n}{r}$, but is well-defined whenever $r$ is a natural number, no matter what $n$ is. e.g. I've seen polynomials written using this.

This abuse of notation also happens with just $n! / (n-r)!$.

Sometimes, $n!$ is an abuse of notation to mean $\Gamma(n+1)$, where $\Gamma$ is the "gamma function". While $\Gamma(n+1) = n!$ for every natural number $n$, $\Gamma(z)$ is defined for all complex numbers $z$. (and has simple poles at the nonnegative integers)