SlideShare une entreprise Scribd logo
1  sur  71
Course Title : Discrete Mathematics for IT
Course Code : CSIT 206
Module 2
Topic : Relation and function
Prepared by
Prof. (Dr.) Sanjay K Singh
Amity Institute of Information Technology
Amity University Uttar Pradesh, Lucknow Campus
2
Properties of Binary Relations, Closure of relations, Warshall’s algorithm,
Equivalence relations and partitions, Partial ordering relations. Functions,
Composition of functions, Invertible functions, Pigeonhole Principle, Discrete
numeric functions and Generating functions. Recurrence relation, Linear
Recurrence Relations with constant Coefficients.
Module II: Relations and Functions
Partition
10
A partition of a positive integer n is a multiset of positive integers that sum to n. We
denote the number of partitions of n by Pn.
Typically a partition is written as a sum, not explicitly as a multiset. Using the usual
convention that an empty sum is 0, we say that P0=1.
11
Thus P5 is 7
12
13
Generating Functions I
+ +
( ) +
( ) = ?
X1 X2
+ + X3
Problem
Ula is allowed to choose two
items from a tray containing
an apple, an orange, a pear, a
banana, and a plum. In how
many ways can she choose?
5
2
There is a
correspondence between
paths in a choice tree and
the cross terms of the
product of polynomials!
Counting with Generating Functions
x)
x)(1
x)(1
x)(1
x)(1
(1
x)
(1 5







(0 apple + 1 apple)(0 orange + 1 orange)
(0 pear + 1 pear)(0 banana + 1 banana)
(0 plum + 1 plum)
In this notation, apple2 stand for choosing
2 apples., and + stands for an exclusive or.
Take the coefficient of x2.
(1+x)5=1+5x+10x2+10x3+5x4+x5
Problem
Ula is allowed to choose two
items from a tray containing
TWO apples, an orange, a
pear, a banana, and a plum. In
how many ways can she
choose?
The two apples are identical.
Counting with Generating Functions
x)
x)(1
x)(1
x)(1
)(1
x
x
(1 2






(0 apple + 1 apple + + 2 apple)
(0 orange + 1 orange)(0 pear + 1 pear)
(0 banana + 1 banana)(0 plum + 1 plum)
Take the coefficient of x2.
The function f(x) that has a
polynomial expansion
f(x)=a0 + a1 x + …+ an xn
is the generating function
for the sequence
a0, a1, …, an
If the polynomial (1+x+x2)4
is the generating polynomial
for ak, what is the
combinatorial meaning of ak?
The number of ways to select k
object from 4 types with at most
2 of each type.
Problem
Find the number of ways to
select R balls from a pile of
2 red, 2 green and 2 blue
balls
Coefficient by xR in
(1+x+x2)3
3
2
1
3
e
2
e
1
e e
e
e
X
X
X
X



Coefficient by xR in (1+x+x2)3
(1+x+x2)3 =
(x0+x1+x2)(x0+x1+x2)(x0+x1+x2)
Find the number of ways to select R
balls from a pile of 2 red, 2 green
and 2 blue balls
e1 + e2 + e3 = R
0 b ek b 2
3
e
2
e
1
e
X
X
X
Exercise
Find the number of integer
solutions to
x1+x2+x3+x4=21
0bxkb7
Take the coefficient by x21 in
(1+x+x2+x3+x4+x5+x6+x7)4
Exercise
Find the number of integer
solutions to
x1+x2+x3+x4 = 21
0 < xk< 7
x1+x2+x3+x4 = 21
0 < xk< 7
Observe
0 < xk < 7
-1 < xk-1 < 6
0 b xk-1 b 5
Than
(x1-1)+(x2-1)+(x3-1)+(x4-1) = 21-4
x1+x2+x3+x4=21
0<xk<7
The problem is reduced to solving
y1 + y2 + y3 + y4 = 17, 0bykb5
Solution: take the coefficient by x17 in
(1+x+x2+x3+x4+x5)4
which is 20
Problem
x1+x2+x3=9
1bx1b2
2bx2b4
1bx3b4
Solution
x1+x2+x3=9
1bx1b2 (x+x2)
2bx2b4 (x2+x3+x4)
1bx3b4 (x+x2+x3+x4)
Take the coefficient by x9 in the
product of generating functions.
Two observations
1. A generating function approach is
designed to model a selection of all
possible numbers of objects.
2. It can be used not only for counting
but for solving the linear Diophantine
equations
The 251-staff Danish party
Adam pulls a few strings…
and a large apple Danish
factory is built next to the
CMU.
The 251-staff Danish party.
Unfortunately, still only 3
cheese and 4 raspberry
pastries are available.
Raspberry pastries come in
multiples of two. What the
number of possible orders?
Counting with Generating Functions
(1+x+x2+x3) (1+x2+x4) (1+x+x2+x3+ …)
cheese raspberry apple
There is a problem (…) with the above
expression.
Counting with Generating Functions
(1+x+x2+x3) (1+x2+x4) (1+x+x2+x3+ …)=
cheese raspberry apple
(1+x+2x2+2x3+2x4+2x5+x6+x7) (1+x+x2+x3+ …)
=1+2x+4x2+6x3+8x4+…
The power series
a0 + a1 x + a2 x2 +…
is the generating function
for the infinite sequence
a0, a1, a2, …,


0
k
k
k x
a
A famous generating
function from calculus:
0 !
k
x
k
x
e
k


 
We can use the generating
function technique to
solve almost all the
mathematical problems you
have met in your life so far.
Exercise
Count the number of N-letter
combinations of MATH in
which M and A appear with
repetitions and T and H only
once.
Coefficient by xN in
(1+x+x2+…)2(1+x)2
What is the coefficient of Xk
in the expansion of:
( 1 + X + X2 + X3 + X4 + . . . . )n ?
A solution to:
e1 + e2 + . . . + en = k
ek ≥ 0
What is the coefficient of Xk
in the expansion of:
( 1 + X + X2 + X3 + X4 + . . . . )n







 

k
1
k
n










 





0
k
k
n
2
x
k
1
k
n
...)
x
x
(1
GF for the pirates and gold problem
x
1
1
...
x
x
1 2





But what is the LHS?
...
x
x
1
y
x
-
1
1
1
x)
-
y(1
1
y
x
-
y
...
x
x
y
x
...
x
x
1
y
2
2
2
























 


0
k
k
x
k
1
k
n
n
x)
-
(1
1
GF for the pirates and gold problem
1
-
x
x
x
...
x
x
1
n
1
-
n
2 1






x
-
1
x
x
...
x
x
1 n
1
-
n
2 1
... 






(when x ≠ 1)
(when |x| < 1)
We will be dealing with formal
power series (aka
generating functions)


0
k
k
kx
a
The coefficients ak can
be any complex numbers,
though we will be mainly
working over the
integers.


0
k
k
kx
a
Power series have no analytic
interpretation.


0
k
k
kx
a
FORMAL MANIPULATION:
We deal with power series as we
deal we numbers!
FORMAL MANIPULATION:
1/P(X) is defined to be the
polynomial Q(X) such that
Q(X) P(X) = 1.
Th: P(X) will have a reciprocal
if and only if a0  0. In this
case, the reciprocal is unique.
Power series make a
commutative ring!
FORMAL MANIPULATION:
The derivative of
is defined by:
Power Series = Generating Function
Given a sequence of integers a0, a1, …, an
We will associate with it a function




0
k
k
kx
a
f(x)
The On-Line Encyclopedia of Integer Sequences
Generating Functions
Sequence: 1, 1, 1, 1, …
Generating function:
x
1
1
x
x
a
f(x)
0
k
k
0
k
k
k



 





Find a generating function f(x)
1, 2, 3, 4, 5, …
...
4x
3x
2x
1
f(x) 3
2





2
x)
(1
1
f(x)


Generating Functions




0
k
k
kx
F
f(x)
F0=0, F1=1,
Fn=Fn-1+Fn-2 for n≥2
= x




0
k
k
kx
F
f(x)
(x+x2+2 x3+3 x4+5 x5+8 x6+13 x7+…)(1-x-x2)
= x + x2 + 2 x3 + 3 x4 + 5 x5 + 8 x6 + 13 x7+…
- x2 - x3 - 2 x4 - 3 x5 - 5 x6 - 8 x7-…
- x3 - x4 - 2 x5 - 3 x6 - 5 x7-…
2
0
k
k
k
x
x
1
x
x
F
f(x)



 


If a sequence satisfies a
linear recurrence relation,
we can always find its
generating function.
Use generating
functions to show that
Proving Identities with GF


















 n
n
k
n
n
k
2
0
2
Prove by induction
Prove algebraically


















 n
n
k
n
n
k
2
0
2
Prove combinatorially
Prove by Manhattan walk (see previous lecture)
15-355
Computer
Algebra
•
Consider the right hand side:
n
n
x
x
n
n 2
)
1
](
[
2




























 n
n
k
n
n
k
2
0
2
Coefficient by xn
Compute a coefficient of xk
Use the binomial theorem to obtain


















 n
n
k
n
n
k
2
0
2
2
2
)
...
1
0
(
)
1
( n
n
x
n
n
x
n
n
x 




























Find a closed form
??












n
0
k k
n
k
Computing Combinatorial Sums
Don't try
to evaluate the sum that you're
looking at. Instead, find the
generating
function for it, then read off
the coefficients.
Computing Combinatorial Sums
??












n
0
k k
n
k
Multiply it by xn and sum it over n
 

 









0
n
n
0
k
n
k
n
k
x
Interchange the sums
Take r = n - k as the new dummy variable of
inner summation
We recognize the inner sum as xk (1 + x)k

 





 


















 0
k k
n
n
0
n
n
0
k
n
k
n
k
x
k
n
k
x



 






















 0
k 0
r
k
r
0
k k
n
n
r
k
x
k
n
k
x
k
This is a geometric series




0
k
k
k
x)
(1
x
2
0
k
k
k
x
x
1
1
x)
x(1
1
1
x)
(1
x










The RHS is our old friend …
What did we find?
2
0
n
n
0
k
n
x
x
1
1
k
n
k
x












 

 
2
0
k
k
k
x
x
1
x
x
F






2
0
n
n
1
n
x
x
1
1
x
F







What did we find?

 




 









 0
n
n
1
n
0
n
n
0
k
n
x
F
k
n
k
x
1
n
n
0
k
F
k
n
k













Generating Functions
It’s one of the
most important
mathematical
ideas of all time!
Study Bee
• Counting with generating
functions
• Solving the Diophantine
equations
• Proving combinatorial
identities

Contenu connexe

Similaire à Module II Partition and Generating Function (2).ppt

Integral Calculus Anti Derivatives reviewer
Integral Calculus Anti Derivatives reviewerIntegral Calculus Anti Derivatives reviewer
Integral Calculus Anti Derivatives reviewerJoshuaAgcopra
 
2nd-year-Math-full-Book-PB.pdf
2nd-year-Math-full-Book-PB.pdf2nd-year-Math-full-Book-PB.pdf
2nd-year-Math-full-Book-PB.pdfproacademyhub
 
Applied numerical methods lec9
Applied numerical methods lec9Applied numerical methods lec9
Applied numerical methods lec9Yasser Ahmed
 
Module 1 quadratic functions
Module 1   quadratic functionsModule 1   quadratic functions
Module 1 quadratic functionsdionesioable
 
Zero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots PresentationZero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots PresentationDanellaFernandez
 
Module 2 exponential functions
Module 2   exponential functionsModule 2   exponential functions
Module 2 exponential functionsdionesioable
 
03 truncation errors
03 truncation errors03 truncation errors
03 truncation errorsmaheej
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementationQuasar Chunawala
 
Generating functions (albert r. meyer)
Generating functions (albert r. meyer)Generating functions (albert r. meyer)
Generating functions (albert r. meyer)Ilir Destani
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions xmath266
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)CrackDSE
 
Pre-Cal 30S January 16, 2009
Pre-Cal 30S January 16, 2009Pre-Cal 30S January 16, 2009
Pre-Cal 30S January 16, 2009Darren Kuropatwa
 
chap 2 Ex#1.1
chap 2 Ex#1.1chap 2 Ex#1.1
chap 2 Ex#1.1Ans Ali
 

Similaire à Module II Partition and Generating Function (2).ppt (20)

maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
 
maths ppt.pdf
maths ppt.pdfmaths ppt.pdf
maths ppt.pdf
 
Maths 12
Maths 12Maths 12
Maths 12
 
Integral Calculus Anti Derivatives reviewer
Integral Calculus Anti Derivatives reviewerIntegral Calculus Anti Derivatives reviewer
Integral Calculus Anti Derivatives reviewer
 
2nd-year-Math-full-Book-PB.pdf
2nd-year-Math-full-Book-PB.pdf2nd-year-Math-full-Book-PB.pdf
2nd-year-Math-full-Book-PB.pdf
 
2018-G12-Math-E.pdf
2018-G12-Math-E.pdf2018-G12-Math-E.pdf
2018-G12-Math-E.pdf
 
Applied numerical methods lec9
Applied numerical methods lec9Applied numerical methods lec9
Applied numerical methods lec9
 
Module 1 quadratic functions
Module 1   quadratic functionsModule 1   quadratic functions
Module 1 quadratic functions
 
Zero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots PresentationZero Theorem and Rational Roots Presentation
Zero Theorem and Rational Roots Presentation
 
05_AJMS_332_21.pdf
05_AJMS_332_21.pdf05_AJMS_332_21.pdf
05_AJMS_332_21.pdf
 
Unit2.polynomials.algebraicfractions
Unit2.polynomials.algebraicfractionsUnit2.polynomials.algebraicfractions
Unit2.polynomials.algebraicfractions
 
Module 2 exponential functions
Module 2   exponential functionsModule 2   exponential functions
Module 2 exponential functions
 
03 truncation errors
03 truncation errors03 truncation errors
03 truncation errors
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementation
 
Generating functions (albert r. meyer)
Generating functions (albert r. meyer)Generating functions (albert r. meyer)
Generating functions (albert r. meyer)
 
17 integrals of rational functions x
17 integrals of rational functions x17 integrals of rational functions x
17 integrals of rational functions x
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)
 
Pre-Cal 30S January 16, 2009
Pre-Cal 30S January 16, 2009Pre-Cal 30S January 16, 2009
Pre-Cal 30S January 16, 2009
 
chap 2 Ex#1.1
chap 2 Ex#1.1chap 2 Ex#1.1
chap 2 Ex#1.1
 
Derivatives
DerivativesDerivatives
Derivatives
 

Dernier

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 

Dernier (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Module II Partition and Generating Function (2).ppt

  • 1. Course Title : Discrete Mathematics for IT Course Code : CSIT 206 Module 2 Topic : Relation and function Prepared by Prof. (Dr.) Sanjay K Singh Amity Institute of Information Technology Amity University Uttar Pradesh, Lucknow Campus
  • 2. 2 Properties of Binary Relations, Closure of relations, Warshall’s algorithm, Equivalence relations and partitions, Partial ordering relations. Functions, Composition of functions, Invertible functions, Pigeonhole Principle, Discrete numeric functions and Generating functions. Recurrence relation, Linear Recurrence Relations with constant Coefficients. Module II: Relations and Functions
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Partition 10 A partition of a positive integer n is a multiset of positive integers that sum to n. We denote the number of partitions of n by Pn. Typically a partition is written as a sum, not explicitly as a multiset. Using the usual convention that an empty sum is 0, we say that P0=1.
  • 12. 12
  • 13. 13
  • 14. Generating Functions I + + ( ) + ( ) = ? X1 X2 + + X3
  • 15. Problem Ula is allowed to choose two items from a tray containing an apple, an orange, a pear, a banana, and a plum. In how many ways can she choose? 5 2
  • 16. There is a correspondence between paths in a choice tree and the cross terms of the product of polynomials!
  • 17. Counting with Generating Functions x) x)(1 x)(1 x)(1 x)(1 (1 x) (1 5        (0 apple + 1 apple)(0 orange + 1 orange) (0 pear + 1 pear)(0 banana + 1 banana) (0 plum + 1 plum) In this notation, apple2 stand for choosing 2 apples., and + stands for an exclusive or. Take the coefficient of x2. (1+x)5=1+5x+10x2+10x3+5x4+x5
  • 18. Problem Ula is allowed to choose two items from a tray containing TWO apples, an orange, a pear, a banana, and a plum. In how many ways can she choose? The two apples are identical.
  • 19. Counting with Generating Functions x) x)(1 x)(1 x)(1 )(1 x x (1 2       (0 apple + 1 apple + + 2 apple) (0 orange + 1 orange)(0 pear + 1 pear) (0 banana + 1 banana)(0 plum + 1 plum) Take the coefficient of x2.
  • 20. The function f(x) that has a polynomial expansion f(x)=a0 + a1 x + …+ an xn is the generating function for the sequence a0, a1, …, an
  • 21. If the polynomial (1+x+x2)4 is the generating polynomial for ak, what is the combinatorial meaning of ak? The number of ways to select k object from 4 types with at most 2 of each type.
  • 22. Problem Find the number of ways to select R balls from a pile of 2 red, 2 green and 2 blue balls Coefficient by xR in (1+x+x2)3
  • 23. 3 2 1 3 e 2 e 1 e e e e X X X X    Coefficient by xR in (1+x+x2)3 (1+x+x2)3 = (x0+x1+x2)(x0+x1+x2)(x0+x1+x2)
  • 24. Find the number of ways to select R balls from a pile of 2 red, 2 green and 2 blue balls e1 + e2 + e3 = R 0 b ek b 2 3 e 2 e 1 e X X X
  • 25. Exercise Find the number of integer solutions to x1+x2+x3+x4=21 0bxkb7 Take the coefficient by x21 in (1+x+x2+x3+x4+x5+x6+x7)4
  • 26. Exercise Find the number of integer solutions to x1+x2+x3+x4 = 21 0 < xk< 7
  • 27. x1+x2+x3+x4 = 21 0 < xk< 7 Observe 0 < xk < 7 -1 < xk-1 < 6 0 b xk-1 b 5 Than (x1-1)+(x2-1)+(x3-1)+(x4-1) = 21-4
  • 28. x1+x2+x3+x4=21 0<xk<7 The problem is reduced to solving y1 + y2 + y3 + y4 = 17, 0bykb5 Solution: take the coefficient by x17 in (1+x+x2+x3+x4+x5)4 which is 20
  • 30. Solution x1+x2+x3=9 1bx1b2 (x+x2) 2bx2b4 (x2+x3+x4) 1bx3b4 (x+x2+x3+x4) Take the coefficient by x9 in the product of generating functions.
  • 31. Two observations 1. A generating function approach is designed to model a selection of all possible numbers of objects. 2. It can be used not only for counting but for solving the linear Diophantine equations
  • 32. The 251-staff Danish party Adam pulls a few strings… and a large apple Danish factory is built next to the CMU.
  • 33. The 251-staff Danish party. Unfortunately, still only 3 cheese and 4 raspberry pastries are available. Raspberry pastries come in multiples of two. What the number of possible orders?
  • 34. Counting with Generating Functions (1+x+x2+x3) (1+x2+x4) (1+x+x2+x3+ …) cheese raspberry apple There is a problem (…) with the above expression.
  • 35. Counting with Generating Functions (1+x+x2+x3) (1+x2+x4) (1+x+x2+x3+ …)= cheese raspberry apple (1+x+2x2+2x3+2x4+2x5+x6+x7) (1+x+x2+x3+ …) =1+2x+4x2+6x3+8x4+…
  • 36. The power series a0 + a1 x + a2 x2 +… is the generating function for the infinite sequence a0, a1, a2, …,   0 k k k x a
  • 37. A famous generating function from calculus: 0 ! k x k x e k    
  • 38. We can use the generating function technique to solve almost all the mathematical problems you have met in your life so far.
  • 39. Exercise Count the number of N-letter combinations of MATH in which M and A appear with repetitions and T and H only once. Coefficient by xN in (1+x+x2+…)2(1+x)2
  • 40. What is the coefficient of Xk in the expansion of: ( 1 + X + X2 + X3 + X4 + . . . . )n ? A solution to: e1 + e2 + . . . + en = k ek ≥ 0
  • 41. What is the coefficient of Xk in the expansion of: ( 1 + X + X2 + X3 + X4 + . . . . )n           k 1 k n
  • 42.                  0 k k n 2 x k 1 k n ...) x x (1 GF for the pirates and gold problem x 1 1 ... x x 1 2      But what is the LHS?
  • 45. 1 - x x x ... x x 1 n 1 - n 2 1       x - 1 x x ... x x 1 n 1 - n 2 1 ...        (when x ≠ 1) (when |x| < 1)
  • 46. We will be dealing with formal power series (aka generating functions)   0 k k kx a
  • 47. The coefficients ak can be any complex numbers, though we will be mainly working over the integers.   0 k k kx a
  • 48. Power series have no analytic interpretation.   0 k k kx a
  • 49. FORMAL MANIPULATION: We deal with power series as we deal we numbers!
  • 50. FORMAL MANIPULATION: 1/P(X) is defined to be the polynomial Q(X) such that Q(X) P(X) = 1. Th: P(X) will have a reciprocal if and only if a0  0. In this case, the reciprocal is unique.
  • 51. Power series make a commutative ring!
  • 53. Power Series = Generating Function Given a sequence of integers a0, a1, …, an We will associate with it a function     0 k k kx a f(x) The On-Line Encyclopedia of Integer Sequences
  • 54. Generating Functions Sequence: 1, 1, 1, 1, … Generating function: x 1 1 x x a f(x) 0 k k 0 k k k          
  • 55. Find a generating function f(x) 1, 2, 3, 4, 5, … ... 4x 3x 2x 1 f(x) 3 2      2 x) (1 1 f(x)  
  • 57. = x     0 k k kx F f(x) (x+x2+2 x3+3 x4+5 x5+8 x6+13 x7+…)(1-x-x2) = x + x2 + 2 x3 + 3 x4 + 5 x5 + 8 x6 + 13 x7+… - x2 - x3 - 2 x4 - 3 x5 - 5 x6 - 8 x7-… - x3 - x4 - 2 x5 - 3 x6 - 5 x7-… 2 0 k k k x x 1 x x F f(x)       
  • 58. If a sequence satisfies a linear recurrence relation, we can always find its generating function.
  • 59. Use generating functions to show that Proving Identities with GF                    n n k n n k 2 0 2
  • 60. Prove by induction Prove algebraically                    n n k n n k 2 0 2 Prove combinatorially Prove by Manhattan walk (see previous lecture) 15-355 Computer Algebra
  • 61. • Consider the right hand side: n n x x n n 2 ) 1 ]( [ 2                              n n k n n k 2 0 2 Coefficient by xn
  • 62. Compute a coefficient of xk Use the binomial theorem to obtain                    n n k n n k 2 0 2 2 2 ) ... 1 0 ( ) 1 ( n n x n n x n n x                             
  • 63. Find a closed form ??             n 0 k k n k Computing Combinatorial Sums
  • 64. Don't try to evaluate the sum that you're looking at. Instead, find the generating function for it, then read off the coefficients. Computing Combinatorial Sums
  • 65. ??             n 0 k k n k Multiply it by xn and sum it over n               0 n n 0 k n k n k x Interchange the sums
  • 66. Take r = n - k as the new dummy variable of inner summation We recognize the inner sum as xk (1 + x)k                              0 k k n n 0 n n 0 k n k n k x k n k x                             0 k 0 r k r 0 k k n n r k x k n k x k
  • 67. This is a geometric series     0 k k k x) (1 x 2 0 k k k x x 1 1 x) x(1 1 1 x) (1 x           The RHS is our old friend …
  • 68. What did we find? 2 0 n n 0 k n x x 1 1 k n k x                  2 0 k k k x x 1 x x F       2 0 n n 1 n x x 1 1 x F       
  • 69. What did we find?                    0 n n 1 n 0 n n 0 k n x F k n k x 1 n n 0 k F k n k             
  • 70. Generating Functions It’s one of the most important mathematical ideas of all time!
  • 71. Study Bee • Counting with generating functions • Solving the Diophantine equations • Proving combinatorial identities