Docsity

Combinatorics - Discrete Mathematics - Lecture Slides, Slides of Discrete Mathematics

Partial preview of the text

Download Combinatorics - Discrete Mathematics - Lecture Slides and more Slides Discrete Mathematics in PDF only on Docsity!

CSE115/ENGR160 Discrete Mathematics 04/10/

6.1 Basics of counting

  • Combinatorics : they study of arrangements of objects
  • Enumeration : the counting of objects with certain properties (an important part of combinatorics) - Enumerate the different telephone numbers possible in US - The allowable password on a computer - The different orders in which runners in a race can reach (^2)

Basic counting principles

  • Two basic counting principles
    • Product rule
    • Sum rule
  • Product rule : suppose that a procedure can be broken down into a sequence of two tasks
  • If there are n 1 ways to do the 1 st^ task, and each of these there are n 2 ways to do the 2 nd task, then there are n 1 ∙n 2 ways to do the procedure

Example

  • The chairs of a room to be labeled with a letter and a positive integer not exceeding
    1. What is the largest number of chairs that can be labeled differently?
  • There are 26 letters to assign for the 1 st^ part and 100 possible integers to assign for the 2 nd part, so there are 26∙100=2600 different ways to label chairs

Example

  • How many different license plates are available if each plate contains a sequence of 3 letters followed by 3 digits (and non sequences of letters are prohibited, even if they are obscene)?
  • License plate _ _ _ _ _ _ : There are 26 choices for each letter and 10 choices for each digit. So, there are 26∙26∙26∙10∙10∙10 = 17,576,000 possible license plates

Counting functions

  • How many functions are there from a set with m elements to a set with n elements?
  • A function corresponds to one of the n elements in the codomain for each of the m elements in the domain
  • Hence, by product rule there are n∙n…∙n=nm functions from a set with m elements to one with n elements

Example

  • From a set with 3 elements to one with 5 elements, there are 5∙4∙3=60 one-to-one functions

Example

  • The format of telephone numbers in north America is specified by a numbering plan
  • It consists of 10 digits, with 3-digit area code, 3-digit office code and 4-digit station code
  • Each digit can take one form of
    • X: 0, 1, …, 9
    • N: 2, 3, …, 9
    • Y: 0, 1

Example

  • In the new plan, the formats for area code, office code, and station code are NXX, NXX, and XXXX, respectively
  • So the phone numbers had NXX-NXX-XXXX
  • NXX: 8∙10∙10=800 area codes
  • NXX: 8∙10∙10=800 office codes
  • XXXX:10∙10∙10∙10=10,000 station codes
  • So, there are 800∙800∙10,000 = 6,400,000, phone numbers

Product rule

  • If A 1 , A 2 , …, Am are finite sets, then the number of elements in the Cartesian product of these sets is the product of the number of elements in each set
  • |A 1 ⨯A 2 ⨯… ⨯Am|=|A 1 | ⨯|A 2 | ⨯ … ⨯|Am|

Sum rule

  • If A 1 , A 2 , …, Am are disjoint finite sets, then the number of elements in the union of these sets is as follows |A 1 ⋃A 2 ⋃… ⋃Am|=|A 1 |+|A 2 |+…+|Am|

More complex counting problems

  • In a version of the BASIC programming language, the name of a variable is a string of 1 or 2 alphanumeric characters, where uppercase and lowercase letters are not distinguished.
  • Moreover, a variable name must begin with a letter and must be different from the five strings of two characters that are reserved for programming use
  • How many different variables names are there?
  • Let V 1 be the number of these variables of 1 character, and likewise V 2 for variables of 2 characters
  • So, V 1 =26, and V 2 =26∙36-5=
  • In total, there are 26+931=957 different variables

Example: Internet address

  • Internet protocol (IPv4)
    • Class A: largest network
    • Class B: medium-sized networks
    • Class C : smallest networks
    • Class D: multicast (not assigned for IP address)
    • Class E: future use
    • Some are reserved: netid 1111111, hostid all 1’s and 0’s
  • Neither class D or E addresses are assigned as the IPv4 addresses
  • How may different IPv4 addresses are available?

Example: Internet address

  • Let the total number of address be x, and x=x (^) A+xB+xC
  • Class A: there are 2 7 -1=127 netids (1111111 is reserved). For each netid, there are 2 24 -2=16,777,214 hostids (as hostids of all 0s and 1s are reserved), so there are x (^) A=127∙16,777,214=2,130,706,178 addresses
  • Class B, C: 2^14 =16,384 Class B netids and 2^21 =2,097,152 Class C netids. 216 - 2=65,534 Class B hostids, and 2 8 - 2=254 Class C hostids. So, xB =1,073,709,056, and xC=532,676,
  • So, x=xA+xB+xC=3,737,091,842 (^20)