- 124 Views
- Uploaded on
- Presentation posted in: General

Lecture 5

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Lecture 5

Counting 4.3,4.4

r-permutation:

An ordered arrangement of r elements of a set of n distinct elements.

Example: S={1,2,3}:

3,2,1 is a permutation of S.

3,2 is a 2-permutation of S

Note: set is unordered, but permutation is ordered! (no curly brackets).

The number of r-permutations of n objects is:

P(n,r)=n(n-1)(n-2)...(n-r+1)=n! / (n-r)!

First object can be chosen in n ways, second in (n-1) ways etc. until n-r+1.

Use product rule to get the result.

(reminder: n! = n(n-1)(n-2)...1).

Example:

A mailman needs to bring 8 packages to 8 cities. He starts at city 1.

How many ways are there to visit the remaining 7 cities?

Pick second city among 7, 3rd among 6 etc. = 7!

How many permutations of the letters “abcdefgh” contain “abc” as a block.

Rename “abc” to B. Now we have:

how many permutations of Bdefgh are there?

answer: 6!

r-combination:

An unordered selection of r elements (or subset of size r) of a set of n elements.

Example: S={1 2 3 4}.

{ 3 2 1}={1 2 3} is a r-combination.

The total number of r-combinations of a set of size n is given by the

binomial coefficient: C(n,r)=n! / r! (n-r)! 0<=r<=n

Note that this is equal to P(n,r) / r!

The reason is that P(n,r) counts the total number of ordered arrangements.

However, we are only interested in unordered “arrangements” here.

For every subset of r elements one can exactly construct r! ordered arrangements,

everyone of which is included in P(n,r), but should be considered the same in C(n,r).

We thus overcounted by a factor r!, which we need to divide out.

Remark: the expression n! / (n-r)! r! is inefficient to compute.

However, we can rewrite as follows:

n! / (n-r)! r! =n (n-1) ... (n-r+1) / r (r-1) ... 1 if r < n-r

= n (n-1) ...(r+1) / (n-r) (n-r-1) ... 1 if r > n-r

This must always be an integer (which is not so clear from the equation).

Example:

C(4,2) = number of ways to select 2 objects among 4. (“4-choose-2”).

S={1 2 3 4}{1 2} {1 3}{1 4}{2 3}{2 4}{3 4}

C(4,2)=6=4 3 2 1 / 2 *2.

From the definition it is easy to see: C(n,r) = n! / r! (n-r)!

C(n,n-r) = n! / (n-r)! r!

C(n,r)=C(n,n-r)

However, it can also be proved using combinatorial arguments:

Let S be a set of n elements, and A be a subset of r elements.

The following questions have the same answer:

How many subsets A and how many subsets (S-A) are there?

The reason is that for every subset of r elements, there is exactly

one subset of n-r elements which is the remainder.

Since A has r elements and S-A has (n-r) the result follows.

Example:

In how many ways can we pick 5 players from 10 candidates C(10,5).

2) How many bit-strings of size 10 contain 4 1’s.

We need to place 4 1’s in 10 slots: C(10,4).

3) We need to form a committee of 7 people, 3 from math and 4 from computer

science to develop a discrete math course. There are 9 math candidates and

11 CS candidates. How many possibilities?

Two separate problems that need to be combined using the product rule.

C(9,3) possibilities for math AND C(11,4) possibilities for CS:

Total = C(9,3) C(11,4) = 27,720.

Note: C(n,r), P(n,r), n! etc have like 2^n the potential to grow very fast with n.

Behavior of C/P for fixed n=12 and growing r.

C(12,r)

P(12,r)

r

r

We will now study some properties of the binomial coefficients.

First the Binomial theorem:

Explanation: The left hand side is a product of n terms: (x+y)(x+y) ....

If I am going to write out their multiplication, a cross-product x^(n-j) y^j

can appear in many different ways. To get the coefficient in front we need to

count in how many ways precisely.

-Start with the first term: x^n. From each term in the product I have to pick the x-term.

This can be done in exactly one way.

- The next term: x^(n-1) y can be done in n ways, because I have n choices for the

y variable, and given that, the x’s are picked from the remaining terms.

-General, I have C(n,j) ways to pick y’s (x follows) or equivalently C(n,n-j) ways to pick x’s

Examples:

1) What is the coefficient of x^12 y^13 in the expansion of (x+y)^25 ?

I need to pick 12 x’s from 25 terms: C(25,12)=C(25,13).

2) What is the coefficient of x^12 y^13 in (2x-3y)^25 ?

First replace a=2x and b=-3y.

The coefficient of a^12 b^13 in (a+b)^25 is C(25,12).

thus it follows that: C(25,12) a^12 b^13 = C(25,12) 2^12 x^12 (-3)^13 y^13

coefficient is thus: C(25,12) 2^12 (-3)^13

We already saw that the cardinality of the power-set of a set with

n elements has 2^n elements.

The total number of elements must be equal to the total number of

subsets with zeros element (empty set) pus with 1 element, etc.

There are precisely C(n,j) ways to pick a subset of j elements from a set

with n elements, thus is follows that:

alternative proof: we know:

Now set x=1, y=1....

Some other special cases of

set x=1, y=-1

set x=1, y=2

T

j

a

S

Pascal’s identity:

T

j

T

j-1

=

+

a

S

a

S

C(n.j)

C(n,j-1)

C(n+1,j)

This leads to Pascal’s Triangle.

From this we see an easy way to generate all coefficients

recursively.

C(4,1)+

C(4,2)=

C(5,2)

1

0

r-1

r

More Identities:

VanderMonde’s identity:

Proof:

Let Sn be a set with n elements and Sm be a set with m different elements.

The total number of subsets of r elements of the union of Sn and Sm is C(m+n,r).

However, this must be the same as picking zero elements from Sn and r from Sm

(C(n,0) C(m,r)) plus one from Sn and (r-1) from Sm (C(n,1) C(m,r-1)) etc. until

r from Sn and zero from Sm (C(n,r *C(m,0)). Summing these up we get the

identity.

remove r

n

n

m

n

m

+...

m

=

+

If we set m=n, r=n then we get:

n=7,r=3.

#(1,1,1,1,0,0,0,0) = C(3,3)+

#(?,?,?,?,1,0,0,0) = C(4,3)+

#(?,?,?,?,?,1,0,0) = C(5,3)+

.

#(?,?,?,?,?,?,?,1) = C(7,3).

Combinatorial proof using bit-strings:

Left: the number of bit-strings of length n+1 with r+1 one’s.

This must be equal to the following:

Start with all one’s s.t. last 1 is at position r+1. There is one way to do that.

Now all bitstrings s.t. last 1 is at r+2. There are C(r+1,r) ways to do that.

Generally: bitstrings s.t. last 1 is at r+k+1. There are C(r+k,r) ways to do that.

Repeat until r+k = n+1 : C(n,r) ways to do that.

Finally, all these possibilities are different, so we must add them to

get the final answer.

(m,n)

one possible path.

(0,0)

How many paths are there from (0,0) to (m,n) with right and up moves as the only

allowed moves?

We need exactly, m up moves and n right moves to end in (m,n).

Let “up” be a “1” and right be a “0”. Thus we need to count the total number

of bit-strings with exactly m 1’s and n 0’s. This is equal to C(m+n,n).