National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
112
4 Distribution Problems
(ii) Prove combinatorially that
pi (n, k) =
2i1
!
j =1
pi (n j , k 1) + pi (n ik, k);
(iii) Is it true that pi (n, k) = p(n (i 1)k, k)? Explain.
Exercise 4.3.18 Give a combinatorial proof that:
S(n + 1, k) =
n " #
!
n
S(i, k 1)
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
130
5 Generating Functions
The beauty of the Taylor polynomial is that we can evaluate it at a particular value of
x, say x = 1. The effect of this is that it sums up all the coefficients of the powers of
x up to x 50 . Equivalently, this gives the number
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
124
5 Generating Functions
We can also consider the multiplication of two series.
!
!
n
n
Theorem 5.2.4 Let f (x) =
n=0 fn x and g(x) =
n=0 gn x . It follows that
# n
$
"
"
f (x)g(x) =
fk gnk x n .
n=0
k=0
Proof Note that
f (x)g(x) = (f0 + f1 x + + fk x
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
92
3 The Binomial Coefficient
Fig. 3.4 The Enigma
machine
The internal workings of the Enigma consisted of three rotors (see Fig. 3.5), each
of which would perform a different substitution cipher. Each day, the German military
would specify which rotors w
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.3 Single Variable Generating Functions
135
Finally, we determine A B. Using a similar argument as above, this is given
by the coefficient of x 20 in
!
"
$
#2
1
x + x 3 + x 5 + x 7 + x 11 + x 13 + x 17 + x 19 .
3
1x
Using a computer algebra system, we
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
98
4 Distribution Problems
Proposition 4.2.1 The number of ways to distribute n balls to k unlabeled urns in
such a way that no urn receives more than one ball is given by:
(i) 0 if n > k;
(ii) 1 otherwise.
Proof If n > k, then at least one urn will recei
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
4.4 The Twelvefold Way
113
4.4 The Twelvefold Way
The problem of distributing balls into urns seems innocent. However, it actually provides a framework for a more general, abstract problem. This framework is described
as the Twelvefold Way. The Twelvefold
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
100
4 Distribution Problems
Example 4.2.8
(i) Find the number of distributions of n1 unlabeled red balls and n2 unlabeled
white balls into k labeled urns.
(ii) Find the number of distributions of n1 unlabeled red balls and n2 unlabeled
white balls into k
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
120
5 Generating Functions
Substituting in x = 1 and x = 2 yields:
x = 2 2 = A1,1 and
x = 1 2 = A2,2 /2 A2,2 = 4.
To solve for A2,1 , we can substitute a third value in for x (say x = 0). This yields
2 = 2 + A2,1 4. Hence A2,1 = 4.
Alternately, we can com
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
94
3 The Binomial Coefficient
So, by the Addition Principle, the total number of configurations is given by
13
!
k=0
Ak  =
13 "
!
k=0
"
#
#
26!
26!
2
(26!(26! 1)(26! 2)(26 ) 13
2k (26 2k)!k!
2 13!
3 10114 .
One of the key steps in the cryptanalysis of
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
114
4 Distribution Problems
elements of K to be indistinguishable. This being the case, we are only concerned with which elements of N are grouped together. This corresponds to
distributions of n labeled balls into k unlabeled urns.
(iv) Functions in whic
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
104
4 Distribution Problems
Exercise 4.2.18 Find the number of distributions of n1 labeled red balls and n2
unlabeled white balls into k labeled urns if each urn must receive at least one white
ball. What if each urn must receive both a red and a white ba
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
90
3 The Binomial Coefficient
to disguise their messages. So, much of the security of the message is dependent
on a message key. A message key is the specific method used within the system to
disguise the message. So for instance, the specific k used with
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.4 Generating Functions with Two or More Variables
141
Similarly, the generating function corresponding to the number of gumdrops Bob
will receive is
"!
"
! 6
x + x 7 + + x 12 y 7 + y 8 + + y 14
Again, we truncate the generating function to account for t
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.2 Review of Power Series
123
First note that 0x 1 = 0. So, we can just as easily start the summation at n = 1.
Hence,
!
1
=
nx n1 .
2
(1 x)
n=1
Let m = n 1. When we change variables in a definite integral, we must also change
the bounds of the integral
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.4 Generating Functions with Two or More Variables
137
receive a multiple of five gumdrops. How many ways are there to distribute the
gumdrops such that at least one childs restriction is satisfied?
Exercise 5.3.19 A distinct partition of n is a way of w
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.4 Generating Functions with Two or More Variables
139
f (x, y) = 3x 11 y 23 + 3x 11 y 22 + x 10 y 23 + 2x 11 y 21
+3x 10 y 22 + x 9 y 23 + 3x 11 y 20 + 2x 10 y 21 + 2x 8 y 23 + 2x 11 y 19 + x 10 y 20 + 3x 9 y 21 + x 8 y 22
+x 11 y 18 + 2x 10 y 19 + 2x 9
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
116
5 Generating Functions
We now present two theorems regarding the roots of polynomials. The proofs of
these theorems are omitted, but can be found in any algebra text.
Theorem 5.1.2 Let f (x) be a polynomial and let c C. c is a root of f (x) if and
onl
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
126
5 Generating Functions
From this, it is possible to extract the nth derivative of the composition function.
This extraction is left as an exercise to the reader.
We end this section with a list of other common power series. The derivation of
these ser
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
4.3 Partition Numbers and Stirling Numbers of the Second Kind
111
Hence, the Addition Principle yields
k2
n " #
!
!
n
S(i, k1 )
Ai  =
S(n i,j ) .
A =
i
i=1
i=1
j =1
n
!
By reversing the roles of the red and white urns yields the cardinality of B, nam
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.2 Review of Power Series
125
f2 = 2g0 g2 + g12 g2 =
=
f2 g12
2g0
f2
f2
g2
f2
1 = 13/2 .
2g0
2g0
2 f0
4f0
Recall that one of our initial problems was to find the nth derivative of a composition function. By manipulating the power series for the function
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
106
4 Distribution Problems
Similarly, suppose cfw_1 , ., k is a partition of n into k parts. This corresponds
to placing i unlabeled balls into the ith urn. Since the i > 0, no urn will be left
empty.
!
It would be desirable to find a concise formula fo
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
4.2 The Solution of Certain Distribution Problems
97
A variation on the above example would be to consider the case where we are are
offering the children gumdrops before dinner. Again, the gumdrops can be considered
unlabeled balls and the children can b
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.1 Review of Factoring and Partial Fractions
117
Alternately, if we can manipulate the standard factoring in algebra to achieve
the desired form. Namely,
f (x) = 3x 2 9x + 6 = 3(x 2 3x + 2) = 3(x 2)(x 1)
!
"
!
"
1
1
= 3( 2) 1 x (1)(1 x) = 6 1 x (1 x).
2
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.3 Single Variable Generating Functions
131
Subject to:
0 x1 10;
0 x2 5;
4 x3 7;
2 x4 8.
Solution First we derive the generating function. The exponent of x in the ith factor
gives the value of xi in the sum. Thus the exponents of xi must satisfy the abo
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
140
5 Generating Functions
Thus the required generating function is given by:
F (x, y, z) = (1 + xyz2 + x 2 y 2 z4 + ) (1 + xy 2 z3 + x 2 y 4 z6 + )
!
"#
$ !
"#
$
x1
3 5
6 10 2
x2
2
3
4 2 6
(1 + x y z + x y z + ) (1 + x yz + x y z + )
!
"#
$ !
"#
$
x3
=
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
3.7 Application: Cryptosystems and the Enigma
93
Fig. 3.5 The rotor assembly
Example 3.7.4 Suppose that the wiring of the rotors and the reflector are unknown.
Further suppose that it is unknown how many plugboard cables are being used.
Determine the numb
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
118
5 Generating Functions
We now turn our attention to rational functions and their decomposition into partial
fractions. A rational function is a function of the form f (x) = p(x)/q(x), where p(x)
and q(x) are polynomials such that q(x) = 0. If the degr
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
5.3 Single Variable Generating Functions
133
linear equation subject to a set of constraints. We begin by finding the appropriate
generating function.
Since the number of gumdrops that Edward receives is dependant on the number of
gumdrops Alice receives,
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
4.3 Partition Numbers and Stirling Numbers of the Second Kind
107
Table 4.4 The number of partitions of n
n
0
1
2
3
4
5
6
7
8
9
10
11
12
13
p(n)
1
1
2
3
5
7
11
15
22
30
42
56
77
101
+ p(n 15) p(n 22)
where the sum is taken over all p(n k) where k = 21 i(
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
110
4 Distribution Problems
Now, distribute the unlabeled white balls. The number of distributions of the white
balls can be counted in n2 + 1 disjoint, exhaustive sets. The j th set is the set of all
distributions in which j white balls are placed in the
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
4.2 The Solution of Certain Distribution Problems
99
Fig. 4.1 A distribution of 15
unlabeled balls into 6 labeled
urns
In some cases, it is desirable to look at distributions in which each urn receives a
specified number of balls. This will be considered
National University of Computer and Emerging Sciences, Lahore
Introduction To Cloud Computing
COMPUTER S cs2345

Spring 2016
128
5 Generating Functions
Normally, we would simplify this as
1 + x + xn + .
However, in our initial exhibition, we prefer the expanded form. In this expanded
form, the first exponent of one gives the value of penny and the second exponent of
n gives the