Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Counting - Discrete Mathematics and its Applications - Lecture Slides, Slides of Discrete Mathematics

During the study of discrete mathematics, I found this course very informative and applicable.The main points in these lecture slides are:Counting, Product Rule, Sum Rule, One-To-One Functions, Bit-Strings of Length, Number of Subsets, Cardinality of Power-Set, Cartesian Product of Sets, Union Set of Disjoint, Mixed Examples

Typology: Slides

2012/2013

Uploaded on 04/27/2013

atmaja
atmaja 🇮🇳

4.2

(45)

182 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 4
4.1,4.2 Counting
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Counting - Discrete Mathematics and its Applications - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

Lecture 4

4.1,4.2 Counting

Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND procedure 2. There are n1 ways to perform procedure 1 and n2 ways to perform procedure 2. Then there are n1xn2 ways to perform procedure 1 AND procedure 2. Sum Rule: Assume we need to perform procedure 1 OR procedure 2. There are n1 ways to perform procedure 1 and n2 ways to perform procedure 2. Then there are n1+n2 ways to perform procedure 1 OR procedure 2.

  1. What is the total number of subsets of a set A with n elements? I.e. what is the cardinality of the power-set P(A)? Recall that we can map A to a bit-string: 111111111111 (n times). Each subset is associated with a bunch of zeros. (00000...0 = empty set). Total # subsets therefore 2^n.
  2. What is the number of elements in the Cartesian product of the sets A1,...,An? I.e. what is the cardinality of A1XA2X...XAn? a1 in (a1,a2,...,an) has |A1| possibilities, for every a1 there are |A2| possibilities for a2 etc. Total: |A1|x|A2|x...x|An|.

Examples sum rule:

  1. There is one position available for a PhD position at Irvine. The student must come from either Berkeley which has 20 candidates or UCLA which has 50 candidates. What is the total number of possible candidates for the position.  The candidate must be from Berkeley OR UCLA so we have 20+50= possible candidates.
  2. There are 3 topics and each topic contains 20 projects. How many projects to choose from: 20+20+20=60.
  3. What is the number of elements in the union set of the disjoint A1, A2, ...,An? I.e. what is the cardinality  Elements in the union can be in A1 OR A2 OR A3 ...: |A1|+|A2|+...+|An|.

| A 1  A 2  ...  An |

Inclusion – Exclusion Principle: Assume that m out of n1 ways to do procedure 1 are equivalent to m out of n ways to do procedure 2. Then the number of ways to perform procedure 1 OR procedure 2 are n1+n2-m. Example: There are 3 topics and 20 projects per topic, but 1 project is listed in all three topics. What is the total number of projects?  20+20+20 – 2 because one project was over-counted twice. Recall: The cardinality of the union set of overlapping sets A, B: Recall Sum Rule: Assume we need to perform procedure 1 OR procedure 2. There are n1 ways to perform procedure 1 and n2 ways to perform procedure 2. Then there are n1+n2 ways to perform procedure 1 OR procedure 2.

| A  B | |= A | + | B | −| A  B |

Example: How many bit-strings of length 8 begin with either a 1 or end with 00?  Total number of bit-strings starting with 1 is 2^7. Total number of bit-strings ending with 00 is 2^ However, out of those 2^6 there are 2^5 bit-strings which stared with a one and were counted in the 2^7 of the first line. Conclusion: 2^7+2^6-2^5. Tree Diagrams: For small problems you can enumerate all possibilities in a “decision tree”. Example: What is the total number of bit-strings of length 4 that do not have 2 consecutive 1’s? (white-board) Note: this approach becomes infeasible very quickly with growing number of possibilities.

1 1 1 n n k k n k k  (^)     (^)    − < + − =  (^)         ^ ^   ^   Proof: Note that the following is true:^1 n n k k   < +     ceiling function (e.g. 3 < 2.1 + 1 = 3.1) Therefore: This is the maximal number of balls if none of the boxes contains more than. However, this number is smaller than n, which is a contradiction.  1 n k   −    

Examples:

  1. In a group of 370 people there are at least 2 people who have their birthday on the same day. CEILING(370/365)=2.
  2. For every positive integer n there is a multiple of n that consists of only o’s and 1’s.  Consider the case n=3. Construct n+1 = 4 integers as follows: 1, 11, 111, 1111. Divide them by n to get: 0+1/3, 3+2/3, 37, 370+1/ If we divide any integer by n, the possible remainders are: 0, 1/n, 2/n, ...n-1/n. So in a list of n+1 remainders there must be two remainders the same: In this case: 1/3 = 0+1/3 and 1111=370+1/3 have the same remainder. If we subtract these two integers we get a new integer that is divisible by n: 1111-1 = 1110 = 3 x 370. Note that the difference must consist of all 0’s and 1’s!

More examples: We have 15 workstations and 10 servers. We want that each subset of the 10 workstations can simultaneously access a server, while a server can only handle one workstation at a time. Prove that the minimal number of connections required is 60.  Assume it is 59. Then one server S* must have at most 5 connections (if all servers had 6 connections we had 60 wires). Assume that the workstations that are not connected to S* (which are 10 in number) are the ones that try to make a connection. However, there are only 9 servers left..... A possible solution is this: connect the first 10 workstations to a unique server, and the remaining 5 to all servers. For any subset of 10 workstations, the uniquely wired workstations connect to their assigned server. The remaining ones pick an unoccupied server, which is always possible because they are connected to all of them.

Example: Every sequence of n^2+1 distinct real numbers contains a subsequence of length n+1 that is either strictly increasing or strictly decreasing. e.g.: 4 2 6 1 9 (n=2).  4 2 1, or 2 6 9 proof: Let m=n^2+1 and denote the sequence with a1,a2,...,am. At each position we define a pair: (Li,Di) for the longest increasing and longest decreasing sequence starting at position i. Suppose there is no sequence of length at least n+1 decreasing or increasing. The number of possibilities of (Li,Di) = n^2. Thus by the pigeonhole principle, 2 pairs (Li,Di) and (Lj,Dj) of these are equal. However, assume first that ai < aj (they must be distinct). Starting at aj there is an increasing subsequence of length Lj: b1 b2 b ... If we now construct the sequence ai b1 b2 b3 then that has length Lj+1=Li  CONTRADICTION same prove for ai > aj 