Packet #6: Counting & Graph Theory. Applied Discrete Mathematics

Similar documents
Discrete Mathematics 2 Exam File Spring 2012

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH 1301 DISCRETE MATHEMATICS TIME ALLOWED: 2 HOURS

Varying Applications (examples)

Brief History. Graph Theory. What is a graph? Types of graphs Directed graph: a graph that has edges with specific directions

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

Chapter 8 Topics in Graph Theory

DS UNIT 4. Matoshri College of Engineering and Research Center Nasik Department of Computer Engineering Discrete Structutre UNIT - IV

SEVENTH EDITION and EXPANDED SEVENTH EDITION

5 Graphs

Foundations of Discrete Mathematics

Discrete mathematics , Fall Instructor: prof. János Pach

Eulerian tours. Russell Impagliazzo and Miles Jones Thanks to Janine Tiefenbruck. April 20, 2016

Graphs. Pseudograph: multiple edges and loops allowed

Solutions to Exercises 9

STUDENT NUMBER: MATH Final Exam. Lakehead University. April 13, Dr. Adam Van Tuyl

Chapter 14 Section 3 - Slide 1

WUCT121. Discrete Mathematics. Graphs

BHARATHIDASAN ENGINEERING COLLEGE NATTARAMPALLI Department of Science and Humanities CS6702-GRAPH THEORY AND APPLICATION

v V Question: How many edges are there in a graph with 10 vertices each of degree 6?

ASSIGNMENT 4 SOLUTIONS

Week 12: Trees; Review. 22 and 24 November, 2017

Topic 10 Part 2 [474 marks]

Solution : a) C(18, 1)C(325, 1) = 5850 b) C(18, 1) + C(325, 1) = 343

Discrete Mathematics Exam File Fall Exam #1

Figure 2.1: A bipartite graph.

Definition: A graph G = (V, E) is called a tree if G is connected and acyclic. The following theorem captures many important facts about trees.

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

r=1 The Binomial Theorem. 4 MA095/98G Revision

Graphs. The ultimate data structure. graphs 1

Graph Theory Questions from Past Papers

Computational Discrete Mathematics

An Introduction to Graph Theory

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague December 16, CS1800 Discrete Structures Final

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. An Introduction to Graph Theory

Simple Graph. General Graph

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Math 3336 Section 6.1 The Basics of Counting The Product Rule The Sum Rule The Subtraction Rule The Division Rule

CS1800 Discrete Structures Final Version A

2. CONNECTIVITY Connectivity

Chapter 11: Graphs and Trees. March 23, 2008

Network Topology and Graph

IMO Training 2010 Double Counting Victoria Krakovna. Double Counting. Victoria Krakovna

Graph and Digraph Glossary

Discrete Structures Lecture The Basics of Counting

Assignment 4 Solutions of graph problems

Elements of Graph Theory

About the Author. Dependency Chart. Chapter 1: Logic and Sets 1. Chapter 2: Relations and Functions, Boolean Algebra, and Circuit Design

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

Math Summer 2012

Graph Theory. Part of Texas Counties.

Practice Exam #3, Math 100, Professor Wilson. MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Mathematics and Statistics, Part A: Graph Theory Problem Sheet 1, lectures 1-4

Graphs and Puzzles. Eulerian and Hamiltonian Tours.

Graph Theory: Starting Out

Part II. Graph Theory. Year

Counting Problems; and Recursion! CSCI 2824, Fall 2012!

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

Eulerian Tours and Fleury s Algorithm

Math 776 Graph Theory Lecture Note 1 Basic concepts

Discrete Structures. Fall Homework3

MTH-129 Review for Test 4 Luczak

Graph (1A) Young Won Lim 4/19/18

Mathematics and Statistics, Part A: Graph Theory Revision Exercises: Sheet 3

Notebook Assignments

Graph theory. Po-Shen Loh. June We begin by collecting some basic facts which can be proved via bare-hands techniques.

Fundamental Properties of Graphs

Math 443/543 Graph Theory Notes

Number Theory and Graph Theory

Chapter 1: Number and Operations

PACKING DIGRAPHS WITH DIRECTED CLOSED TRAILS

Note that there are questions printed on both sides of each page!

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

a b c d a b c d e 5 e 7

Unit 7 Day 4 Notes: graph coloring, Graph theory review & Quiz

Discrete Mathematics and Probability Theory Fall 2013 Midterm #2

2.) From the set {A, B, C, D, E, F, G, H}, produce all of the four character combinations. Be sure that they are in lexicographic order.

Math 778S Spectral Graph Theory Handout #2: Basic graph theory

Reference Sheet for CO142.2 Discrete Mathematics II

A graph is finite if its vertex set and edge set are finite. We call a graph with just one vertex trivial and all other graphs nontrivial.

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Simple graph Complete graph K 7. Non- connected graph

Math.3336: Discrete Mathematics. Chapter 10 Graph Theory

8.2 Paths and Cycles

Introduction to Graph Theory

Math236 Discrete Maths with Applications

14 More Graphs: Euler Tours and Hamilton Cycles

Euler and Hamilton paths. Jorge A. Cobb The University of Texas at Dallas

CMSC 380. Graph Terminology and Representation

Indicate the option which most accurately completes the sentence.

Sections 5.2, 5.3. & 5.4

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

Chapter 5: Euler Paths and Circuits The Mathematics of Getting Around

Graph Theory CS/Math231 Discrete Mathematics Spring2015

The Probabilistic Method

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

MC302 GRAPH THEORY SOLUTIONS TO HOMEWORK #1 9/19/13 68 points + 6 extra credit points

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

Characterizing Graphs (3) Characterizing Graphs (1) Characterizing Graphs (2) Characterizing Graphs (4)

REGULAR GRAPHS OF GIVEN GIRTH. Contents

Transcription:

Packet #6: Counting & Graph Theory Applied Discrete Mathematics Table of Contents Counting Pages 1-8 Graph Theory Pages 9-16 Exam Study Sheet Page 17

Counting Information I. Product Rule: A B C = A * B * C II. Union Rule: A B = A + B - A B III. Inclusion/Exclusion Principle: The Union Rule applied inductively to: A 1 A 2 A n IV. Selection with Replacement A. Permutations: n B. Combinations: C(n+r-1,r) or C(n+r-1,n-1) V. Selection without Replacement A. Permutations: P(n,r) B. Combinations: C(n,r) VI. Pigeonhole Principle If (k+1) or more objects are placed in k boxes, then there is at least one box containing two or more objects. 1

Counting Product Rule A B C = A * B * C Examples Example 1: A = {1,2,3} B = {a,b} C = {a,b,g,d} How many 3-character words with 1st character from A, 2nd from B, 3rd from C? Answer: A * B * C = 3*2*4 = 24 Example 2: 3 Independents, 2 Democrats, 4 Republicans How many ways to form 3-person committee with one member from each party? Method: Count number of triples <Independent, Democrat, Republican> Answer: 3*2*4 = 24 Union Rule A B = A + B - A B Example S = {a,b,c} How many 3-letter words in S * start with a or end in b? Method: Let A = 3 letter words starting with "a" Let B = 3 letter words ending with "b" Find: A B Answer: A = (1) (3) (3) = 1*3*3 = 9 B = (3) (3) (1) = 3*3*1 = 9 A B = (1) (3) (1) = 1*3*1 = 3 A B = 9 + 9-3 = 15 2

Inclusion/Exclusion Principle To calculate A 1 A 2 A n, 1. Calculate size of all possible intersections 2. Add results from of odd numbered sets. 3. Subtract results from of even numbered sets. Ie. A 1 A 2 A 3 = A 1 + A 2 + A 3 - A 1 A 2 - A 1 A 3 - A 2 A 3 + A 1 A 2 A 3 Example: How many integers in {1,,1000} are divisible by either 2, 3, or 5? A = divisible by 2 B = divisible by 3 C = divisible by 5 Find: A B C A = {2,4,,1000} = 500 B = {3,6,,999} = 333 C = {5,10,,1000} = 200 A B = {6,12,18,,996} = 166 A C = {10,20,,1000} = 100 B C = {15,30,,990} = 66 A B C = {30,60,,990} = 33 So, A B C = 500 + 333 + 200-166 - 100-66 + 33 = 734 Selection with Replacement Permutations (Order Matters), with replacement: n r Choose r times from a set of n items with replacement and order matters. Drawing with replacement (sequence can repeat items): If there are n distinct objects and we draw r times. Each drawing has n distinct possibilities. If order matters, then by the product rule we have n x n x... x n possibilities = n r. 3

Examples Example 1: Create a sequence of 10 numbers by rolling a die 10 times. How many possible sequences? Method: Choose 10 times from a set of 6. Answer: 6 10 Example 2: S = {0,1,,7} How many strings of length 5 are there in S *? Method: Choose 5 times from a set of 8. Answer: 8 5 Combinations (Order Does Not Matter), with replacement: C(n+r-1,r) Choose r times from a set of n items with replacement and order does not matter. The number of possible outcomes is written as C(n+r-1,r). Combinations are discussed in more detail later. Example: You have 4 different kinds of cookies. How many different ways can 6 cookies be chosen? Method: Choose 6 times from a set of 4 with replacement and order does not matter. Answer: C(4+6-1,6) = C(9,6) = 9*8*7 3*2*1 = 84 Selection without Replacement Permutations (Order Matters): P(n,r) Choose r times from a set of n items without replacement and order matters. If we do not have replacement but order matters: Then first drawing has n possibilities; the second drawing has (n-1), the third has n! (n-2), etc. By the product rule we have: n x (n-1) x (n-2) x... x (n-r+1) = (n r)!. This is usually called permutations of n things taken r at a time. The number of n! possible outcomes is P(n,r) = (n r)! 4

Examples Example 1: Six CD's with 57 songs. CD player can be programmed to play any 20 songs in any order. How many ways can 20 different songs be played? Method: Choose 20 from 57 without replacement, order matters Answer: P(57,20) = 57! 37! Example 2: Given n integers x 1, x 2,, x n, all distinct. How many sorted arrangements are possible (i.e. how many permutations of x 1 x n?) Method: Choose all n items from n, without replacement, order matters n! Answer: P(n,n) = (n n)! = n! 0! = n! Example 3: S = {a,b,c,d,e,f} How many 3-letter words are in S * which have no character repeated? Method: Choose 3 from 6 without replacement and order matters. Answer: P(6,3) = 6! = 6*5*4 = 120 3! Combinations (Order Does Not Matter) without replacement: C(n,r) Choose r times from a set of n items without replacement and order doesn't matter. If order does not count and there is no replacement, then we must determine how many of the permutations are the same objects but only differ in order. That is: In how many orders can n distinct objects be arranged? P(n,n) = n! = n!. Therefore, if order does not matter and we do not have 0! replacement, the number of possibilities for n objects taken r at a time is P(n,r) P(r,r) = n!. This is usually referred to as combinations of n things taken r at a time (n r)!r! = C(n,r). There is another important type of combination, combinations with replacement. The sequence can repeat, but order does not matter. (Discussed Earlier) Number of ways to choose r from n is C(n,r) = n! (n r)!r! 5

Example How many ways can you choose a committee of 5 from 7 people? 7! Answer: C(n,r) = 2!5! = 7*6 2 = 21 Summary of Permutations and Combinations Type (n things, r times) Order Counts Replacement Symbol Expression Permutations w/ repl. Yes Yes None n r Permutations - no repl. Yes No P(n,r) n! (n-r)! Combinations - no repl. No No C(n,r) n! (n-r)! r! Combinations - w/ repl. No Yes C(n+r-1,r) (n+r-1)! r! (n-1)! More Examples Example 1: Place n indistinguishable objects into r distinguishable boxes. Number of possible outcomes is C(n+r-1,r-1). 0 0 1 0 0 0 1 0 0 0 1 0 (n+r-1) bits, (r-1) ones: C(n+r-1,r-1) 0 0 0 1 1 0 0 1 0 0 0 0 Example 2: 12 identical flyers are to be placed into 4 mailboxes. How many ways can this be done? Answer: C(12+4-1,4-1) = C(15,3) = 15! 15 * 14 * 13 = = 455 12!3! 3*2*1 What if each mailbox must receive at least 2 letters? Method: Put 2 letters in every box. Then, how many ways are there to distribute remaining 4 among 4 mailboxes? 7! Answer: C(4+4-1,4-1) = C(7,3) = 4!3! = 7*6*5 3*2*1 = 35 6

Example 3a: 15 basketball players are to be drafted by 3 professional teams (A,B,C). Each team will draft 5 players. In how many ways can this be done? Method: Choose 5 from 15 for A: C(15,5), 5 from remaining 10 for B: C(10,5), C has remaining 5: C(5,5) = 1 (multiply all three together). This determines all the ways we can partition the players where A chooses first, B second, and C last. Answer: C(15,5)*C(10,5) Example 3b: Now, if we cannot tell which team is which, we say the teams are indistinguishable. If this is the case, how many ways can 15 players be partitioned into 3 teams of 5 each? (i.e. - we want to know how many different sets {A,B,C} there are. In 3a, we could have one division with (A,B,C) = ({1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}) and another with (A,B,C) = ({6,7,8,9,10},{1,2,3,4,5},{11,12,13,14,15}). But these two examples divide the fifteen players up into the same groups.) C(15,5) *C(10,5) Answer: (since the teams are indistinguishable) 3! Example 4: In how many ways can 2n people be divided into n pairs without replacement and order does not matter? C(2 n, 2 ) * C(2 n 2,2) *... * C(2,2) Answer: n! Example 5: In how many ways can 10 boys and 5 girls stand in a line if no 2 girls can stand next to each other? Boy1 Boy2... Boy10 Method: Choose one slot for each girl (Select 5 slots from 11, without replacement and order matters.). Answer: There are 10! ways to place the boys and P(11,5) ways to place the girls, so by the product rule the answer is 10! * P(11,5). Example 6: In how many ways can 2 distinct numbers be selected from 1,2,...,100 so that their sum is even? Answer: (2 Odds) C(50,2) + (2 Evens) C(50,2) = 50*49 Example 7: In how many ways can 2 distinct numbers be selected from 1,2,...,100 so that their sum is odd? Answer: Choose 1 even and 1 odd = C(50,1) *C(50,1)= 50*50 7

Pigeonhole Principle If (k+1) or more objects are placed in k boxes, then there is at least one box containing two or more objects. Examples Example 1: If you have a group of 367 people, there must be at least two people who have the same birthday (there are only 366 possible birthdays). Example 2: If you have a group of 27 English words, there must be at least two words that begin with the same letter (there are only 26 possible letters in the English language). 8

Graph Information I. Basic Definitions II. Euler Circuit and Fleury's Algorithm III. Hamilton Cycle IV. Kruskal's Algorithm V. Matrix Representation of Graphs VI. Hasse Diagrams 9

Graphs Basic Definitions path: (way of getting from one vertex to another via edges) - sequence of vertices in which successive vertices are joined by an edge length of path: number of edges in path Example paths: uvwxy (length 4) uxy (length 2) uxwustxzy (length 8) closed path: first vertex = last vertex cycle: closed path in which all vertices are distinct, except first = last acyclic graph: graph with no cycle Example closed path: xyztx closed path: swxtzyxs closed path: uvwvu acyclic graph: also cycle not cycle not cycle 10

A graph is connected if every pair of vertices is joined by a path. Example Connected Not connected The degree of a vertex is the number of edges touching the vertex. (loops count twice) Example Vertex Degree u 2 v 2 x 4 y 4 z 4 11

Euler Circuit and Fleury's Algorithm Euler circuit: closed path which uses each edge exactly once Can show there is an Euler circuit if and only if every vertex has even degree. ("easy" to find) Fleury's algorithm will always find Euler circuit in connected graph if every vertex has even degree. Fleury's Algorithm Start at any vertex v While (still more edges incident with v) do - if possible choose edge vw which does not disconnect - else choose only vw and delete v - delete edge vw - v := w end do Example of Fleury's Algorithm 12

etc. Euler circuit: 23215341452 Hamilton Cycle Hamilton cycle: cycle which uses each vertex once "hard" problem (version of Traveling Salesman Problem) Example Hamilton cycle: uvtwxysu 13

Kruskal's Algorithm Minimum cost network to connect sites. Given sites and link costs Kruskal's Algorithm Start with no edges. Examine edges in non-decreasing order of weight. If an edge does not create a cycle, add it. Example of Kruskal's Algorithm Matrix Representation of Graphs Label vertices v 1, v 2,, v n Adjacency matrix M: nxn matrix with M[x,y] = number of edges joining v x and v y. 14

Examples of Adjacency Matrices Graph isomorphism: Graphs G and H are isomorphic if there is some way to label the vertices of H so that H is G (ie, has same adjacency matrix). Examples 15

Suppose M is the adjacency matrix of a graph G. Can prove by induction: M k [i,j] = number of length-k paths joining i and j Reachability Matrix R 16

Fourth Hour Exam Study Sheet I. Counting A. Basic Rules (Product, Union, Inclusion/Exclusion) B. Selection with Replacement (Permutations, Combinations) C. Selection without Replacement (Permutations, Combinations) D. Pigeonhole Principle II. Graphs A. Basic Definitions B. Euler Circuit and Fleury's Algorithm C. Hamilton Cycle D. Kruskal's Algorithm E. Matrix Representation of Graphs F. Hasse Diagrams 17