0% found this document useful (0 votes)
124 views

Elementary Cou - Principle

This document discusses elementary counting techniques including: 1) The basic counting principle and product rule for counting combinations of independent events. 2) The pigeonhole principle which states that if more objects are placed in fewer holes, at least one hole will contain multiple objects. 3) Permutations and combinations for counting ordered and unordered arrangements of objects. Formulas are provided to calculate permutations and combinations.

Uploaded by

Desyilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
124 views

Elementary Cou - Principle

This document discusses elementary counting techniques including: 1) The basic counting principle and product rule for counting combinations of independent events. 2) The pigeonhole principle which states that if more objects are placed in fewer holes, at least one hole will contain multiple objects. 3) Permutations and combinations for counting ordered and unordered arrangements of objects. Formulas are provided to calculate permutations and combinations.

Uploaded by

Desyilal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Elementary Counting Technique

Ayele B

20/02/2011

Ayele B Elementary Counting Technique


1 Basic counting principle.
2 Pigeonhole principles.
3 Permutations and Combinations.
4 Generating Permutations and Combinations.
5 The binomial theorem.

Ayele B Elementary Counting Technique


1.1 Basic counting principle
1.The sum rule
If the first task can be done in n1 ways
the second task in n2 ways
and if the tasks can not be done in the same time,then there are
n1 + n2 ways to do either task
example :- a student can choose a mathematics project from a set
theory (23 topics) and a number theory (29 topics)how many
possible projects are there to choose from?
Generalized sum rule:- Assume that there are
n1 ways to perform T1
n2 ways to perform T2
......
nk waystoperformTk
if the tasks are pairwise disjoint, then the number of ways for at
least one of the tasks to occur is
Pk
n=1 ni = n1 + n2 + ... + nk
Ayele B Elementary Counting Technique
2

An equivalent form of sum rule using set theory terminology is


given
S let A1 , PA2 , ..., Ak be any finite pairwise disjoint sets,then
| ki=1 Ai | = kn=1 |Ai |
Example:-one can reach city B from city A by bus, train, air or by
road(feet) suppose that there are 2 ways by bus, 3 ways by train,4
ways by air and 5 ways by road(feet) then, How many ways are
there to reach from city A to B?

2.The product rule


Suppose that a procedure can be broken down in to two tasks if
there are n1 ways to do the first task n2 ways to do the second
task after the first task can be done then there are n1 × n2 ways to
do the procedure.
Example: The chair of a library are to be labeled with a capital
letter and a positive integer not exceeding 100. What is the largest
number of chair that can be labeled differently?
Ayele B Elementary Counting Technique
3
Exercise: There are 32 microcomputers in a computer counter
each micro computer has 24 ports. How many different ports to a
microcomputer in the center are there?
Generalized product rule: Assume that a task can be
decomposed in to r say T1 , T2 , ..., Tr and there are n1 ways for T1
to occur,n2 ways for T2 to occur.... nr ways for Tr to occur the
total number of waysQfor the task to occur is given by
n1 × n2 × ... × nr = ri=1 ni
Example: How many bit string are there of length 7?
Example: How many different license plates are available if each
plate contains a sequence of three letters followed by three digits?
NOTE:An
Qr equivalent product rule using set theory terminology
Qi=1 Ai = A1Q× A2 × ... × Ar = (a1 , a2 , ..., ar )/ai ∈ Ai , i = 1, 2, ..., r
| ri=1 Ai | = ri=1 |Ai |
Exercise: there are 2 ways to travel from city A to city B 5 ways
from city B to C and 3 ways from city C to D what is the number
of ways to go from city A to D via B and C?
Ayele B Elementary Counting Technique
4
Problems which uses both rules:

Example:
In version of the computer language BASIC the name of the
variable is a string of one or two alpha numeric character more
over the variable name must begin with a letter and must be
different from the 5 strings of two characters that are reserved for
programming use. how many variable name are there in the version
of BASIC?
Example:
Each users in a computer system has a password which is 6 to 8
characters long where each character is an upper case letter or a
digit. Each password must contain at least one digit. how many
possible passwords are there?
Example:- How many integers are there between 0 and 1000 that
have one or more 6’s as digits?
Exercise:- how many odd integers are there between 100 and 1000.
Ayele B Elementary Counting Technique
5
3. The inclusion -Exclusion principle
when two tasks A and B can be done at the same time we can not
use sum rule to count the number of ways to do one of the tasks,
so the number of ways to do one of the two tasks obtained by
adding the number of ways to do each tasks and then subtract the
number of ways to do both tasks.
i.e |A ∪ B| = |A| + |B| − |A ∩ B|
Example: How many bit string of length 8 either starts with the
1’s or ends with the two zeros?
Example: A discrete mathematics class contains 25 students
majoring in CS, 13 in maths and 8 in both. how many students are
in this class if every student is majoring in maths, CS or both?
Generalized Inclusion-Exclusion Principle
Let A1 , A2 , ..., An be finite
P sets, then P
|A1 ∪ A2 ∪ ... ∪ An | = 1≤i≤n |Ai | − 1≤i≤j≤n |Ai ∩ Aj | +
n+1 |A ∩ A ∩ ... ∩ A |
P
1≤i≤j≤k≤n |Ai ∩ Aj ∩ Ak | − ... + (−1) 1 2 n

Ayele B Elementary Counting Technique


6
Example:
A total of 1232 students have taken a course in Spanish 879 have
taken a course in french and 114 have taken a course in Russian.
further 103 have taken course both in Spanish and french 23 have
taken course both in Spanish and Russian and 14 have taken
course both in Russian and french. if 2093 have taken at least one
of Spanish, French and Russian, how many students have taken a
course in all the languages?
Example: Let u be the set of positive integers not exceeding 1000
then |U| = 1000 find |S| where S is the set of such integers which
are not divisible by 3,5 or 7?
4. The Three diagram
we use a branch to represent each possible choice. we represent
the possible outcomes by leaves (which are the end point of
branches not having other branches starting on them.)
Example: how many bit strings of length four which doesn’t have
two consecutive 1’s?
Ayele B Elementary Counting Technique
1.2 Pigeonhole Principle
If n pigeonholes are occupied by n + 1 or more pigeons then atleast
one pigeonhole is occupied by more than one pigeon.
Example: Suppose a department contains 14 professors then two
of the professors (pigeon) where born in the same
month(pigeonholes).
Example: Find the minimum number of elements that one need to
take from the set S = {1, 2, 3, ..., 9} to be sure that two of the
number add up to 10?
Theorem(The generalized pigeonholes principle):
If N objects are placed in to k boxes, then there is at least one box
N
containing at least d e objects.
k
Note: Generalized pigeonhole principle:-if n pigeonhols are
occupied by nk + 1 or more pigeons, where k ∈ Z + at least one
pigeonhole is occupies by k + 1 or more pigeons
Example: Find the minimum number of students in a class to be
sure that three of them are born in the same month?
Ayele B Elementary Counting Technique
8

Example:
1.Find the least number of cables required to connect eight
computers to four printers to guarantee that forevery choice of four
of the eight computers, these four computers can directly access
four different printers.
2.Find the minimum number of students needed to guarantee that
5 of them belong to the same class (freshman, sophomore, junior,
senior)?
Excercise:
1.Find the minimum number of elements that one need to take
from the set S = {1, 2, 3, ..., 8} to be sure that two of the number
add up to 9?
2.Find the least number of cables required to connect 100
computers to 20 printers to guarantee that forevery choice of 20 of
the 100 computers, these 20 computers can directly access 20
different printers.
Ayele B Elementary Counting Technique
1.3 Permutations and Combinations
1.Permutation
Permutation of a set of distinct objects is an ordered arrangement
of these objects.
an ordered arrangement of r-objects of a set is called an
r-permutation
Example: Let S = {1, 2, 3}
The arrangement {3, 1, 2} is a 3-permutation of S.
The arrangement {3, 2} is a 2-permutation of S.
Theorem: The number of r-permutations of a set with n-distinct
element is
nP = n × n − 1 × ... × (n − r + 1) = n!
r (n−r )!
Proof:
There are n - ways to choose the first element
There are n − 1 - ways to choose the second element
...
There are n − r + 1 ways to choose the r th element
so by PR there are n × n − 1 × ... × (n − r + 1) r-permutation
Ayele B Elementary Counting Technique
10
Example:
1. Suppose there are 8 runners in a race. how many different ways
are there to award the gold, silver and bronze medal if all possible
outcomes of the race can occur?
2. How many ways can a president, vice-president and secretary be
selected from a committee of seven people?
3. Suppose that a sales women has to visit eight different cities
she must begin her trip in a specific city, but she can visit the
other in any order she wishes. How many possible orders can the
sales women use when visiting these cities?
Permutations with repetitions:
n!
P(n; n1 , n2 , ..., nr = ) the number of permutations of
n1 !n2 !...nr !
n-objects of which n1 are alike, n2 are alike, ..., nr are
alike(indistinguishable)
Example: Find the number m of seven letter word that can be
formed using the letter of the word ”BENZENE”
Ayele B Elementary Counting Technique
11

Ordered sample:
Choose one element after another r-times we call the choice an
ordered sample of size r.
1.Sample with replacement:
n × n × ... × n = nr , choose r objects from n objects when
repetition allowed.
1.Sample without replacement:
nP = n!
r (n−r )! choose r objects from n objects when repetition
allowed.
Example:
three cards are chosen one after the other from 52-card deck. Find
the number m of ways this can be done.
a)with replacement
b)without replacement

Ayele B Elementary Counting Technique


12

Combination:
An r-combination of elements of a set is an unordered collection of
r-elements from a set
Example: C (4, 2) = 6 since 2-cobination of {a, b, c, d} are the six
subsets {a, b} , {a, c}, {a, d}, {b, c}, {b, d}, {c, d}
Theorem: The number of r-combination of a set with n-elements,
where r , n ∈ Z + and 0 ≤ r ≤ n equals
C (n, r ) = nr = nCr = r !(n−rn!
)! some times called binomial
coefficient
Proof:
P(n, r ) = C (n, r ) × P(r , r )
n!
P(n, r ) (n − r )! n!
C (n, r ) = = =
P(r , r ) r! r !(n − r )!
(r − r )!

Ayele B Elementary Counting Technique


13

Corollary: let n, r ∈ Z + with r ≤ n, thenC (n, r ) = C (n, n − r )


Proof:
n! n!
C (n, r ) = = = C (n, n − r )
r !(n − r )! [n − (n − r )]!(n − r )!
Example:
1. Find the number of different subsets of size 3 in the set
{m, a, t, h, r , o, c, k, s}
2. How many ways are there to select a committee to develop a
discrete mathematics course if the committee is to consists of
three members of maths department and four members of CS. If
there are nine members in MD and eleven in CSD?
Combinations with repetitions:
Theorem:
There are C(n+r-1,r) r-combinations from a set with n-elements
when repetitions of elements is allowed

Ayele B Elementary Counting Technique


14

Example:
1. Suppose that a cookie shop has four different kinds of cookies.
How many different ways can six cookies be chosen? Assume that
only the type of cookies and not the individual cookies or the order
in which they are chosen matters
2. How many solutions does the equation x1 + x2 + x3 = 11 have
where x1 , x2 and x3 are non-negative integers?
3. How many ways cay you solve k1 + k2 + k3 + k4 = 18 provided
that k1 , k2 , k3 , k4 are integers and k1 , k2 ≥ 0, k3 ≥ 3k4 ≥ 2?
Type Repetition Allowed Formula
n!
r-permutation No
(n − r )!
n!
r-combination No
r !(n − r )!
r-permutation Yes nr
r-combination Yes C (n + r − 1, r )

Ayele B Elementary Counting Technique


15

Note:
1.Distributing n identical objects in to k distinct sets is
C (n + k − 1, k − 1)
2.The number of ways n-distinct elements can be assigneed to n
celles so that exactly one cell is empty is n!C (n, 2)
Example: A data set contains 500 observation. Analysis of the
data is carried out by three programs that together processes the
500 observations such that each program processes at least 100
observations. If the partition of the 500 observations for use by the
three programs is done by arbitrarily choosing the observation for
each program, In how many ways can the data be procesed?
Example: The number of ways 5 elements a, b, c, d, e can be
assigned to three celles so that exactly 1 cell is empty.

Ayele B Elementary Counting Technique


1.4 Generating Permutation and Combination

Generating Permutation
Any set with n - elements can be placed in 1 − 1
correspondence with the set {1, 2, 3, ..., n}
We can list the permutations of any set of n-elements by
generating the permutations of the n - smallest positive
integers and replace this integers with the corresponding
elements.
For n - elements we have n! permutations.
We use lexicographic (dictionary) ordering of the set of
permutation of {1, 2, 3, ..., n}.
In this ordering the permutation a1 , a2 , a3 , ..., an precedes
b1 , b2 , b3 , ..., bn if for some k 1 ≤ k ≤ n where
a1 = b1 , a2 = b2 , a3 = b3 , ..., ak−1 = bk−1 and ak < bk .
Example: Order the permutations of 3 and 4 elements?

Ayele B Elementary Counting Technique


Procedure: Next permutation (a1 , a2 , a3 , ..., an : Permutations of
{1, 2, 3, ..., n} not equal to {n, n − 1, n − 2, ..., 3, 2, 1} )
j := n − 1
while aj > aj+1
j := j − 1{ j is the largest subscript with aj < aj+1
k := n
while aj > ak
k := k − 1, {ak is the smallest integer greater than aj to the right
of aj
Interchange aj and ak
r := n
s := j + 1
while r > s
Interchange ar and as
r := r − 1
s := s + 1{ This puts the tail end of the permutation after the
j th position in lexicographical order
{a1 , a2 , a3 , ..., an is now the next permutation }
Ayele B Elementary Counting Technique
17
Example:
1. What is the next permutation in lexicographic order after
362541.
2. Find the 79th permutations of 5 elements in the lexicographic
ordering.
Exercise:
1. The name of a file in a computer directory consists of three
upper case latters (A, B or C) followed by a digit (1 or 2). List the
name of this files in lexicographic order, where we order letters
using the usual alphabetic order of letters if repetition of letters is
not allowed.
2. Find the next largest permutation in lexicographic order after
each of this permutation.
a 1342 for {1, 2, 3, 4}
b 45321 for {1, 2, 3, 4, 5}
c 31528764 for {1, 2, 3, ..., 8}
Ayele B Elementary Counting Technique
18

3. Find students (A, B, C, D and F) are scheduled to present


papers in class.
a How many ways this can be arranged.
b How many ways this can be arrenged with out B speaking befor
A.
c How many ways this can be arrenged if A speaks immediately
befor B.

Ayele B Elementary Counting Technique


19
Generating Combination
The combination is just a subset so we can use the
correspondance between subsets of {a1 , a2 , a3 , ..., an } and bit
strings of length n.
The bit string has 1 in k-position if ak ∈ A and 0 if ak ∈
/ A.
If all the bit strings of length n can be listed, then by the
correspondence between subsets and bit strings a list of all the
subsets is obtained.
The 2nd bit strings can be listed in order of their increasing
size as integers in their binary expansions.
Start the list with n - 00 s and end with n - 10 s at each stage
the next binary expansion is found by locating the 1st position
from the right that is not a 1, then changing all the 10 s to the
right of this positions to 00 s and making this first 0(from the
right) a 1.
Ayele B Elementary Counting Technique
20
Example: Find the next bit string after 1000100111?
Procedure:Next bit string
(bn−1 bn−2 bn−3 , ...b1 b0 : bitstringsnotequalto111...11)
i := 0
while bi := 1
bi := 0
i := i + 1
bi := 1
{bn−1 bn−2 bn−3 , ...b1 b0 is the next bit string }
The r-combination can be represented by a sequence
containing the elements in the subset in increasing order.
The r-combination can be listed using lexicographic order on
this sequences.
In this lexicographic order the first r-combination is
{1, 2, 3, ..., r } and the last {n − r + 1, n − r + 2, ..., n − 1, n}

Ayele B Elementary Counting Technique


21

The next r-combination after a1 , a2 , a3 , ..., ar can be obtained in


the following ways.
Locate the last element ai in the sequence such that
ai 6= (n − r ) + i, then replace ai by ai + 1 and .
aj with aj = ai + (j − i) for j = i + 1, i + 2, i + 3, ..., ar
Procedure:Next r-combination
({a1 , ..., ar } : propersubsetof {1, 2, ..., n}notequalto{n − r +
1, ..., n}witha1 < a2 < ... < an
i := r
while ai := n − r + i
i := i − 1
ai := ai + 1
for j := i + 1to r
aj := ai + (j − i)
{a1 a2 a3 , ...ar } is now the next combination

Ayele B Elementary Counting Technique


22

Example:
1. Find the next largest 4-combination of the set {1, 2, 3, ..., 6}
after {1, 2, 5, 6}
2. Find all the 3-combination of the set {1, 2, 3, 4, 5}
3. Find the next largest 5-combination out of a set {1, 2, 3, ..., 7}
in lexicographic order after {1, 5, 2, 6, 7}

Ayele B Elementary Counting Technique


23-1.4 The binomial Theorem
Binomial coefficients
Theorem (pascal’s identity)
let n and k be positive integers with n ≥ k then
C (n + 1, k) = C (n, k − 1) + C (n, k)
the nth in the pascal’s triangle consists of the binomial coefficients
0

0

1 1
 
0 1

2 2 2
  
0 1 2

3 3 3 3
   
0 1 2 3

4 4 4 4 4
    
0 1 2 3 4

5 5 5 5 5 5
     
0 1 2 3 4 5
    Ayele B
  Elementary
 Counting Technique
17

n = 0: 1
n = 1: 1 1
n = 2: 1 2 1
n = 3: 1 3 3 1
n = 4: 1 4 6 4 1
Theorem 8: Let n ≥ r ≥ 0, then
Row sum: C (n, 0) + C (n, 1) + ... + C (n, n) = 2n
Column sum: C (r , r ) + C (r + 1, r ) + ... + C (n, r ) = C (n + 1, r + 1)
Diagonal sum:
C (n, 0) + C (n + 1, 1) + ... + C (n + r , r ) = C (n + r + 1, r )
Example: prove the following identity
1. 1 + 2 + 3 + ... + n = n(n+1)
2
2. 12 + 22 + 32 + ... + n2 = (2n+1)n(n+1)
6

Ayele B Elementary Counting Technique


18
Theorem:
Let n be a positive integer, then nk=0 C (n, k) = 2n
P
Proof:
A set with n elements has a total of 2n subsets
each subsets have either 0,1,2,...,n elements in it
there are C(n,0) subsets with zero element
C(n,1) subsets with zero element
C(n,2) subsets with zero element
...
C(n,n) subsets with zero element
Since the elements are disjoint By sum rule nk=0 C (n, k) = 2n
P
Theorem(Vandermonde’s identity):
Let m, n, r ∈ Z +
Pwith r ≤ n, then
C (m + n, r ) = rk=0 C (n, r − k)C (n, k)
Note:
The binomial theorem gives the coefficients of the expansion of
power of binomial expressions i.e x + y
Ayele B Elementary Counting Technique
19

The binomial theorem:


Let x and y P be variables and let n ∈Z + then 
(x + y ) = nj=0 C (n, k)x n−j y j = n0 x n y 0 + n1 x n−1 y 1 + ... +
n
n
+ nn x 0 y n
 1 n−1 
n−1 x y
Example:
The expansion of
(x + y )4 = 40 x 4 y 0 + 41 x 3 y 1 + 42 x 2 y 2 + 43 x 1 y 3 + 44 x 0 y 4
   

which is equal to = x 4 + 4x 3 y + 6x 2 y 2 + 4x 1 y 1 + y 4
Example:
What is the coefficients of x 12 y 13 in the expression
1 2
a) (x + y )25 b) (2x − 3y )25 c)(− x − y )25 (exercise)
2 3

Ayele B Elementary Counting Technique

You might also like