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

CountingCH3

Uploaded by

Amanu Teach
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)
27 views

CountingCH3

Uploaded by

Amanu Teach
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/ 31

Chapter-3: Counting

December 31, 2024

Counting

Sum Rule and Product Rule


Permutations
Combinations
Binomial Coefficients
Pigeonhole Principle
Generating functions
3.1 Sum Rule and Product Rule

If two tasks T1 and T2 which are disjoint can be done in


m and n ways respectively, then
1 T1 or T2 can be done in m + n ways (Sum Rule )
2 T1 and T2 can be done in m · n ways. (Product Rule )

Example
In how many ways can you answer a 3 question true/false
quiz?

Solution (2 · 2 · 2 = 8 different ways can be answered.)

Example
How many license plates can be made consisting of two
uppercase letters followed by four digits.
(a) with repetitions allowed.
(b) no letter or digit can be repeated?
(c) same as (a), but only vowels and even digits.

Solutions
(a) With repetition: 262 × 104 = 6, 760, 000 license plates
(b) With no repetition: 26 × 25 × 10 × 9 × 8 × 7 license plates
(c) 52 × 54 license plates.
Example
Suppose variable names in a programming language can be
either a single uppercase letter or an uppercase letter followed
by a digit. Find the number of possible variable names.

Solution (26 + (26)(10) = 286 variable names.)

Example
How many different 7-bit strings are there?

Solution (There are 27 = 128 different 7-bit strings.)

Example
If two dice are thrown once, then find the no of ways in which
we get odd sum.

Solution

1 2 3 4 5 6
1 (1,1) (1,2) (1,3) (1,4 ) (1,5) (1,6 )
2 ( 2,1) (2,2) (2,3) (2,4 ) (2,5) (2,6)
3 (3,1) (3,2) (3,3) (3,4) (3,5) (3,6)
4 (4,1) (4,2) (4,3) (4,4) (4,5) (4,6)
5 (5,1) (5,2) (5,3) (5,4) (5,5) (5.6)
6 (6,1) (6,2 ) (6,3) (6,4) (6,5) (6,6)
Let Si be sum equal to i when i = 3, 5, 7, 9, 11.
S3 = {(1, 2), (2, 1)} ⇒ |A3 | = 2
S5 = {(4, 1), (3, 2), (2, 3), (1, 4)} ⇒ |A3 | = 4
S7 = {(6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)} ⇒ |A7 | = 6
S9 = {(6, 3), (5, 4), (4, 5), (3, 6)} ⇒ |A9 | = 4
S11 = {(6, 5), (5, 6)} ⇒ |A9 | = 2
Since S3 , S5 , S7 , S9 and S11 are pairwise disjoint, the
number of ways in which we get odd sum is
|S3 ∪ S5 ∪ S7 ∪ S9 ∪ S11 | = |S3 | + |S5 | + |S7 | + |S9 | + |S11 |
= 18

Note
If a natural number ‘n’ has prime factorization,

n = p1k1 p2k2 . . . prkr

where pi ’s are the distinct prime factors and the ki ’s are


positive integers, then the no of positive divisors of n is given
by
r
Y
(ki + 1)
i=1

Example
Find the number of positive divisors of 600 .
Solution
600 = 31 × 23 × 52
Let k1 = 1, k2 = 3, and k3 = 2. Then

 k1 + 1 = 1 + 1 = 2

k2 + 1 = 3 + 1 = 4


k3 + 1 = 2 + 1 = 3
Thus the no of positive divisors of 600 is 2 × 4 × 3 = 24

Permutations

Permutation: n Pr or P(n, r )
Permutation is the number of arrangement of items.
The number of permutation of size r from n items
n!
1 without repetitions is P(n, r ) = (n−r )! .
2 without repetition is P(n, r ) = nr
Order is considered.

Example
How many vectors can be drown using 5 points if any 3 of
them are none colinear?
5! 5!
Solution: P(5, 2) = (5−2)!
= 3!
= 20 vectors.
Example
(a) How many arrangements can be made in the letters of
"COMPUTER"?
8!
Solution: P(8, 8) = (8−8)!
= 8!

(b) How many different stings of length 5 can be made from


the letters in the word "COMPUTER"?
8! 8!
Solution: p(8, 5) = (8−5)!
= 3!
strings of length 5.

Example
How many pairs of dance partners can be selected from a
group of 12 women and 20 men?

20! 20
Solution: P(20, 12) = (20−12)!
= 8!

Example
If |A| = 2 and |B| = 4, then how many
(a) one-to-one functions are there from A to B?
(b) one-to-one functions are there from B to A?
(c) functions are there from A to B?
Solution:
4!
(a) P(4, 2) = (4−2)!
= 12 one to one functions from A to B.
(b) P(2, 4) = 0 : No one to one functions from B to A.
(c) 42 = 16 functions from A to B.

Permutation with Indistinguishable Items:


The number of permutation

of n items of which
n1 are type 1 
n2 are type 2


is n1 !n2n!!···nk !
··· ··· 


nk are type k

EXAMPLE:
(a) What is the number of permutations of the letters in the
word BANANA?
6!
solution: P(6; 1, 3, 2) = 3!2!
= 60 different arrangements.

(b) How many strings of length 5 or more can be made from


the letters in BANANA?
Solution: If we omit one B, A and N respectively, we have
5! 5! 5!
3!2! = 10, 2!2! = 30, 3! = 20
⇒ 60 strings of length 5
The number of strings of length 5 or 6 is 120.
Circular permutations
The first item considered as a pace holder
The number of circular permutation of n items is (n − 1)!

EXAMPLE
(a) In how many ways 7 people arranged on a circular table?
Solution: (n − 1)! = (7 − 1)! = 6! = 720.

(b) If two of the people insist on sitting next to each other,


how many arrangements are possible?
Solution: 2!5! = 240.

Restricted permutation:
Permutation of n items in r places when p particular
items will
(n−p)!
1 always occur is P(n − p, r − p) = (n−r )!
(n−p)!
2 never occur is P(n − p, r ) = (n−p−r )!

Example
In how many ways can we choose 11 out of 18 players?
(i) If 2 players are chosen (ii) If 2 players are not chosen

Solution:
(i) P(18-2,11-2)=p(16,9) (ii) P(18-2,11)=p(16,11)
Example
How many permutations of the letters "a, b, c, d, e, f, g, h"
contain "abc" as a block?

Solution
Rename "abc" to B, and the question becomes:
permutations of "Bdefgh." Therefore there are
P(6, 6) = 6! = 720 different arrangements

Example
How many integers can we form with 3,3,4,5,5,6,7 if we want
to exceed 5,000,000?

Solution: The first digit must be either 5,or 6, or, 7


Case-1: Suppose the first digit is 5:
the remaining digits are 3,3,4,5,6,7 and the number of
6!
arrangements is P(6; 2, 1, 1, 1, 1) = 2! = 360
Case-2: Suppose the first digit is 6:
the remaining digits are 3,3,4,5,5,7 and the number of
6!
arrangements is P(6; 2, 1, 2, 1) = 2!2! = 180
Case-3: Suppose the first digit is 7:
the remaining digits are 3,3,4,5,5,6 and the number of
6!
arrangements is P(6; 2, 1, 2, 1) = 2!2! = 180
∴ the number of integers greater than 5,000,000 is 720.
EXERCISE:

1 A door lock on a classroom requires entry of 4 digits. All


digits must be numbers cannot repeated. How many
unique codes are possible?
2 Find the value(s) in each of the following.
(a) P(n, 3) = 3P(n, 2) (b) 2P(n, 2) + 50 = P(2n, 2)
3 (a) How many permutations are there for the eight letters:
a. c, f, g, i, t, w, x?
(b) Consider in part(a). How many start with letter t? How
many start with letter t and end with c?
4 How many ways are there to lineup 3 apples, 4 bananas
and 5 oranges.

6. (a) How many arrangements are there of all the letters in


SOCIOLOGICAL?
(b) In how many of the arrangement in part(a) are A and G
adjacent?
(c) In how many of the arrangement in part(a) are all the
vowels are adjacent?
7. How many integers can be formed using all the digits
1,3,3,3,4,5,9?
8. How many ways can 3 girls and 5 boys be seated around
a circular table if all girls must sit together?
Combinations

The number of combinations of n distinct items taking r


of them is :  
C (n, r ) = nr =n Cr = r !(n−r
n!
)!
Order
 
is not considered.
n
r
means "n choose r".
   
n n
0
= n
= 1, [n ≥ 0]
   
n n
1
= n−1
= n, [n ≥ 1.]
   
n n
r
= n−r
, [0 ≤ r ≤ n.]
C (n, r ) = 0, [0 ≤ n < r .]

Example
How many lines can be draw using 5 points if any 3 of them
are none colinear?
5
Solution: C (5, 2) = 2!(5−2)!
= 10 lines

Example
In how many ways can I choose 2 students to be class
representatives from a class of 40 students?

40 40!
Solution: C2 = 2!(40−1)!
= 20 × 39 = 780
Restricted Combinations:

Restricted combinations is a type of combination


where certain rules or limitations are applied to how the
items are selected from a group.
The ♯ of ways of choosing r item from n different items,
when p of the particular items are
n−p  (n−p)!
(i) selected is r −p =(r −p)!(n−r )! .
n−p  (n−p)!
(ii) rejected is r = r !(n−p−r )! .
(n−p−k)!
are selected is n−p−k

(iii) rejected and k r −k = (r −k)!(n−p−r )! .

Consider that we need to select r players out of n players


to form a team. There are 2 excellent players who are
always particularly selected. So we need to select only
(r-2) players from (n-2) players.

EXAMPLE:
A student is to answer 7 out of 10 questions on an exam.
In how many ways can the student make his selection
(a) if there is no restriction?
(a) if he must answer the first two questions?
(c) if he must answer at least four of the first six questions?
Solution
 
10 10!
(a) C (10, 7) = 7
= 7!3!
= 120 ways.
   
10−2 8
(b) 7−2
= 5
= (1)(56) = 56 ways.
(c) There are 3 cases to consider. He may decide to answer
(i) 4 of the first 6 questions and 3 of the last 4 questions
(ii) 5 of the first 6 questions and 2 of the last 4 questions
(iii) 6 of the first 6 questions and 1 of the last 4 questions
        
6 4
4
+ 65 42 + 66 41 = 100
3
So he can make his selection in 100 different ways.

Example
A committee of 12 is to be selected from 10 men and 10
women. In how many ways can the selection be carried out if
(a) there are no restrictions?
(b) there must be 6 men and 6 women?
(c) there must be an even number of women?
(d) there must be more women than men?
(e) there must be at least 8 men?

Solution: n=10+10=20, r=12


 
20 20!
(a) 12
= 12!8!
= 125, 970 ways.
! !
10 10 10! 10!
(b) × = 6!4!
× 6!4!
= 44, 100 ways.
6 6
| {z } | {z }
Women Men
(c) In each selection, women must be either 2, 4, 6, 8 or 10.
  
P5 10 10
∴ there are i=1 2i 12−2i
ways.
(d) In each selection women must be either 7, 8, 9 or 10.
P10 10 10 
i=7 i 12−i
.
(e) In each selection men must be either 8, 9 or 10.
P12 10 10 
So, i=8 i 12−i
.

Combinations with Repetitions


If we choose a set of r items from n of items, where repetition
is allowed and the number items we are choosing from is
essentially unlimited, the number of selections is:
! !
n+r −1 (n + r − 1) n+r −1
= =
r r !(n − 1)! n−1

For example, if there are 4 types of donuts (n = 4) on a menu


to choose from and if we want 3 donuts (r = 3), then the
number of ways
 to choose
  the donuts with repetition can be
calculated as 4+3−1
3
= 63 = 3!3!6!
= 20
EXAMPLE:
There are 3 flavors of ice cream to choose from; vanilla,
chocolate and strawberry. There are 5 children whom each get
to choose their own flavor.
 How
 many
  different ice cream
3+5−1
orders are possible? 5
= 75 = 5!2!
7!
= 21 orders.

EXAMPLE:
There are 3 flavors of ice cream to choose from; vanilla,
chocolate and strawberry. There are 5 children whom each get
to choose their own flavor, but every flavor must be used at
least once. How many different ice cream orders are possible?

Solution
Here, we can assign
child 1 vanilla
child 2 chocolate
child 3 strawberry
The other two children have a choice.
So now we have 3 flavors with only two children left.
! !
3+2−1 4
= =6
2 2
We use combination with repetitions for :
balls in bins
books on shelves
integer solutions
EXAMPLE
Determine the number of integer solutions to
x1 + x2 + x3 = 14, xi ≥ 0 ∀i.

Solution
Here we have 4 bins and 14 balls.
n

= 3, r =14
3+14−1
14
= 16
14
16!
= 2!14! = 8(15) = 120 integer solutions.

EXAMPLE
Determine the number of integer solutions to
x1 + x2 + x3 = 14, xi ≥ 2 ∀i.

Solution
Let xi = yi + 2 for each i = 1, 2, 3.
So we have: y1 + 2 + y2 + 2 + y3 + 2 = 14, yi + 2 ≥ 2.
y1 + y2 + y3 = 8, yi ≥ 0.
So

here

we have 4 bins and 8 balls.
3+8−1 10!
8
= 2!8! = 45
Therefore the equation has 45 integer solutions.
Binomial Coefficients

Binomial Theorem:
n n
!
n n−j j
(x + y )n = C (n, j)x n−j y j =
X X
x y
j=0 j=0 j
n
!
n
x n−j y j
X
=
j=0 n−j
 
n
The coefficient C (n, j) = j
is called the binomial
coefficient of x n−j y j .

EXAMPLE
What is the coefficient of x 6 y 7 in (2x − 3y )13 ?

Solution: First replace a = 2x and b = −y .

   
13 13
The coefficient of a6 b 7 in (a + b)13 is 6
or 7
     
13 6 7 13 6 6 7 7 13 6 7
7
a b = 7
2 x (−1) y =−64 7
x y .
So the coefficient of x 6 y 7 is : −64C (13, 7).
Some consequences:
1
n
!
n
2n =
X

j=0 j
2
n
!
n
(−1)j
X
=0
j=0 j
     
n n−1 n−1
Pascal’s Identity: j
= j−1
+ j
if 1 ≤ j ≤ n − 1.

Multinomial Coefficients:
The coefficient of x1n1 x2n2 x3n3 . . . xtnt in the expansion of
(x1 + x2 + x3 + . . . + xt )n is

n!
n1 !n2 !n3 ! . . . nt !
where each ni is an integer with 0 ≤ ni ≤ n, for all
1 ≤ i ≤ t andn = n1 + n2 + . . . + nt .
n
n1 !n2 !n3 !...nt !
= n1 ,n2n,...,nt is called multinomial
coefficient.
When t=2, this reduces to binomial coefficient.
EXAMPLE:
Determine the coefficients of
4
(a) xyz 2 in (2x − y − z)4 (b) xyz −2 in (x − 2y + 3z −1 )

Solution
(a) Coefficient of xyz 2 :
Variables: x1 = x , x2 = y , x3 = z
n1 = 1, n2 = 1, and n3 = 2 ⇒ n = 1 + 1 + 2 = 4
c1 = 2, c2 = −1, and c3 = −1
[c1n1 c2n2 c3n3 ] n1 !nn!2 !n3 ! = 21 (−1)1 (−1)2 1!1!2!
4!
= −24.
Therefore, the coefficient of xyz 2 in the expansion of
(2x − y − z) is -24.4

(b) Coefficient of xyz −2 :


Variables: x1 = x , x2 = y , x3 = z −1
n1 = 1, n2 = 1, and n3 = 2 ⇒ n = 1 + 1 + 2 = 4
c1 = 1, c2 = −2, and c3 = 3
[c1n1 c2n2 c3n3 ] n1 !nn!2 !n3 ! = 11 (−2)1 (3)2 1!1!2!
4!
= (−18)(12)
= −216.
−2
Therefore, the coefficient of xyz in the expansion of
(x − 2y + 3z)4 is -216.
3.3 Pigeonhole Principle

Which one of the following guarantee you that at least 1


box contain 2 pigeons?
(a) if there are 4 pigeons and 5 boxes?
(b) if there are 5 pigeons and 5 boxes?
(c) if there 5 pigeons and 4 boxes?

The pigeonhole Principle:


If (k + 1) or more objects are placed into k boxes, then there
is at least one box containing two or more of the objects.

EXAMPLE-1
What is the minimum number of people to ensure that 2
people share the same birthday?
k + 1 = 366 + 1 = 367 minimum number of people

EXAMPLE-2:
What is the minimum number of words to ensure that 2
English words start with the same letter?

Solution
k = 26
k + 1 = 26 + 1 = 27 words

Generalized Pigeonhole Principle:


If N objects are placed into k boxes,
& 'then there are at
N
least one box containing at least of the objects.
k
EXAMPLE-3:
Among 73 people, what is the number of people that must be
born on the same month?

Solution
73
 
k = 12 and N = 73. So = ⌈6.08333⌉ = 7
12
At least 7 people born on the same month.

EXAMPLE-4:
What is the minimum number of students in a class if at least
9 students will get the same letter grade ( A, B, C, D, or F)?

Solution
The boxes are the grades. Thus k = 5.
& '
N
Hence we have = 9 ⇒ N−15
= 9 − 1 ⇒ N = 41
5
The minimum number of students in the class is 41.

EXAMPLE-5:
A bowl contains 10 red and 10 black balls.
(a) How many balls must be selected to ensure 3 balls of the
same color?
(b) How many balls must be selected to ensure 3 black balls?
Solution
l m
N N−1
(a) k = 2 and 2
=3⇒ 2
= 2 ⇒ N = 5 balls .
(b) 13 balls.

EXAMPLE-6:
There are 40 different time periods during which classes at a
university can be scheduled. If there are 615 different classes,
how many different rooms will be needed?

Solution
l m l m
k = 40, N = 615, Nk = 615 40
= ⌈15.375⌉ = 16
At least 16 rooms will be needed.

Example
Assume you have a drawer containing a random distribution of
a dozen brown socks and a dozen black socks. It is dark, so
how many socks do you have to pick to be sure that among
them there is a matching pair?
3.4 Generating functions

Generating function is a way to present or encode a


sequence of numbers.
Definition: Generating function
The generating function for the sequence a0 , a1 , a2 , a3 · · · is
the power series

G(x ) = a0 + a1 x + a2 x 2 + · · · = an x n
X

n=0

We will indicate the correspondence between a sequence


and its generating function with a double side arrow
[a0 , a1 , a2 , a3 · · · ] ←→ G(x ) = a0 + a1 x + a2 x 2 + a3 x 3 + · · ·

EXAMPLE:
(a) [3, 0, 0, 0, 0, · · · ] ←→ 3.
(b) [1, 2, 3, 0, 0, · · · ] ←→ 1 + 2x + 3x 2 .
(c) For any n ∈ N,
 n n n n 
(i) 0 , 1 , 2 , · · · , n , 0, · · · ←→
(1 + x ) = 0 + 1 x + n2 x 2 + · · · + nn x n .
n n n  
n+1
(ii) [1, 1, · · · 1, 0, · · · ] ←→ 1−x 2 n
1−x = 1 + x + x + · · · + x .
(d) [1, 1, 1, 1, 1, · · · ] ←→ 1 + x + x 2 + x 3 + x 4 + · · ·.
What is the Generating function of the sequence: [1, 1, 1, · · · ]?

Let G1 (x ) = 1 + x + x 2 + x 3 + · · · be its generating


function. Then
G1 (x ) = 1 + x + x 2 + x 3 + · · ·
− xG1 (x ) = 0 + x + x 2 + x 3 + · · ·
G1 (x ) − xG1 (x ) = 1
1
G1 (x ) =
1−x
1
So, [1, 1, 1, 1, · · · ] ←→ G1 (x ) = 1−x = 1 + x + x2 + · · ·

What is the Generating function of the sequence: [c, c, c, · · · ]?


Its generating function Gc (x ) is:
Gc (x ) = c + cx + cx 2 + cx 3 + · · ·
− xGc (x ) = 0 + cx + cx 2 + cx 3 + · · ·
c
Gc (x ) − xGn (x )c ⇒ Gc (x ) =
1−x
c
So, Gc (x ) = 1−x is the generating function of the
sequence c, c, c, c, · · ·
4
For example, G4 (x ) = 1−x = 4 + 4x + 4x 2 + 4x 3 + · · · is
the generating function of the sequence 4, 4, 4, 4, · · ·
Generating Function of the Sequence of Natural Numbers:
The sequence of natural numbers is [1, 2, 3, 4, · · ·]
Let GN (x ) = 1 + 2x + 3x 2 + 4x 3 + · · · be the generating
function of the sequence: 1, 2, 3, 4, · · ·.
Then differentiate:
1
1−x
= 1 + x + x2 + x3 + x4 + · · ·
d d  
(1 − x )−1 = 1 + x + x2 + x3 + x4 + · · ·
dx dx
(1 − x )−2 = 1 + 2x + 3x 2 + 4x 3 + · · ·
1
Therefore GN (x ) = (1−x )2
= 1 + 2x + 3x 2 + · · · is the
generating function of the sequence of natural numbers.

Generating Function of Sequence of Even Natural Numbers:


The sequence of even natural numbers is [2, 4, 6, 8, · · · ]
Let G2N (x ) be the generating function of: 2, 4, 6, 8, · · ·.
Then G2N (x ) = 2 + 4x + 6x 2 + 8x 3 + · · ·
 
= 2 1 + 2x + 3x 2 + 4x 3 + · · ·
" #
1 2
= 2GN (x ) = 2 =
(1 − x )2 (1 − x )2
Hence, the generating function of the sequence of even
natural numbers is
2
G2N (x ) = = 2 + 4x + 6x 2 + · · · .
(1 − x )2
Generating function of the sequence of odd natural numbers:
The sequence of odd natural numbers is [1, 3, 5, 7, · · · ]
Let GO (x ) = 1 + 3x + 5x 2 + · · · be its generating function.
But we have:
2
[2, 4, 6, 8, · · · ] ←→ = 2 + 4x + 6x 2 + 8x 3 + · · ·
(1 − x )2
1
−[1, 1, 1, 1, · · · ] ←→ = 1 + x + x2 + x3 + · · ·
1−x
1+x
[1, 3, 5, 7, · · · ] ←→ = 1 + 3x + 5x 2 + · · ·
(1 − x )2
1+x
∴, GO (x ) = (1−x )2
is the generating function of 1, 3, 5, · · ·

Recall:
1
1
1−y
= 1 + y + y 2 + y 3 + y 4 + · · · ←→ [1, 1, 1, 1, · · · ]
1
2
(1−y )2
= 1 + 2y + 3y 2 + 4y 3 + · · · ←→ [1, 2, 3, 4, · · · ]
2
3
(1−y )2
= 2 + 4y + 6y 2 + 8y 3 + · · · ←→ [2, 4, 6, 8, · · · ]
1+y
4
(1−y )2
= 1 + 3y + 5y 2 + 7y 3 + · · · ←→ [1, 3, 5, 7, · · · ]

1) For each a ∈ R, substitute ax for y in


1
1−y
= 1 + y + y2 + y3 + y4 + · · · ,
1
1−ax
= 1 + (ax ) + (ax )2 + (ax )3 + · · ·
1
So 1−ax
is the generating function for 1, a, a2 , · · ·
(i) The generating function for the sequence 1, 1, 0, 1, 1, · · ·
1 2 3
is g(x ) = 1−x − x 2 = 1−x1−x+x
(ii) The generating function for the sequence 1, 3, 1, 1, 1, · · ·
1 −2x 2
is g(x ) = 1−x + 2x = 1+2x 1−x
1
2) Substitute x 2 for y in 1−y = 1 + y + y 2 + y 3 + · · ·,
1 2 4 6
1−x 2 = 1 + x + x + x + ···
1
∴ 1−x 2 is the generating function for [1, 0, 1, 0, 1, 0, · · · ]

3) For each a ∈ R, substitute ax for y in


1
(1−y )2
= 1 + 2y + 3y 2 + 4y 3 + 5y 4 + · · · ,
1
(1−ax )2
= 1 + 2ax + 3(ax )2 + 4(ax )3 + · · ·
1
So (1−ax )2 is the generating function for 1, 2a, 3a2 , 4a3 , · · ·

1
4) Substitute x 2 for y in (1−y )2
= 1 + 2y + 3y 2 + 4y 3 + · · ·
1
(1−x 2 )2
= 1 + 2x 2 + 3x + 4x 6 + · · ·
2

∴ (1−x1 2 )2 is the generating function for 1, 0, 2, 0, 3, 0, 4, · · ·


2
(5) Substitute x 2 for y in (1−y )2
= 2 + 4y + 6y 2 + 8y 3 + · · ·
2
(1−x 2 )2
= 2 + 4x + 6x + 8x 6 + · · ·
2 4

∴ (1−x2 2 )2 is the generating function for 2, 0, 4, 0, 6, 0, 8, · · ·


2
(6) Substitute ax for y in (1−y )2
= 2 + 4y + 6y 2 + 8y 3 + · · ·
2
(1−ax )2
= 2 + 4(ax ) + 6(ax )4 + 8(ax )6 + · · ·
2

2
∴ (1−ax )2
is the generating function for 2, 4a, 6a2 , 8a3 , · · ·
Shifting or Multiply by x k , k = 1, 2, · · · , n

1
1) Multiply by 1−x
= 1 + x + x 2 + x 3 + · · · by x :
x 2 + x3 + x4 + · · ·
1−x = x + x
x
∴ 1−x is the generating function for 0, 1, 1, 1, · · ·
1
2) Multiply by (1−x )2
= 1 + 2x + 3x 2 + 4x 3 + · · · by x :
x
(1−x )2
= x + 2x 2 + 3x 3 + 4x 4 + · · ·
x
∴ (1−x )2
is the generating function for 0, 2, 3, 4, · · ·
d x d  
= x + 2x 2 + 3x 3 + 4x 4 + · · ·
dx (1 − x )2 dx
3)
1+x
= 1 + 22 x + 32 x 2 + 42 x 3 + · · ·
(1 − x )3
1+x
∴ (1−x )3
is the generating function for 11 , 22 , 32 , 42 , · · ·

x (1+x )
4) (1−x )3
generates the sequence 0, 22 , 32 , 42 , · · ·
x (1+x )



 (1−x )3
= x + 22 x 2 + 32 x 3 + 42 x 4 + · · ·
x
5) + (1−x )2
= x + 2x 2 + 3x 3 + 4x 4 + · · ·

2x
= 2x + 6x 2 + 12x 3 + 20x 4 + · · ·


(1−x ) 3

2x
∴ (1−x )3 generates the sequence 2, 6, 12, 20, · · ·
Multiplication:

Let A(x ) ←→ [a0 , a1 , a2 , a3 , · · · ] and


B(x ) ←→ [b0 , b1 , b2 , b3 , · · · ].
Then C (x ) = A(x )B(x ) =←→ [c0 , c1 , c2 , c3 , · · · ]
where, cn = a0 bn + a1 bn−1 + a2 bn−2 + · · · + an b0
Times(×) b0 x 0 b1 x 1 b2 x 2 a3 x 3 . . .
a0 x 0 a0 b0 x 0 a0 b1 x 1 a0 b2 x 2 a0 b3 x 3 · · ·
a1 x 1 a1 b0 x 1 a1 b1 x 2 a1 b2 x 3 ···
a2 x 2 a2 b0 x 2 a2 b1 x 3 ···
a3 x 3 a3 b 0 x 3 ···
.. ..
. .

EXAMPLE
(a) A boy is allowed to choose two items from a basket
containing two apples, an orange, a pear, a banana, and a
plum. How many ways can this be done?
(b) A boy is allowed to choose two items from a basket
containing two apples, an orange, a pear, and a banana.
How many ways can this be done if we consider the two
apples to be identical?
Solution
(a) The boy choose
 2 from a set of 5 items, the number of
ways is 52 = 2!(5−2)!
5!
= 10
The boy may choose 0 or 1 apple, orange, pear, banana
and plum, for a total of 2 items. The number of doing
this exactly the coefficient x 2 in
(1 + x ) (1 + x ) (1 + x ) (1 + x ) (1 + x )
| {z } | {z } | {z } | {z } | {z }
apple orange pear banana plum

(1 + x )5 = x 0 + 5x 1 + 10x 2 + 10x 3 + 5x 4 + x 5
The boy can choose no item in 1 way, 1 item in 5 ways, 2
items in 10 ways, 3 items in 10 ways, 4 items in 5 and 5
items in 1 way.

The coefficient of x r gives the number of ways of choosing r items.

A boy is allowed to choose two items from a basket containing two


apples, an orange, a pear, and a banana. How many ways can this
be done if we consider the two apples to be identical?

The boy may choose 0, 1, or 2 apples and 0 or 1 orange,


pear, and banana, for a total of two items. The number
of doing this is exactly the coefficient x 2 in
(1 + x + x 2 ) (1 + x ) (1 + x ) (1 + x )
| {z } | {z } | {z } | {z }
apple orange pear banana

= 1 + 4x + 7x 2 + 7x 3 + 4x 4 + x 5
The boy can choose 2 items in the basket in 7 ways.
Exercise
1 A software team has 10 senior members and 10 junior
members. Must select a set of 4 people to work on a
project. How many selections have at least one junior
member?
2 How many integer solutions are there to the equation
x1 + x2 + x3 + x4 = 12, xi ≥ 0, x2 ≤ 3, and x4 ≥ 2

1 Find the generating function for the following sequences.


8 8 8 8
(a) 0 , 1 , 2 ,..., 8 (e) 1, 2, 3, 3, 3, . . .
8 8 8 8
b) 1 ,2 2 ,3 3 ,...,8 8
(f) 7, 8, 9, 10, . . .

(c) 2, 1 + a, (1 + a)2 , (1 + a)3 , . . . (g) 1, 4, 7, 10, 13, . . .

(d) 0, 0, 0, 6, −6, 6, . . . (h) 0, 1, 3, 6, 10, . . .


2 Determine the sequence generated by each of the
following generating functions
x3 1
(a) (2x − 3)3 (c) 1−x 2
(e) 1+3x

1 x4
(b) 1−x + 3x 7 − 11 (d) 1
3−x (f) 1−x

You might also like