Counting integral solutions

Similar documents
Counting integral solutions

DISCUSSION #8 FRIDAY MAY 25 TH Sophie Engle (Teacher Assistant) ECS20: Discrete Mathematics

Jong C. Park Computer Science Division, KAIST

Combinatorial Proofs

Poker: Probabilities of the Various Hands

Poker: Probabilities of the Various Hands

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

Reading 14 : Counting

Counting in Algorithms

Developed by Rashmi Kathuria. She can be reached at

10.2.notebook. February 24, A standard deck of 52 playing cards has 4 suits with 13 different cards in each suit.

Today s Topics. Sometimes when counting a set, we count the same item more than once

With Question/Answer Animations. Chapter 6

11.3B Warmup. 1. Expand: 2x. 2. Express the expansion of 2x. using combinations. 3. Simplify: a 2b a 2b

More Probability: Poker Hands and some issues in Counting

Unit Nine Precalculus Practice Test Probability & Statistics. Name: Period: Date: NON-CALCULATOR SECTION

CSE 21 Mathematics for Algorithm and System Analysis

Counting. Chapter 6. With Question/Answer Animations

Permutations and Combinations Practice Test

Week 1: Probability models and counting

Problem Set 8 Solutions R Y G R R G

Lecture 18 - Counting

n! = n(n 1)(n 2) 3 2 1

Mat 344F challenge set #2 Solutions

1MA01: Probability. Sinéad Ryan. November 12, 2013 TCD

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions)

Combinations AMC AMS AMR ACS ACR ASR MSR MCR MCS CRS

If you roll a die, what is the probability you get a four OR a five? What is the General Education Statistics

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

Chapter 2. Permutations and Combinations

Problem Set 8 Solutions R Y G R R G

Poker Hands. Christopher Hayes

Poker: Further Issues in Probability. Poker I 1/29

CSE 312: Foundations of Computing II Quiz Section #1: Counting

Math 166: Topics in Contemporary Mathematics II

Honors Precalculus Chapter 9 Summary Basic Combinatorics

Chapter 1. Probability

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions)

Important Distributions 7/17/2006

Discrete Structures Lecture Permutations and Combinations

Section Summary. Permutations Combinations Combinatorial Proofs

Such a description is the basis for a probability model. Here is the basic vocabulary we use.

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology


Principle of Inclusion-Exclusion Notes

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

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions)

Permutations: The number of arrangements of n objects taken r at a time is. P (n, r) = n (n 1) (n r + 1) =

March 5, What is the area (in square units) of the region in the first quadrant defined by 18 x + y 20?

Define and Diagram Outcomes (Subsets) of the Sample Space (Universal Set)

Combinations Example Five friends, Alan, Cassie, Maggie, Seth and Roger, have won 3 tickets for a concert. They can t afford two more tickets.

Introductory Probability

Suppose you are supposed to select and carry out oneof a collection of N tasks, and there are T K different ways to carry out task K.

The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n ways to do the first task and n

CMPSCI 240: Reasoning Under Uncertainty First Midterm Exam

CISC-102 Fall 2017 Week 8

Counting Poker Hands

Sec.on Summary. The Product Rule The Sum Rule The Subtraction Rule (Principle of Inclusion- Exclusion)

Activity 6: Playing Elevens

AMC AMS AMR ACS ACR ASR MSR MCR MCS CRS

Activity 3: Combinations

Activity 1: Play comparison games involving fractions, decimals and/or integers.

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability

Unit 9: Probability Assignments

Compound Probability. Set Theory. Basic Definitions

Topics to be covered

Discrete Finite Probability Probability 1

NOTES: SIGNED INTEGERS DAY 1

With Question/Answer Animations. Chapter 6

CS70: Lecture Review. 2. Stars/Bars. 3. Balls in Bins. 4. Addition Rules. 5. Combinatorial Proofs. 6. Inclusion/Exclusion

3 The multiplication rule/miscellaneous counting problems

Dealing with some maths

Up & Down GOAL OF THE GAME UP&DOWN CARD A GAME BY JENS MERKL & JEAN-CLAUDE PELLIN ART BY CAMILLE CHAUSSY

Math 1111 Math Exam Study Guide

Discrete Mathematics. Spring 2017

Unit 5 Radical Functions & Combinatorics

Slide 1 Math 1520, Lecture 13

Sec$on Summary. Permutations Combinations Combinatorial Proofs

Math 3012 Applied Combinatorics Lecture 2

Mixed Counting Problems

Introduction to probability

3 The multiplication rule/miscellaneous counting problems

Elementary Combinatorics

1. Counting. 2. Tree 3. Rules of Counting 4. Sample with/without replacement where order does/doesn t matter.

Chapter 1. Probability

CSCI 4150 Introduction to Artificial Intelligence, Fall 2004 Assignment 7 (135 points), out Monday November 22, due Thursday December 9

8.2 Union, Intersection, and Complement of Events; Odds

MATH-1110 FINAL EXAM FALL 2010

CS 237 Fall 2018, Homework SOLUTION

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Intermediate Math Circles November 1, 2017 Probability I

Integer Compositions Applied to the Probability Analysis of Blackjack and the Infinite Deck Assumption

November 6, Chapter 8: Probability: The Mathematics of Chance

LAMC Junior Circle February 3, Oleg Gleizer. Warm-up

Counting Methods and Probability

About Permutations and Combinations: Examples

Lecture 14. What s to come? Probability. A bag contains:

MA 524 Midterm Solutions October 16, 2018

{ a, b }, { a, c }, { b, c }

Transcription:

Thought exercise 2.2 20 Counting integral solutions Question: How many non-negative integer solutions are there of x 1 +x 2 +x 3 +x 4 = 10?

Thought exercise 2.2 20 Counting integral solutions Question: How many non-negative integer solutions are there of x 1 +x 2 +x 3 +x 4 = 10? Give some examples of solutions. Characterize what solutions look like. A combinatorial object with a similar flavor is:

Thought exercise 2.2 20 Counting integral solutions Question: How many non-negative integer solutions are there of x 1 +x 2 +x 3 +x 4 = 10? Give some examples of solutions. Characterize what solutions look like. A combinatorial object with a similar flavor is: In general, the number of non-negative integer solutions to x 1 +x 2 + +x n = k is.

Thought exercise 2.2 20 Counting integral solutions Question: How many non-negative integer solutions are there of x 1 +x 2 +x 3 +x 4 = 10? Give some examples of solutions. Characterize what solutions look like. A combinatorial object with a similar flavor is: In general, the number of non-negative integer solutions to x 1 +x 2 + +x n = k is. Question: How many positive integer solutions are there of x 1 +x 2 +x 3 +x 4 = 10, where x 4 3?

Overcounting 1.2 21 The sum principle Often it makes sense to break down your counting problem into smaller, disjoint, and easier-to-count sub-problems. Example. How many integers from 1 to 999999 are palindromes?

Overcounting 1.2 21 The sum principle Often it makes sense to break down your counting problem into smaller, disjoint, and easier-to-count sub-problems. Example. How many integers from 1 to 999999 are palindromes? Answer: Condition on how many digits. Length 1: Length 4: Length 2: Length 5,6: Length 3: Total:

Overcounting 1.2 21 The sum principle Often it makes sense to break down your counting problem into smaller, disjoint, and easier-to-count sub-problems. Example. How many integers from 1 to 999999 are palindromes? Answer: Condition on how many digits. Length 1: Length 4: Length 2: Length 5,6: Length 3: Total: Every palindrome between 1 and 999999 is counted once.

Overcounting 1.2 21 The sum principle Often it makes sense to break down your counting problem into smaller, disjoint, and easier-to-count sub-problems. Example. How many integers from 1 to 999999 are palindromes? Answer: Condition on how many digits. Length 1: Length 4: Length 2: Length 5,6: Length 3: Total: Every palindrome between 1 and 999999 is counted once. This illustrates the sum principle: Suppose the objects to be counted can be broken into k disjoint and exhaustive cases. If there are n j objects in case j, then there are n 1 +n 2 + +n k objects in all.

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls:

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting Overcounting

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting Often, forgetting cases when applying the sum principle. Ask: Did I miss something? Overcounting

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting Often, forgetting cases when applying the sum principle. Ask: Did I miss something? Overcounting Often, misapplying the product principle. Ask: Do cases need to be counted in different ways? Ask: Does the same object appear in multiple ways?

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting Often, forgetting cases when applying the sum principle. Ask: Did I miss something? Overcounting Often, misapplying the product principle. Ask: Do cases need to be counted in different ways? Ask: Does the same object appear in multiple ways? Common example: A deck of cards. There are four suits: Diamond, Heart, Club, Spade. Each has 13 cards: Ace, King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2.

Overcounting 1.2 22 Counting pitfalls When counting, there are two common pitfalls: Undercounting Often, forgetting cases when applying the sum principle. Ask: Did I miss something? Overcounting Often, misapplying the product principle. Ask: Do cases need to be counted in different ways? Ask: Does the same object appear in multiple ways? Common example: A deck of cards. There are four suits: Diamond, Heart, Club, Spade. Each has 13 cards: Ace, King, Queen, Jack, 10, 9, 8, 7, 6, 5, 4, 3, 2. Example. Suppose you are dealt two diamonds between 2 and 10. In how many ways can the product be even?

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart?

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card.

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card. There are hearts, so there are choices for the up card.

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card. There are hearts, so there are choices for the up card. By the product principle, there are 52 ways in all.

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card. There are hearts, so there are choices for the up card. By the product principle, there are 52 ways in all. Except:

Overcounting 1.2 23 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card. There are hearts, so there are choices for the up card. By the product principle, there are 52 ways in all. Except: Remember to ask: Do cases need to be counted in different ways?

Overcounting 1.2 24 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898.

Overcounting 1.2 24 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898. Strategy: 1. Choose where the adjacent equal elements are. ( ways) 2. Choose which number they are. ( ways) 3. Choose the numbers for the remaining elements. ( ways)

Overcounting 1.2 24 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898. Strategy: 1. Choose where the adjacent equal elements are. ( ways) 2. Choose which number they are. ( ways) 3. Choose the numbers for the remaining elements. ( ways) By the product principle, there are ways in all.

Overcounting 1.2 24 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898. Strategy: 1. Choose where the adjacent equal elements are. ( ways) 2. Choose which number they are. ( ways) 3. Choose the numbers for the remaining elements. ( ways) By the product principle, there are Except: ways in all.

Overcounting 1.2 24 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898. Strategy: 1. Choose where the adjacent equal elements are. ( ways) 2. Choose which number they are. ( ways) 3. Choose the numbers for the remaining elements. ( ways) By the product principle, there are Except: ways in all. Remember to ask: Does the same object appear in multiple ways?

Overcounting 1.2 25 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2:

Overcounting 1.2 25 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2: Together: Q3:

Overcounting 1.2 25 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2: Together: Q3: Strategy: It is sometimes easier to count the complement. Answer to Q3:

Overcounting 1.2 25 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2: Together: Q3: Strategy: It is sometimes easier to count the complement. Answer to Q3: Answer to Q2:

Overcounting 1.2 25 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2: Together: Q3: Strategy: It is sometimes easier to count the complement. Answer to Q3: Answer to Q2: Answer to Q1:

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan:

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan: Count the total number of hands. Count the number of possible full houses. Divide to find the probability.

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan: Count the total number of hands. Count the number of possible full houses. Choose the denomination of the three-of-a-kind. Choose which three suits they are in. Divide to find the probability.

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan: Count the total number of hands. Count the number of possible full houses. Choose the denomination of the three-of-a-kind. Choose which three suits they are in. Choose the denomination of the pair. Choose which two suits they are in. Apply the multiplication principle. Divide to find the probability.

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan: Count the total number of hands. Count the number of possible full houses. Choose the denomination of the three-of-a-kind. Choose which three suits they are in. Choose the denomination of the pair. Choose which two suits they are in. Apply the multiplication principle. Total: Divide to find the probability. # of ways

Overcounting 1.2 26 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 5 5 5 K K Game plan: Count the total number of hands. Count the number of possible full houses. Choose the denomination of the three-of-a-kind. Choose which three suits they are in. Choose the denomination of the pair. Choose which two suits they are in. Apply the multiplication principle. Total: Divide to find the probability. 3744 2598960 0.14% # of ways

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n k) for all n and k. k 1).

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 1 5 1 1 6 1 1 7 1 1

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 1 6 1 1 7 1 1

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1 6 1 6 15 20 15 6 1 7 1 1

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1 6 1 6 15 20 15 6 1 7 1 1 Seq s in Pascal s triangle: ( 1,2,3,4,5,... n 1) (a n = n) ( 1,3,6,10,15,... n 2) triangular ( 1,4,10,20,35,... n 3) tetrahedral ( 1,2,6,20,70,... 2n n) centr. binom.

The binomial theorem 2.2 27 Pascal s triangle Pascal s identity gives us the recurrence ( n) ( k = n 1 ) ( k + n 1 With initial conditions we can calculate ( n ( k) for all n and k. n ) ( 0 = 1 and n ) n = 1 for all n. k 1). n\ k 0 1 2 3 4 5 6 7 0 1 1 1 1 2 1 2 1 3 1 3 3 1 4 1 4 6 4 1 5 1 5 10 10 5 1 6 1 6 15 20 15 6 1 7 1 1 Online Encyclopedia of Integer Sequences: http://oeis.org/ Seq s in Pascal s triangle: ( 1,2,3,4,5,... n 1) (a n = n) A000027 ( 1,3,6,10,15,... n 2) triangular A000217 ( 1,4,10,20,35,... n 3) tetrahedral A000292 ( 1,2,6,20,70,... 2n n) centr. binom. A000984

The binomial theorem 2.2 28 Binomial Theorem Theorem 2.2.2. Let n be a positive integer. For all x and y, (x +y) n = x n + ( n) 1 x n 1 y + + ( n n 1) xy n 1 +y n.

The binomial theorem 2.2 28 Binomial Theorem Theorem 2.2.2. Let n be a positive integer. For all x and y, (x +y) n = x n + ( n) 1 x n 1 y + + ( n n 1) xy n 1 +y n. Rewrite in summation notation! Determine the generic term [ ( n k) x y ] and the bounds on k (x +y) n =

The binomial theorem 2.2 28 Binomial Theorem Theorem 2.2.2. Let n be a positive integer. For all x and y, (x +y) n = x n + ( n) 1 x n 1 y + + ( n n 1) xy n 1 +y n. Rewrite in summation notation! Determine the generic term [ ( n k) x y ] and the bounds on k (x +y) n = The entries of Pascal s triangle are the coefficients of terms in the expansion of (x +y) n.

The binomial theorem 2.2 28 Binomial Theorem Theorem 2.2.2. Let n be a positive integer. For all x and y, (x +y) n = x n + ( n) 1 x n 1 y + + ( n n 1) xy n 1 +y n. Rewrite in summation notation! Determine the generic term [ ( n k) x y ] and the bounds on k (x +y) n = The entries of Pascal s triangle are the coefficients of terms in the expansion of (x +y) n. Proof. In the expansion of (x +y)(x +y) (x +y), in how many ways can a term have the form x n k y k?

The binomial theorem 2.2 28 Binomial Theorem Theorem 2.2.2. Let n be a positive integer. For all x and y, (x +y) n = x n + ( n) 1 x n 1 y + + ( n n 1) xy n 1 +y n. Rewrite in summation notation! Determine the generic term [ ( n k) x y ] and the bounds on k (x +y) n = The entries of Pascal s triangle are the coefficients of terms in the expansion of (x +y) n. Proof. In the expansion of (x +y)(x +y) (x +y), in how many ways can a term have the form x n k y k? From the n factors (x +y), you must choose a y exactly k times. Therefore, ( n k) ways. We recover the desired equation.