Mathematics for Computer Science MIT 6.042J/18.062J

Slides:



Advertisements
Similar presentations
Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.1 Mathematics for Computer Science MIT 6.042J/18.062J.
Advertisements

Counting. Counting = Determining the number of elements of a finite set.
Lecture 4 4.1,4.2 Counting. 4.1 Counting Two Important Principles: Product Rule and Sum Rule. Product Rule: Assume we need to perform procedure 1 AND.
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Section 4.1: The Basics of Counting As we have seen, one way to count the number of objects in a finite set S is to produce a one-to-one correspondence.
Algebraic Structures DEFINITIONS: PROPERTIES OF BINARY OPERATIONS Let S be a set and let  denote a binary operation on S. (Here  does not necessarily.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
September1999 CMSC 203 / 0201 Fall 2002 Week #8 – 14/16 October 2002 Prof. Marie desJardins.
1 CSC 321: Data Structures Fall 2013 Counting and problem solving  mappings, bijection rule  sequences, product rule, sum rule  generalized product.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
COMPSCI 102 Discrete Mathematics for Computer Science.
Discrete Mathematics for Computer Science. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences Chapter 9 slides 1-54.
Boolean Algebra and Computer Logic Mathematical Structures for Computer Science Chapter 7.1 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesBoolean Algebra.
Counting Techniques. L172 Agenda Section 4.1: Counting Basics Sum Rule Product Rule Inclusion-Exclusion.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
Introduction Suppose that a password on a computer system consists of 6, 7, or 8 characters. Each of these characters must be a digit or a letter of the.
Boolean Algebra and Computer Logic Mathematical Structures for Computer Science Chapter 7 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesBoolean Algebra.
CS 104: Discrete Mathematics
Introductory Lecture. What is Discrete Mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete (as opposed to continuous)
Review: Discrete Mathematics and Its Applications
CSC 321: Data Structures Fall 2015 Counting and problem solving
The Pigeonhole Principle
Introduction to Combinatorics
Permutations and Combinations
CS 2210 Discrete Structures Counting
Mathematical Structures for Computer Science Chapter 6
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
Set, Combinatorics, Probability & Number Theory
Asymptotics & Stirling’s Approximation
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Combinatorics.
Basic Counting.
and Structural Induction II
Combinatorics.
Mathematics for Computer Science MIT 6.042J/18.062J
and Structural Induction II
DISCRETE COMPUTATIONAL STRUCTURES
Review: Discrete Mathematics and Its Applications
Chapter 11 Limitations of Algorithm Power
and Structural Induction
and Structural Induction II
Counting Discrete Mathematics.
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
Counting II: Recurring Problems And Correspondences
and Structural Induction
and Structural Induction
Representations of Integers
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Asymptotics & Stirling’s Approximation
Truth and Proof Math vs. Reality Propositions & Predicates
Asymptotics & Stirling’s Approximation
Copyright © Zeph Grunschlag,
Discrete Mathematics for Computer Science
Counting II: Recurring Problems And Correspondences
and Structural Induction
Chapter 3. Sets & Combinatorics
Presentation transcript:

Mathematics for Computer Science MIT 6.042J/18.062J Combinatorics I Copyright © Radhika Nagpal, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

Counting Techniques Bijections Sum Rule, Inclusion-Exclusion Product Rule Pigeonhole Principle Trees Permutations

Counting Strings How many strings of length 3 can make with the alphabet A = {r,a,d} ?

Counting Strings (3) (3) (3) {r,a,d} {r,a,d} {r,a,d} (3) (3) (3) {r,a,d} {r,a,d} {r,a,d} Number of strings = 3.3.3 = 27

Counting Rearrangements How many strings of length 3 can I make by rearranging the letters rad?

Permutations (3) (2) (1) {r,a,d} {?,?} {?} (3) (2) (1) {r,a,d} {?,?} {?} Number of strings, |S| = 3.2.1 = 6

Permutations (3) (2) (1) {r,a,d} {?,?} {?} S = {rad, rda ard, adr (3) (2) (1) {r,a,d} {?,?} {?} S = {rad, rda ard, adr dra, dar}

Permutation Tree d rad rda ard adr dra dar a a d d r r a d r d r a a r

… … Strings Tree r a d r r a a d d r r a a d d rrr rra rrd rar raa rad rda rdd ….. drr dra drd dar daa dad ddr dda ddd a d r r a a d d r r … a a d … d

Comparison rearrangement strings n n2 n! nn 1 1 1 1 5 25 120 3125 1 1 1 1 5 25 120 3125 10 100 ~107 1010 400 ~1018 1026 40 1600 ~1047 1064 100 10000 ~10157 10200 1000 106 scheme dies…..

Important technique: Matching Make a one-to-one mapping between a given problem and a set of known cardinality (or at least one we know how to count…) Functions Binary strings Lists Trees Graphs, Relations Matrices Strings, Polynomials Balls and Bins

Counting Functions f B A How many different possible functions are there from A to B? f b1 b2 b3 b4 b5 b6 a1 a2 a3 a4 a5 A B

Mapping: Functions as Strings a1 a2 a3 a4 a5 A B b1 b1 b1 b1 b1 b1 b2 b3 b1 b4 …… string of length 5 from the alphabet {b1, b2…b6} f

Counting Functions A B (6) (6) (6) (6) (6) a1 a2 a3 a4 a5 A B (6) (6) (6) (6) (6) Total number of possible functions = total number of possible strings = 6.6.6.6.6 =

Counting Bijections f B A How many different possible bijections are there from A to B? f a1 a2 a3 a4 a5 b1 b2 b3 b4 b5 A B

Counting Bijections A B Permutations of the letters {b1,b2,b3,b4,b5} a1 a2 a3 a4 a5 A B b1 b2 b3 b4 b5 b5 b4 b3 b2 b1 …… Permutations of the letters {b1,b2,b3,b4,b5}

Counting Bijections A B (5) (4) (3) (2) (1) a1 a2 a3 a4 a5 A B (5) (4) (3) (2) (1) Total number of possible functions = total number of possible permutations = 5.4.3.2.1 = 5!

Counting Graphs v1 v1 v1 v2 v3 v2 v3 v2 v3 How many possible directed graphs are there on n nodes? v1 v1 v1 v2 v3 v2 v3 v2 v3

Graphs as Binary Strings Maximum possible edges = n2 e1 e2 e3 …… en2 G1 1 0 1 0 ….. 1 G2 0 1 1 0……1 G3 ..

Graphs as Boolean Matrices 1 0 1 0 1 1 2 3 . n Any assignment of 1s and 0s is a possible graph

Proving that a Mapping is a Bijection Prove that g: F S is a bijection Prove that all elements in F map to a unique elements of S Prove that all elements in S map to some F

Example: Graph Isomorphism G1 and G2 are isomorphic if there is a bijection f from the nodes of G1 to the nodes of G2, that preserve the adjacency lists. Question: At most how many functions do I need to check to determine whether or not G1 and G2 are isomorphic? Answer: All possible bijections from the nodes of G1 to G2 = n!

In-class Problems