1 / 13

# Counting Elements of Disjoint Sets: The Addition Rule - PowerPoint PPT Presentation

Counting Elements of Disjoint Sets: The Addition Rule. Lecture 30 Sections 6.3 Tue, Mar 20, 2007. Example: Inclusion/Exclusion. How many primes are there between 1 and 100? The non-primes must be multiples of 2, 3, 5, or 7, since the square root of 100 is 10. A Lemma.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Counting Elements of Disjoint Sets: The Addition Rule' - ryder-watts

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Counting Elements of Disjoint Sets: The Addition Rule

Lecture 30

Sections 6.3

Tue, Mar 20, 2007

• How many primes are there between 1 and 100?

• The non-primes must be multiples of 2, 3, 5, or 7, since the square root of 100 is 10.

• Lemma: Let n and d be positive integers. There are n/d multiples of d between 1 and n, where x represents the “floor” of x.

• Let A = {n | 1 n 100 and 2 divides n}.

• Let B = {n | 1 n 100 and 3 divides n}.

• Let C = {n | 1 n 100 and 5 divides n}.

• Let D = {n | 1 n 100 and 7 divides n}.

• By the Inclusion/Exclusion Rule,

|ABCD|

= |A| + |B| + |C| + |D|

– |A B| – |A C| – |A D|

– |B C| – |B D| – |C D|

+ |A B C| + |A B C|

+ |A B C| + |A B C|

– |A B C  D|.

• However,

• A B = {n | 1 n 100 and 6 | n}.

• A B C = {n | 1 n 100 and 30 | n}.

• B C D = {n | 1 n 100 and 105 | n}.

• And so on.

• Therefore,

• |A| = 100/2 = 50.

• |A B| = 100/6 = 16.

• |A B C| = 100/30 = 3.

• |B C D| = 100/105 = 0.

• And so on.

• The number of multiples of 2, 3, 5, and 7 is

(50 + 33 + 20 + 14) – (16 + 10 + 7 + 6 + 4 + 2) + (3 + 2 + 1 + 0) – (0)

= 78

• This count includes 2, 3, 5, 7, which are prime.

• This count does not include 1, which is not prime.

• Therefore, the number of primes is

100 – 78 + 4 – 1 = 25.

• Primes.cpp

• How many integers from 1 to 1000 are multiples of 6, 10, or 15?

• Let A = {n | 1 n 100 and 6 divides n}.

• Let B = {n | 1 n 100 and 10 divides n}.

• Let C = {n | 1 n 100 and 15 divides n}.

• What is A B? A C? B C?

• What is A B C?

• |A| = 1000/6 = 166.

• |B| = 1000/10 = 100.

• |C| = 1000/15 = 66.

• |A B| = 1000/30 = 33.

• |A C| = 1000/30 = 33.

• |B C| = 1000/30 = 33.

• |A B C| = 1000/30 = 33.

• Therefore, 266 numbers from 1 to 1000 are multiples of 6, 10, or 15.

• How many 8-bit numbers have either

• 1 in the 1st and 2nd positions, or

• 1 in the 1st and 3rd positions, or

• 1 in the 2nd, 3rd, and 4th positions?