Chapter 7. Intro to Counting

Similar documents
Counting Subsets with Repetitions. ICS 6C Sandy Irani

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting

7.4 Permutations and Combinations

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

Math 3012 Applied Combinatorics Lecture 2

With Question/Answer Animations. Chapter 6

Week 6: Advance applications of the PIE. 17 and 19 of October, 2018

CS1800: More Counting. Professor Kevin Gold

CS 237: Probability in Computing

Discrete Structures for Computer Science

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

Counting. Chapter 6. With Question/Answer Animations

MAT3707. Tutorial letter 202/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/202/1/2017

Chapter 2. Permutations and Combinations

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

Topics to be covered

Elementary Combinatorics

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

Week 3-4: Permutations and Combinations

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Reading 14 : Counting

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

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

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

Sec. 4.2: Introducing Permutations and Factorial notation

Mathematical Foundations of Computer Science Lecture Outline August 30, 2018

Discrete mathematics

6.4 Permutations and Combinations

CISC-102 Fall 2017 Week 8

Permutations and Combinations. MATH 107: Finite Mathematics University of Louisville. March 3, 2014

Algebra. Recap: Elements of Set Theory.

Multiple Choice Questions for Review

Principle of Inclusion-Exclusion Notes

Foundations of Computing Discrete Mathematics Solutions to exercises for week 12

Section : Combinations and Permutations

CS1802 Week 3: Counting Next Week : QUIZ 1 (30 min)

The next several lectures will be concerned with probability theory. We will aim to make sense of statements such as the following:

Probability MAT230. Fall Discrete Mathematics. MAT230 (Discrete Math) Probability Fall / 37

Chapter 3 PRINCIPLE OF INCLUSION AND EXCLUSION

Permutations and Combinations

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count

MA 524 Midterm Solutions October 16, 2018

Jong C. Park Computer Science Division, KAIST

6.1 Basics of counting

1 Permutations. 1.1 Example 1. Lisa Yan CS 109 Combinatorics. Lecture Notes #2 June 27, 2018

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11

CPCS 222 Discrete Structures I Counting

Sec 5.1 The Basics of Counting

W = {Carrie (U)nderwood, Kelly (C)larkson, Chris (D)aughtry, Fantasia (B)arrino, and Clay (A)iken}

Probability and Counting Techniques

Counting in Algorithms

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

Permutations. Example 1. Lecture Notes #2 June 28, Will Monroe CS 109 Combinatorics

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

Math236 Discrete Maths with Applications

1 Permutations. Example 1. Lecture #2 Sept 26, Chris Piech CS 109 Combinatorics

STATISTICAL COUNTING TECHNIQUES

Combinatorics: The Fine Art of Counting

Chapter 5 - Elementary Probability Theory

Math 166: Topics in Contemporary Mathematics II

MAT 243 Final Exam SOLUTIONS, FORM A

Compound Probability. Set Theory. Basic Definitions

Problem Set 2. Counting

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

Chapter 1. Probability

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

Course Learning Outcomes for Unit V

Chapter 1. Probability

Combinatorics and Intuitive Probability

Chapter 3: Elements of Chance: Probability Methods

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

Math Steven Noble. November 22nd. Steven Noble Math 3790

The probability set-up

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

COUNTING AND PROBABILITY

Math 227 Elementary Statistics. Bluman 5 th edition

Staircase Rook Polynomials and Cayley s Game of Mousetrap

European Journal of Combinatorics. Staircase rook polynomials and Cayley s game of Mousetrap

Mat 344F challenge set #2 Solutions

Chapter 1. Set Theory

CHAPTER 8 Additional Probability Topics

Counting: Basics. Four main concepts this week 10/12/2016. Product rule Sum rule Inclusion-exclusion principle Pigeonhole principle

Contents 2.1 Basic Concepts of Probability Methods of Assigning Probabilities Principle of Counting - Permutation and Combination 39

Week 3 Classical Probability, Part I

Distinguishable Boxes

CHAPTER 9 - COUNTING PRINCIPLES AND PROBABILITY

Determine the number of permutations of n objects taken r at a time, where 0 # r # n. Holly Adams Bill Mathews Peter Prevc

Theory of Probability - Brett Bernstein

Solutions to Problem Set 7

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

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

Probability. Key Definitions

Counting and Probability Math 2320

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

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

Strings. A string is a list of symbols in a particular order.

CS 237 Fall 2018, Homework SOLUTION

CSC/MATA67 Tutorial, Week 12

9.5 Counting Subsets of a Set: Combinations. Answers for Test Yourself

Transcription:

Chapter 7. Intro to Counting 7.7 Counting by complement 7.8 Permutations with repetitions 7.9 Counting multisets 7.10 Assignment problems: Balls in bins 7.11 Inclusion-exclusion principle 7.12 Counting problem examples 1

7.7 Counting by complement Example: Assuming that a cell phone number is composed of area code: 3 digits, followed by the 7 digit number. How many different cell phone numbers are there that have at least one non-zero digit? 2

7.7 Counting by complement Example: Assuming that a cell phone number is composed of area code: 3 digits, followed by the 7 digit number. How many different cell phone numbers are there that have at least one non-zero digit? ( ) - Let P be the set of all cell phone numbers with at least one non-zero digit, Then P = the cell phone number with all zeros. 3

7.7 Counting by complement Example: Assuming that a cell phone number is composed of area code: 3 digits, followed by the 7 digit number. How many different cell phone numbers are there that have at least one non-zero digit? ( ) - Let P be the set of all cell phone numbers with at least one non-zero digit, Then P = the cell phone number with all zeros. P = 1 (0 0 0) 0 0 0-0 0 0 0 Therefore P = 9 10 1 = 3, 486, 784, 400 4

7.7 Counting by complement Counting by complement is a technique for counting the number of elements in a set S that have a property by counting the total number of elements in S and subtracting the number of elements in S that do not have the property. The principle of counting by complement can be written using set notation where P is the subset of elements in S that have the property. 5

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? 6

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords of length 6-8. Let P 6 denote the number of possible passwords of length 6, P 7 denote the number of possible passwords of length 7, and P 8 denote the number of possible passwords of length 8. 7

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, P 6 : (lower case letters, upper case letters, digits: 26+26+10 = 62) 62 62 62 62 62 62 = 62 6 P 7 denote the number of possible passwords of length 7, and P 8 denote the number of possible passwords of length 8. By the sum rule P = P 6 + P 7 + P 8. 8

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, 62 6 Recall restrictions: at least one digit and at least one character Therefore we need to exclude those cases when it is purely digits and purely characters: 10 6 and 52 6. Therefore, P 6 = 62 6-10 6-52 6 P 7 denote the number of possible passwords of length 7, and P 8 denote the number of possible passwords of length 8. By the sum rule P = P 6 + P 7 + P 8. 9

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, P 6 = 62 6-10 6-52 6 P 7 denote the number of possible passwords of length 7, and P 8 denote the number of possible passwords of length 8. By the sum rule P = P 6 + P 7 + P 8. 10

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, P 6 = 62 6-10 6-52 6 P 7 denote the number of possible passwords of length 7, and Similarly, P 7 = 62 7-10 7-52 7 P 8 denote the number of possible passwords of length 8. By the sum rule P = P 6 + P 7 + P 8. 11

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, P 6 = 62 6-10 6-52 6 P 7 denote the number of possible passwords of length 7, and Similarly, P 7 = 62 7-10 7-52 7 P 8 denote the number of possible passwords of length 8. P 8 = 62 8-10 8-52 8 By the sum rule P = P 6 + P 7 + P 8. 12

7.7 Counting by complement Example: Let's go back to the question about the password. consider the following requirements for a password for an e-mail account: should consist of six to eight characters. each of these characters must be a digit or a letter of the alphabet (lower case or upper case) each password must contain at least one digit and at least one character. How many passwords are there? Solution: Let P be the total number of possible passwords. Let P 6 denote the number of possible passwords of length 6, P 6 = 62 6-10 6-52 6 P 7 denote the number of possible passwords of length 7, and Similarly, P 7 = 62 7-10 7-52 7 P 8 denote the number of possible passwords of length 8. P 8 = 62 8-10 8-52 8 By the sum rule P = P 6 + P 7 + P 8 = 62 6-10 6 52 6 + 62 7-10 7-52 7 + 62 8-10 8-52 8 = 13

7.7 Counting by complement P = P 6 + P 7 + P 8 = 62 6-10 6 52 6 + 62 7-10 7-52 7 + 62 8-10 8-52 8 = 56 800 235 584 1 000 000 19 770 609 664 + 3 521 614 606 208 10 000 000 1 028 071 702 528 + 218 340 105 584 896 100 000 000 53 459 728 531 456 = 167 410 838 583 040 14

7.8 Permutations with repetitions Example: How many ways are there to scramble the letters in the word POLYNOMIAL? Keep in mind: permutations are ordered!

7.8 Permutations with repetitions Example: How many ways are there to scramble the letters in the word POLYNOMIAL? Keep in mind: permutations are ordered! There are 10 places to put 2 Os, then There are 8 places left to put 2 Ls, then There are 6 places left to put 1 P, then There are 5 places left to put 1 Y, then There are 4 places left to put 1 N, then There are 3 places left to put 1 M, then There are 2 places left to put 1 I, and finally There is 1 place left to put A

7.8 Permutations with repetitions Example: How many ways are there to scramble the letters in the word POLYNOMIAL? Keep in mind: permutations are ordered! There are 10 places to put 2 Os, then There are 8 places left to put 2 Ls, then There are 6 places left to put 1 P, then There are 5 places left to put 1 Y, then There are 4 places left to put 1 N, then There are 3 places left to put 1 M, then There are 2 places left to put 1 I, and finally There is 1 place left to put A ( 10 2 ) ( 8 2) ( 6 1) ( 5 1) ( 4 1) ( 3 1) ( 2 1) ( 1 1) = 10! 2!(10 2)! 8! 2!(8 2)! 6! 1!(6 1)! 5! 10! 4 3 2 1= 1!(5 1)! 2!2!

7.8 Permutations with repetitions Example: How many ways are there to scramble the letters in the word POLYNOMIAL? Keep in mind: permutations are ordered! There are 10 places to put 2 Os, then There are 8 places left to put 2 Ls, then There are 6 places left to put 1 P, then There are 5 places left to put 1 Y, then There are 4 places left to put 1 N, then There are 3 places left to put 1 M, then There are 2 places left to put 1 I, and finally There is 1 place left to put A ( 10 2 ) ( 8 2) ( 6 1) ( 5 1) ( 4 1) ( 3 1) ( 2 1) ( 1 1) = 10! 2!(10 2)! 8! 2!(8 2)! 6! 1!(6 1)! 5! 10! 4 3 2 1= 1!(5 1)! 2!2!

7.8 Permutations with repetitions Formula for counting permutations with repetition. The number of distinct sequences with n 1 1's, n 2 2's,..., n k k's, where n = n 1 + n 2 +...+ n k is n! n 1!n 2! n k!

7.9 Counting multisets A set is a collection of distinct items. A multiset is a collection that can have multiple instances of the same kind of item. Example: {1, 1, 1, 2, 3, 4, 4} is a multiset because it contains three 1's and two 4's. the order in which the elements are listed does not matter, so {1, 1, 1, 2, 3, 4, 4} is equal to {1, 2, 3, 1, 4, 1, 4}. Multisets are useful in modeling situations in which there are several varieties of objects and one can have multiple instances of the same variety.

7.9 Counting multisets Example: Suppose that a customer at Dunking Doughnuts is selecting a half-dozen doughnuts to buy. There are three varieties: glazed, Boston cream, and chocolate glazed. Doughnuts of the same variety are indistinguishable, so one chocolate glazed doughnut is the same as any other chocolate glazed doughnut. Moreover, there is a good supply of each kind, so the Dunking Doughnuts location is in no danger of running out of any of the varieties. How many ways are there to select a set of 6 doughnuts? An example of selection: 2 glazed, 2 Boston cream, 2 chocolate glazed - a multiset

7.9 Counting multisets Example: Suppose that a customer at Dunking Doughnuts is selecting a half-dozen doughnuts to buy. There are three varieties: glazed, Boston cream, and chocolate glazed. Doughnuts of the same variety are indistinguishable, so one chocolate glazed doughnut is the same as any other chocolate glazed doughnut. Moreover, there is a good supply of each kind, so the Dunking Doughnuts location is in no danger of running out of any of the varieties. How many ways are there to select a set of 6 doughnuts? An example of selection: 2 glazed, 2 Boston cream, 2 chocolate glazed - a multiset Let n be the number of object to select, m be the number of varieties. We are not limited on the number of each variety available and objects of the same variety are indistinguishable. Then the number of ways to select n objects from a set of m varieties is ( n+m 1 ) m 1 = (n+m 1)! (m 1)!(n+m 1 (m 1))! =(n+m 1)! (m 1)!n!

7.9 Counting multisets Example: Suppose that a customer at Dunking Doughnuts is selecting a half-dozen doughnuts to buy. There are three varieties: glazed, Boston cream, and chocolate glazed. Doughnuts of the same variety are indistinguishable, so one chocolate glazed doughnut is the same as any other chocolate glazed doughnut. Moreover, there is a good supply of each kind, so the Dunking Doughnuts location is in no danger of running out of any of the varieties. How many ways are there to select a set of 6 doughnuts? An example of selection: 2 glazed, 2 Boston cream, 2 chocolate glazed - a multiset ( n+m 1 m 1 ) = ( 6+3 1 3 1 ) =(6+3 1)! (3 1)!6! = 8! 2!6! =8 7 2 =28 ( n+m 1 ) m 1 = (n+m 1)! (m 1)!(n+m 1 (m 1))! =(n+m 1)! (m 1)!n!

7.9 Counting multisets Example: Suppose that 10 indistinguishable balls are to be placed into one of four bins. The bins are numbered, making them distinguishable. How many ways are there to place the balls in the bins? ( n+m 1 ) m 1 = (n+m 1)! (m 1)!(n+m 1 (m 1))! =(n+m 1)! (m 1)!n!

7.9 Counting multisets Example: Suppose that 10 indistinguishable balls are to be placed into one of four bins. The bins are numbered, making them distinguishable. How many ways are there to place the balls in the bins? balls: indistinguishable bins: distinguishable We will employ the same formula, where n = # of balls, m = # of bins ( n+m 1 ) m 1 = ( 10+4 1 4 1 ) =(10+4 1)! (4 1)!10! = 13! 3!10! =13 12 11 =286 3 2 ( n+m 1 ) m 1 = (n+m 1)! (m 1)!(n+m 1 (m 1))! =(n+m 1)! (m 1)!n!

7.10 Assignment problems: Balls in bins Many counting problems that ask about the number of ways to assign or distribute a set of items can be expressed abstractly by asking about the number of ways to place n balls into m different bins. In all the problems presented in this material, the bins are numbered, so placing a ball in bin 1 is considered different than placing a ball in bin 2. Some problems place different constraints on the number of balls that can be placed into the bins. Problems also vary according to whether the balls are all the same (indistinguishable) or all different (distinguishable). If the balls are different, they are numbered 1 through n, and which ball gets placed in which bin matters.

7.10 Assignment problems: Balls in bins Indistinguishable balls Distinguishable balls No restrictions (any positive m and n) ( n+m 1 At most one ball per bin (m must be at least n) m 1 ) ( n m) m n P(m,n) Same number of balls in each bin (m must evenly divide n) ( 1 n! m) (n/m)!

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle (subtraction principle) - suppose a task can be done in n 1 or in n 2 ways (but some of the set of n 1 ways to do the task are the same as some of the n 2 ways to do the task) 28

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle (subtraction principle) - suppose a task can be done in n 1 or in n 2 ways (but some of the set of n 1 ways to do the task are the same as some of the n 2 ways to do the task) - we cannot just add them up to count the number of ways to do the task (we'll get overcounting ) 29

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle (subtraction principle) - suppose a task can be done in n 1 or in n 2 ways (but some of the set of n 1 ways to do the task are the same as some of the n 2 ways to do the task) - we cannot just add them up to count the number of ways to do the task (we'll get overcounting ). n 1 +n 2 -(# of ways to do the task in a way that is both among the set of n 1 ways and n 2 ways) 30

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? 31

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 32

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 33

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 2. Let's count the ones that end with 11: 1 1 34

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 2. Let's count the ones that end with 11: 1 1 2 2 2 2 2 2 1 1 = 2 6 35

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 2. Let's count the ones that end with 11: 1 1 2 2 2 2 2 2 1 1 = 2 6 3. Let's count the ones that start with 1 and end with 11: 1 _ 1 1 36

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 2. Let's count the ones that end with 11: 1 1 2 2 2 2 2 2 1 1 = 2 6 3. Let's count the ones that start with 1 and end with 11: 1 _ 1 1 1 2 2 2 2 2 1 1 = 2 5 - these combinations are already included in the above two cases (therefore, we need to subtract them from the sum of the first two) 37

7.11 Inclusion-exclusion principle Example: How many bit strings of length eight that either start with a 1 bit or end with the two bits 11? Solution: 1. Let's count the ones that start with 1: 1 _ 1 2 2 2 2 2 2 2 = 2 7 2. Let's count the ones that end with 11: 1 1 2 2 2 2 2 2 1 1 = 2 6 3. Let's count the ones that start with 1 and end with 11: 1 _ 1 1 1 2 2 2 2 2 1 1 = 2 5 - these combinations are already included in the above two cases (therefore, we need to subtract them from the sum of the first two) Total: 2 7 + 2 6-2 5 = 128 + 64 32 = 160 38

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle n 1 +n 2 -(# of ways to do the task in a way that is both among the set of n 1 ways and n 2 ways) We can rephrase this counting principle in terms of sets. Let A 1 and A 2 be sets. 39

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle n 1 +n 2 -(# of ways to do the task in a way that is both among the set of n 1 ways and n 2 ways) We can rephrase this counting principle in terms of sets. Let A 1 and A 2 be sets. There are A 1 ways to select an element from A 1, and A 2 ways to select an element from A 2. A 1 U A 2 = A 1 + A 2 - A 1 A 2 40

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle n 1 +n 2 -(# of ways to do the task in a way that is both among the set of n 1 ways and n 2 ways) We can rephrase this counting principle in terms of sets. Let A 1 and A 2 be sets. There are A 1 ways to select an element from A 1, and A 2 ways to select an element from A 2. A 1 U A 2 = A 1 + A 2 - A 1 A 2 Example: Every student in a discrete mathematics class is either a computer science or a mathematics major or is a joint major in these two subjects. How many students are is the class if there are 38 computer science majoes (including joint majors), 23 mathematics majors (including joint majors), and 7 joint majors? 41

7.11 Inclusion-exclusion principle The Inclusion Exclusion Principle n 1 +n 2 -(# of ways to do the task in a way that is both among the set of n 1 ways and n 2 ways) We can rephrase this counting principle in terms of sets. Let A 1 and A 2 be sets. There are A 1 ways to select an element from A 1, and A 2 ways to select an element from A 2. A 1 U A 2 = A 1 + A 2 - A 1 A 2 Example: Every student in a discrete mathematics class is either a computer science or a mathematics major or is a joint major in these two subjects. How many students are is the class if there are 38 computer science majoes (including joint majors), 23 mathematics majors (including joint majors), and 7 joint majors? Answer: 38 + 23 7 = 54 42