# Courses: Sriram Sankaranarayanan

### Site Tools

lecture_twenty_three_notes

# CSCI 2824: Lecture 23

We will continue discussing permutations and combinations. We will derive the formulae for counting permutations and combinations. Next, we will start discussing the binomial theorem.

## Basic Rules for Counting

Rule of products: If $|A| = m$ and $|B| = n$ then $|A \times B| = m * n$.

### Example-1

We have 3 tee shirts with colors { red, green, blue } and 2 caps with labels {A,B}. How many possible ways are there of choosing a tee shirt and a cap?

### Example-2

Let us say that in a tournament teams A, B and C play matches against each other in a round robin. How many matches are played?

How many possible outcomes are there for the tournament?

Answer To count matches is easy, we know that there are three matches to be played M1: A vs. B, M2: A vs. C and M3: B vs. C.

Each match has two outcomes. Winner1 = {A,B}, Winner2 = {A,C}, Winner3 = {B,C}. Therefore, applying the product rule are 2 * 2 * 2 = 8 outcomes overall.

### Rule of Sums

Rule of sums: If $A$ and $B$ are disjoint then $|A \cup B| = |A| + |B|$.

### Example-1

We are allowed to make up a positive integer from the digits {1,3,5,7}. Each digit is to be used at most once (we may decide to skip a digit).

1. example of legal digits are: 13, 1, 3, 137, 7135, ….

Solution We split the problem into 4 disjoint counts: count all one digit numbers, two digit numbers, three digit and four digit numbers that can be formed. Together, using the rule of sums, we can simply add these counts and get the required overall count.

1. One digit numbers: 4 possible choices.
2. Two digit numbers: ${}^4P_2 = \frac{4!}{2!} = 12$ possible choices.
3. Thee digit numbers: ${}^4P_3 = \frac{4!}{1!} = 24$ possible choices.
4. Four digit numbers: ${}^4P_4 = \frac{4!}{0!} = 24$ possible choices (remember $0! =1$).

Adding them up we have $4 + 12 + 24 + 24 = 64$ possible numbers.

### Rule of Complements

Recall that $\overline{A} = U - A$ for a universal set $U$ where $A \subseteq U$.

Rule of complements Let us say that instead of counting $|A|$, we can count $|\overline{A}|$. Then $|A| = |U| - |\overline{A}|$.

### Example #1

How many odd numbers are there between $45$ and $101$ (include both limits in your count).

First let us just count the even numbers $46,48,..$. Why?

1. 46 → 1 even number
2. 48 → 2 even numbers
3. 50 → 3 even numbers
4. n → $\frac{(n-44)}{2}$ even numbers.
5. 100 → $\frac{56}{2}$ = 28 even numbers.

There are a total of $101-44= 57$ numbers between $45$ and $101$.

Therefore, odd number count is $57 - 28 = 29$.

### Example #2

Let us say we toss a coin ten times. Each time we toss, we get a head or a tail.

1. How many possible outcomes are there for the ten tosses?
2. How many outcomes are there where we see two heads in succession or two tails in succession?

## Permutations

We looked at permutations last class. Let us spell things out a little more.

Take a set $A = \{a_1,\ldots,a_n\}$ with $n$ elements. A permutation of $1 \leq m \leq n$ elements is a sequence of elements $a_{i_1},\ldots,a_{i_m}$ of $m$ distinct elements chosen from $A$:

1. No element can be chosen twice.
2. The order in which we choose the elements matter.

Eg., What are all the permutations of $2$ elements chosen from the set $\{1,2,3\}$. Answer:

1. 1,2
2. 2,1
3. 1,3
4. 3,1
5. 2,3
6. 3,2

This gives rise to 6 permutations.

The number of permutations of $m$ elements chosen from a set of $n$ elements is denoted ${}^nP_m$.

What is the number ${}^nP_m$?

1. $n$ choices for the first element in the permutation.
2. $n-1$ choices for the second.
3. $n-2$ for the third.
4. $n-m+1$ choices for the $m^{th}$ element.

That gives us by product rule $n * (n-1) * ... * (n-m+1)$ choices overall. We can write the number above as ${}^nP_m = \frac{n!}{(n-m)!}$.

### Example #1

How many 4 digit numbers can we form from the digits {1,2,3,7,9}, where we need to use each digit precisely once?

In other words we are looking for a permutation of 4 elements from a set with 5 elements. The answer is ${}^5P_4$ which is $\frac{5!}{(5-4)!} = 5! = 120$.

### Example #2

How many four digit numbers can be formed wherein (a) the digits in {1,2,3,7,9} are never used or (b) if some digit is used it is used multiple times.

Wierd problem? But can you find a connection between what is asked in Example#1 and Example#2? Often looking at the complement of a set that we need to count can be easier.

### Example#3

Let $A,B$ be two sets where $|A| = |B| = n$. How many one-to-one correspondences can exist between $A$ and $B$?

Answer: Let us write $A$ to be ${a_1,a_2...,a_n}$. Let $B$ be the set ${b_1,...,b_n}$.

1. Choose a permutation of all the $n$ elements of $B$.
2. Once the permutation is chosen, link $a_1$ to the first element in the permutation, $a_2$ to second,…,$a_n$ to the $n^{th}$.

Each one-to-one correspondence can be formed in this manner.

Therefore # of one-to-one correspondences = # of permutations of n elements in $B$ = ${}^nP_n = n!$.

Therefore there are $n!$ functions.

Question: Let us say professor X says that this is the wrong way to do this. He objects that we did not permute $A$. So in his technique:

1. We take each permutation of $A$, each permutation of $B$ and link the corresponding elements of the permutations.

Thus, he reasons that there should be $(n!)^2$ one-to-one correspondences.

What is the flaw in his argument?

## Combinations

We will now talk about combinations. Note that in permutations the order in which we choose things matter. When doing combinations the order does not matter.

A choice of $m$ elements out of a set with $n$ elements is one where

1. we choose $m$ elements (by definition, no element can be chosen twice).
2. the order in which we choose things do not matter.

We say that the number of such choices is ${}^nC_m$ (say it as $n$ choose $m$).

Let us try some examples.

### Example #1

Take the set A ={1,2,3,5}. How many ways are there of choosing a subset with 2 elements?

Obviously, in a subset, we do not care if we choose {1,2} or {2,1} they are the same subset.

Let us first write down the permutations of 2 elements

1. 1,2 and 2,1
2. 1,3 and 3,1
3. 1,5 and 5,1
4. 2,3 and 3,2
5. 2,5 and 5,2
6. 3,5 and 5,3

Now notice that the number of choices in our problem is exactly half the number of permutations.

Since {1,2} is the same as {2,1} {1,3} is the same as {3,1} and so on.

So the answer should be 6.