Download presentation
Presentation is loading. Please wait.
Published byMyles Morris Modified over 9 years ago
1
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set, Combinatorics, Probability & Number Theory
2
Section 3.2Counting1 Combinatorics: the branch of mathematics that deals with counting things. Counting problems can deal with infinite numbers, but usually we’re interested in finding out how many members are present in a finite set. For example: If a man has 4 suits, 8 shirts and 5 ties, how many outfits can he put together? How many memory locations can be addressed with a 32-bit address? Counting problems we’ve already looked at: How many rows in a truth table with n variables? How many subsets in the power set of a given set S? Counting example: A child is allowed to choose one jellybean out of two jellybeans, one red and one black, and one gummy bear out of three gummy bears, yellow, green, and white. How many different sets of candy can the child have?
3
Section 3.2Counting2 Example: Multiplication Principle There are 2 3=6 or 3 2=6 possible outcomes as seen from the following figures
4
Section 3.2Counting3 Counting – the Multiplication Principle Multiplication Principle: If there are n possible outcomes for a first event and m possible outcomes for a second event, then there are n*m possible outcomes for the sequence of two events. Hence, from the multiplication principle, it follows that for two sets A and B |A B| = |A|*|B| Remember that A B is the set of ordered pairs where the first element comes from A and the second from B. In this case, choose one thing from A ( there are |A| choices) and one thing from B, with |B| choices. In the example, A is the set of jelly beans, B is the set of gummy bears.
5
Section 3.2Counting4 Counting – the Multiplication Principle We can use induction to extend the multiplication principle: If there are n 1 possible outcomes (choices) for a first event, n 2 possible outcomes for a second event, … n m possible outcomes for the mth event, then there are n 1 *n 2 *…*n m possible outcomes for the sequence of events. Example: Number of locations addressable with 32 bits: n = ? m = ? What if repetition is not allowed? Suppose we have 10 colored balls. How many ways to arrange them in a row? Now suppose we don’t use all the objects in the set. Consider choosing three officers from a club that has 25 members? How many ways can we do this? If no person can hold more than one office If a person can hold more than one office.
6
Counting – The Addition Principle The multiplication principle applies when you have a sequence of events, and for each event you have several choices. Other situations involve more than one event, but they are disjoint, not separate. When we select one event we rule out the others. Example: buying a vehicle from a dealer who has 23 cars and 14 trucks. You have 23 + 14 = 37 possible outcomes. First choose an event (buy car or buy truck) and then choose one possibility. Addition Principle: If A and B are disjoint events with n and m possible outcomes, then the total number of possible outcomes for event “AorB” is n + m. Section 3.2Counting5
7
Section 3.2Counting6 Addition Principle If A and B are disjoint sets, then |A B| = |A| + |B| using the addition principle. Example 32 proves that if A and B are finite sets then |A-B| = |A| - |A B| and |A-B| = |A| - |B| if B A (A-B) (A B) = (A B) (A B) = A (B B) = A U = A Also, A-B and A B are disjoint sets, therefore using the addition principle (see first bullet point above) |A| = | (A-B) (A B) | = |A-B| + |A B| Hence, |A-B| = |A| - |A B| If B A, then A B = B Hence, |A-B| = |A| - |B|
8
Combining the Principles Sometimes a counting problem uses both the multiplication and addition principles. Example: how many 4-digit numbers begin with the digits 4 or 5? Disjoint events: numbers starting with 4, numbers starting with 5. TWO such events (addition principle) Use multiplication principle to count number of 4-digit numbers: for the first digit there is one choice. How many for the second digit? The third & fourth? Now count the number of 5 digit numbers in the same way. Now, use the addition principle to get the total number of 4-digit numbers with first digit equal to 4 or 5. Section 3.2Counting7
9
Section 3.2Counting8 Decision trees Trees that provide the number of outcomes of an event based on a series of possible choices are called decision trees. Tony is pitching pennies. Each toss results in heads (H) or tails (T). How many ways can he toss the coin five times without having two heads in a row? There are 13 possible outcomes as seen from the tree.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.