38
Outline Sets An Algebra on Sets Summary Sets Alice E. Fischer CSCI 1166 Discrete Mathematics for Computing Spring, 2018 Alice E. Fischer Sets. . . 1/38

Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

Embed Size (px)

Citation preview

Page 1: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Sets

Alice E. Fischer

CSCI 1166 Discrete Mathematics for ComputingSpring, 2018

Alice E. Fischer Sets. . . 1/38

Page 2: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

1 SetsDefinitions and NotationVenn Diagrams

2 An Algebra on SetsSet OperationsIdentities: The Laws of Set Algebra

3 Summary

Alice E. Fischer Sets. . . 2/38

Page 3: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Sets

Definitions and NotationVenn Diagrams

Alice E. Fischer Sets. . . 3/38

Page 4: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Sets

Sets are basic to this course and to much of modern mathematics.A set is a collection of discrete objects.

A set can be empty.

It can contain one object or many objects.

It might be finite or infinite.

The objects in a set are called its elements.

The objects in a particular set all come from some collectionsuch as Students, or Polygons, or Integers.

That collection is called the universe of the set.

Letters (upper case) are used to name sets.

Alice E. Fischer Sets. . . 4/38

Page 5: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Notation for Sets

In the next several slides, integers are the universe of interest.

There are three ways to denote a set:

Some sets have standard names.Z is the set of all integers.

Sometimes, we define a set by listing its elements individually.A = {2, 3, 5, 7}A is the set of one-digit primes.

Sometimes we define a set by describing it:B = {x ∈ Z | x > 1}B is the set of all x contained in Z such that x > 1 .More simply, A is the set of all integers > 1 .

Alice E. Fischer Sets. . . 5/38

Page 6: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Notation for Subsets or Supersets

These examples refer to the sets defined on the previous slide.

A ⊆ BA is a subset of B because every element of A is also anelement of B.

A ⊂ BActually, A is a proper subset of B because there are elementsof B that are NOT in A.

B * AB is a NOT a subset of A because there are elements of Bthat are NOT in A.

We can also talk about supersets:B ⊇ A, B ⊃ A, and A + B

Alice E. Fischer Sets. . . 6/38

Page 7: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

The Empty Set

The empty set is called ∅.By definition, ∅ ⊂ every set, that is, ∅ is a proper subset ofevery set.

Alice E. Fischer Sets. . . 7/38

Page 8: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

The Universal Set

Any time a mathematician uses sets, the elements of those sets aresome particular kind of object: books or people or numbers oranything else.

If we are talking about sets of books, then Books is thedomain of concern.

The universal set is the set of all objects in the currentdomain of concern.

The universal set is called U.

U is a superset of every set.

Alice E. Fischer Sets. . . 8/38

Page 9: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Venn Diagrams

Venn diagrams are often used to represent sets and relationshipsamong sets.

Circles are used to represent sets.

The area inside the circle represents all of the elements of theset.

A dot inside the circle represents a particular element .

If two circles overlap, the overlapping area represents elementsthat are in both sets.

If B is a subset of A, then B’s circle is entirely within A’s circle

Alice E. Fischer Sets. . . 9/38

Page 10: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Relationships Between two Sets

A=BA B

BA

BA

Disjoint Subset

SameOverlapping

Alice E. Fischer Sets. . . 10/38

Page 11: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

The Transitive Property of Subsets

For all sets A, B, and C :

if A ⊆ B and B ⊆ Cthen A ⊆ C

C

A

B

Use the Venn diagram to prove this relationship.

Alice E. Fischer Sets. . . 11/38

Page 12: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Example: Reals, Rationals, and Integers

Z ⊂ Q ⊂ R

The integers (Z ) are a subset of the rational numbers (Q) andthe rationals are a subset of the reals (R).

R ZQ

U = All numbers

Alice E. Fischer Sets. . . 12/38

Page 13: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Definitions and NotationVenn Diagrams

Practice: Venn Diagrams

1. Diagram the Universal set, a set named M, and a propersubset of M named P.

2. Suppose A = {1, 2, 3}. Define D = any superset of A.

3. Diagram the sets A = {1,2,3}, B = {1,2,4,8}, U, and Z. Showthe elements of sets A and B, above, as points in the diagram.

4. Define two small, non-empty, disjoint sets named F and G.Choose any elements you want for these sets. Then diagramthem and the Universal set. Show all the set elements in yourdiagram.

Alice E. Fischer Sets. . . 13/38

Page 14: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

The Algebra of Sets

Set OperationsSet Identities

Rules for set calculations are given in the following slides.These are analogs of the laws for algebra.

They are easily proved using Venn diagrams.

Alice E. Fischer Sets. . . 14/38

Page 15: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

The Algebra of Sets.

The algebra of sets defines the properties and laws of sets, theset operations or, and, and complement, and the relations ofset equality and set inclusion.

It provides systematic procedures for evaluating expressionsand performing calculations involving these operations andrelations.

Alice E. Fischer Sets. . . 15/38

Page 16: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Set algebra is analogous to the algebra of numbers.

Addition + is associative and commutative, so is ∪ (union) .

Multiplication × is associative and commutative, so is ∩(intersection) .

The relation ≤ is reflexive, antisymmetric and transitive, andso is the relation ⊂ .

Alice E. Fischer Sets. . . 16/38

Page 17: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Set Algebra

Set algebra is based on:

The operations ∪ (union), ∩ (intersection), − (set difference),and complement.

The relations ∈ (contained in), ⊆ (subset), and ⊂ (propersubset).

A list of algebraic identities that can be easily proved from thedefinitions using Venn diagrams.

Two special sets that have been given names:The empty set is ∅The universal set is U.

Alice E. Fischer Sets. . . 17/38

Page 18: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Complement

The complement of a set B (Bc) is a set containing all elements ofthe universe that are not in B. In this diagram, Bc is gray.

BUniverse

Alice E. Fischer Sets. . . 18/38

Page 19: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Union

The union of two sets is a set containing all elements of both.Below, A ∪ B (the union of A and B) is the areas colored pink,lavender, and blue, but not the area colored gray.

A B

Universe

Theorem

For all sets A and B, A ⊆ (A ∪ B) and B ⊆ (A ∪ B)

Proof by the diagram:All points in A and in B are in the union (the non-gray area).

Alice E. Fischer Sets. . . 19/38

Page 20: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Intersection

The intersection of two sets contains only the elements that occurin both. In the diagram, the intersection, A ∩ B is the purple area.

A B

Universe

Theorem

For all sets A and B, A ∩ B ⊆ A and A ∩ B ⊆ B

Proof by the diagram:All points in the intersection (purple) are in both A and B.

Alice E. Fischer Sets. . . 20/38

Page 21: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Difference

The difference of two sets is a set containing all the remainingelements of the first, after all elements of the second set have beenremoved. In the diagram,

A− B is just the pink areaB − A is just the blue area.

A B

Universe

Alice E. Fischer Sets. . . 21/38

Page 22: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

1. Commutative Laws

Both intersection and union are commutative.That is, the left and right sides can be reversed without changingthe meaning of the expression.

A ∩ B ≡ B ∩ A

A ∪ B ≡ B ∪ A

A

B

UA

B

UU

Alice E. Fischer Sets. . . 22/38

Page 23: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

2. Associative Laws

Both intersection and union are associative.That is, if the same operator occurs twice in a row in anexpression, you may parenthesize the expression either way withoutchanging its meaning.

(P ∩ Q) ∩ R ≡ P ∩ (Q ∩ R)

(P ∪ Q) ∪ R ≡ P ∪ (Q ∪ R)

P

Q

UP

Q

U

R

Q

U

RI I I

Alice E. Fischer Sets. . . 23/38

Page 24: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

3a. Distributive Law for ∩Intersection can be distributed over the union.

P ∩ (Q ∪ R) ≡ (P ∩ Q) ∪ (P ∩ R)

P

Q

R*

*

** R

Q

*

P*

*

P Q U R P (Q U R)U

Q

P

*

P QU

R

P*

P RU (P Q)U (P R)UU

R

P

***

Alice E. Fischer Sets. . . 24/38

Page 25: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

3b. Distributive Law for ∪Union can be distributed over Intersection.

P ∪ (Q ∩ R) ≡ (P ∪ Q) ∩ (P ∪ R)

P

Q

R** R

Q

*

P*

*

P

P U R

P U (Q R)U

Q

P

*

P U Q U

R

P*

Q RU

(P U Q) (P U R)

R

P

***

*

*

*

**

*

*

*Q

R

Alice E. Fischer Sets. . . 25/38

Page 26: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

4. Identity, 5. Complement, and 6. Double Complement

These laws are based on the definitions of complement, ∩, ∪.Remember: ∅ is the empty set and U is the universal set.

4. Set identity.

A ∪ ∅ ≡ AA ∩ U ≡ A

5. Set complement.

A ∪ Ac ≡ U

A ∩ Ac ≡ ∅

6. Set double-complement.

(Ac)c ≡ A

Alice E. Fischer Sets. . . 26/38

Page 27: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

7. Idempotent Law

Intuition: able to produce the same thing repeatedly.

A binary operation is idempotent if, whenever it is applied to twoequal sets, it gives that same set as the result.

Law: intersection and union are idempotent, meaning that thetrivial computations have no effect and can be repeated withoutchanging the meaning of the expression.

A ∪ A ≡ A

A ∩ A ≡ A

Alice E. Fischer Sets. . . 27/38

Page 28: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

8. Universal Bounds Law

Intuition: The universal set is as large as you can get.

Law: The universal set is the result of any ∪ with U.

A ∪ U ≡ U

Intuition: The empty set is as small as you can get.

Law: The empty set is the result of any ∩ with ∅.

A ∩ ∅ ≡ ∅

Alice E. Fischer Sets. . . 28/38

Page 29: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

9a. DeMorgan’s Law for ∪

When you distribute complement over ∪, the ∪ changes to ∩.

(A ∪ B)c ≡ Ac ∩ Bc

Proof by diagram:

By definition, A ∪ B is the pink andpurple and blue areas taken together.

Let V = A∪B. Then V c is the gray area.

Ac = the combo of gray and blue areas.

Bc= the combo of gray and pink areas.

Ac ∩ Bc is only the gray area.

∴ Ac ∩ Bc ≡ V c ≡ (A ∪ B)c .

A

B

U

Alice E. Fischer Sets. . . 29/38

Page 30: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

9b. DeMorgan’s Law for ∩

When you distribute complement over ∩, the ∩ changes to ∪.

(A ∩ B)c ≡ Ac ∪ Bc

The proof is left for the student. It is analogous to the proof onthe prior slide.

Alice E. Fischer Sets. . . 30/38

Page 31: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

10. Absorption Laws and 11. Complements of U and ∅Absorption Laws: For all sets A and B,

A ∪ (A ∩ B) ≡ A

A ∩ (A ∪ B) ≡ A

A

B

U

The complement of the Universe is empty, and vice versa.

Uc ≡ ∅∅c ≡ U

Alice E. Fischer Sets. . . 31/38

Page 32: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

12. Set Difference Law.

Theorem

For all sets A and B, A− B ≡ A ∩ Bc

Proof by diagram:

A− B is the pink area, by definition.

Bc is everything in the universe exceptthe elements of B.

∴ Bc is the area that is gray or pink.Bc excludes the purple and blue parts.

A ∩ Bc is the pink part excluding thelavender part.

∴ A ∩ Bc is the same as A− B.

A

B

U

Alice E. Fischer Sets. . . 32/38

Page 33: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set OperationsIdentities: The Laws of Set Algebra

Practice: Using the Laws of Set Theory

For each exercise, give the answer and the name of the laws ordefinitions that are used to answer the question.

5. If A ⊆ B and B ⊂ C , What can you say about A and C?

6. Assume A ⊂ B ∩ C . What can you say about A and C?

7. Let A = {1, 2, 3, 4} and B = {1, 2}. Then A ∪ (A ∩ B) = ?

8. Let Z be the universal set and let E = {even numbers}. Listfive elements of E c .

Alice E. Fischer Sets. . . 33/38

Page 34: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Summary

Alice E. Fischer Sets. . . 34/38

Page 35: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Sets

1 A set is a collection of discrete objects drawn from a specifieduniverse.

2 Sets are a basic concept on which much of modern math anddatabases are based.

3 A finite set can be literally listed, by writing its elementsenclosed in curly braces.

4 A set can be denoted by giving a way to compute the set.

5 A set can be denoted by a name.

Alice E. Fischer Sets. . . 35/38

Page 36: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Set Notation

proper subset ⊂ set union ∪subset ⊆ set intersection ∩is an element of ∈ set difference −universal set U complement of a set Ac

the empty set ∅

Alice E. Fischer Sets. . . 36/38

Page 37: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Laws of Set Algebra -1

1. Commutative Laws A ∩ B ≡ B ∩ AA ∪ B ≡ B ∪ A

2. Associative Laws (P ∩ Q) ∩ R ≡ P ∩ (Q ∩ R)(P ∪ Q) ∪ R ≡ P ∪ (Q ∪ R)

3. Distributive Laws P ∩ (Q ∪ R) ≡ (P ∩ Q) ∪ (P ∩ R)P ∪ (Q ∩ R) ≡ (P ∪ Q) ∩ (P ∪ R)

4. Identity Laws A ∪ ∅ ≡ AA ∩ U ≡ A

5. Complement Laws A ∪ Ac ≡ UA ∩ Ac ≡ ∅

6. Double Complement Law (Ac)c ≡ A

Alice E. Fischer Sets. . . 37/38

Page 38: Sets - University of New Haveneliza.newhaven.edu/discrete/attach/L2-Sets.pdfThedi erenceof two sets is a set containing all the remaining elements of the rst, after all elements of

OutlineSets

An Algebra on SetsSummary

Laws of Set Algebra -2

7. Idempotent Laws A ∪ A ≡ AA ∩ A ≡ A

8. Universal Bounds A ∩ ∅ ≡ ∅A ∪ U ≡ U

9. DeMorgan’s Laws (A ∪ B)c ≡ Ac ∩ Bc

(A ∩ B)c ≡ Ac ∪ Bc

10. Absorption Laws A ∪ (A ∩ B) ≡ AA ∩ (A ∪ B) ≡ A

11. Complement Laws Uc ≡ ∅∅c ≡ U

12. Set Difference Law A− B ≡ A ∩ Bc

Alice E. Fischer Sets. . . 38/38