Counting - Discrete Structures - Lecture Slides, Slides of Discrete Structures and Graph Theory

These solved exam paper are very easy to understand and very helpful to built a concept about the foundation of computers and discrete structures.The key points discuss in these notes are:Counting, Basic Counting Principles, Counting Problems, Probabilities of Discrete Events, Sum Rule, Generalized Sum Rule, Product Rule, Generalized Product Rule, Set Theory, Finite Sets, Disjoint Sets

Typology: Slides

2012/2013

Uploaded on 04/27/2013

ashakiran
ashakiran 🇮🇳

4.5

(27)

261 documents

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
One, two, three, we’re…
Counting
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download Counting - Discrete Structures - Lecture Slides and more Slides Discrete Structures and Graph Theory in PDF only on Docsity!

One, two, three, we’re…

• Counting

Basic Counting Principles

  • Counting problems are of the following kind:
  • How many different 8-letter passwords are there?”
  • How many possible ways are there to pick 11 soccer players out of a 20-player team?”
  • Most importantly, counting is the basis for computing probabilities of discrete events.
  • (“What is the probability of winning the lottery?”)

Basic Counting Principles

  • Generalized sum rule:
  • If we have tasks T 1 , T 2 , …, Tm that can be done in n 1 , n 2 , …, nm ways, respectively, and no two of these tasks can be done at the same time, then there are n 1 + n 2 + … + nm ways to do one of these tasks.

Basic Counting Principles

  • The product rule:
  • Suppose that a procedure can be broken down into two successive tasks. If there are n 1 ways to do the first task and n 2 ways to do the second task after the first task has been done, then there are n 1 n 2 ways to do the procedure.

Basic Counting Principles

  • Generalized product rule:
  • If we have a procedure consisting of sequential tasks T 1 , T 2 , …, Tm that can be done in n 1 , n 2 , …, nm ways, respectively, then there are n 1  n 2  …  nm ways to carry out the procedure.

Basic Counting Principles

  • The sum and product rules can also be phrased in terms of set theory.
  • Sum rule: Let A 1 , A 2 , …, Am be disjoint sets. Then the number of ways to choose any element from one of these sets is |A 1  A 2  …  Am | = |A 1 | + |A 2 | + … + |Am|.
  • Product rule: Let A 1 , A 2 , …, Am be finite sets. Then the number of ways to choose one element from each set in the order A 1 , A 2 , …, Am is |A 1  A 2  …  Am | = |A 1 |  |A 2 |  …  |Am|.

Inclusion-Exclusion

  • Task 2: Construct a string of length 8 that ends with 00.
  • There are two ways to pick the first bit (0 or 1),
  • two ways to pick the second bit (0 or 1), -. -. -.
  • two ways to pick the sixth bit (0 or 1),
  • one way to pick the seventh bit (0), and
  • one way to pick the eighth bit (0).
  • Product rule: Task 2 can be done in 2^6 = 64 ways.

Inclusion-Exclusion

  • Since there are 128 ways to do Task 1 and 64 ways to do Task 2, does this mean that there are 192 bit strings either starting with 1 or ending with 00?
  • No, because here Task 1 and Task 2 can be done at the same time.
  • When we carry out Task 1 and create strings starting with 1, some of these strings end with 00.
  • Therefore, we sometimes do Tasks 1 and 2 at the same time, so the sum rule does not apply.

Inclusion-Exclusion

  • Since there are 128 ways to complete Task 1 and 64 ways to complete Task 2, and in 32 of these cases Tasks 1 and 2 are completed at the same time, there are
  • 128 + 64 – 32 = 160 ways to do either task.
  • In set theory, this corresponds to sets A 1 and A 2 that are not disjoint. Then we have:
  • |A 1  A 2 | = |A 1 | + |A 2 | - |A 1  A 2 |
  • This is called the principle of inclusion-exclusion.

Tree Diagrams

  • How many bit strings of length four do not have two consecutive 1s?
  • Task 1 Task 2 Task 3 Task 4 (1st^ bit) (2nd^ bit) (3rd^ bit) (4th^ bit)

0

0

(^0 )

1 1 0 (^1 0 ) 1 (^1 )

(^0 ) 1 1 0 There are 8 strings.

The Pigeonhole Principle

  • The generalized pigeonhole principle: If N objects are placed into k boxes, then there is at least one box containing at least N/k of the objects.
  • Example 1: In our 60-student class, at least 12 students will get the same letter grade (A, B, C, D, or F).

The Pigeonhole Principle

  • Example 2: 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?
  • There are two types of socks, so if you pick at least 3 socks, there must be either at least two brown socks or at least two black socks.
  • Generalized pigeonhole principle: 3/2 = 2.

Permutations and Combinations

  • So how can we compute how many different subsets of people can be picked (that is, we want to disregard the order of picking)?
  • To find out about this, we need to look at permutations.
  • A permutation of a set of distinct objects is an ordered arrangement of these objects.
  • An ordered arrangement of r elements of a set is called an r-permutation.

Permutations and Combinations

  • Example: Let S = {1, 2, 3}.
  • The arrangement 3, 1, 2 is a permutation of S.
  • The arrangement 3, 2 is a 2-permutation of S.
  • The number of r-permutations of a set with n distinct elements is denoted by P(n, r).
  • We can calculate P(n, r) with the product rule:
  • P(n, r) = n(n – 1)(n – 2) …(n – r + 1).
  • (n choices for the first element, (n – 1) for the second one, (n – 2) for the third one…)