92
Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Sets

Prof. Susan Older

15 September 2016

(CIS 375) Sets 15 Sept 2016 1 / 18

Page 2: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

This Lecture Brought to You by the Symbols (, ), { and }

Some common delimiters

( and ) are parentheses (sometimes informally called parens).

{ and } are braces (sometimes called curly braces).

[ and ] are brackets (sometimes called square brackets).

They are not interchangeable:

Parentheses are used for ordered tuples, such as pairs, triples, etc.

Braces are used for sets.

Brackets are used for multiple purposes, but not for ordered tuples orsets.

(CIS 375) Sets 15 Sept 2016 2 / 18

Page 3: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

This Lecture Brought to You by the Symbols (, ), { and }

Some common delimiters

( and ) are parentheses (sometimes informally called parens).

{ and } are braces (sometimes called curly braces).

[ and ] are brackets (sometimes called square brackets).

They are not interchangeable:

Parentheses are used for ordered tuples, such as pairs, triples, etc.

Braces are used for sets.

Brackets are used for multiple purposes, but not for ordered tuples orsets.

(CIS 375) Sets 15 Sept 2016 2 / 18

Page 4: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

This Lecture Brought to You by the Symbols (, ), { and }

Some common delimiters

( and ) are parentheses (sometimes informally called parens).

{ and } are braces (sometimes called curly braces).

[ and ] are brackets (sometimes called square brackets).

They are not interchangeable:

Parentheses are used for ordered tuples, such as pairs, triples, etc.

Braces are used for sets.

Brackets are used for multiple purposes, but not for ordered tuples orsets.

(CIS 375) Sets 15 Sept 2016 2 / 18

Page 5: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

This Lecture Brought to You by the Symbols (, ), { and }

Some common delimiters

( and ) are parentheses (sometimes informally called parens).

{ and } are braces (sometimes called curly braces).

[ and ] are brackets (sometimes called square brackets).

They are not interchangeable:

Parentheses are used for ordered tuples, such as pairs, triples, etc.

Braces are used for sets.

Brackets are used for multiple purposes, but not for ordered tuples orsets.

(CIS 375) Sets 15 Sept 2016 2 / 18

Page 6: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

This Lecture Brought to You by the Symbols (, ), { and }

Some common delimiters

( and ) are parentheses (sometimes informally called parens).

{ and } are braces (sometimes called curly braces).

[ and ] are brackets (sometimes called square brackets).

They are not interchangeable:

Parentheses are used for ordered tuples, such as pairs, triples, etc.

Braces are used for sets.

Brackets are used for multiple purposes, but not for ordered tuples orsets.

(CIS 375) Sets 15 Sept 2016 2 / 18

Page 7: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 8: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 9: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 10: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 11: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ Z

R, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 12: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 13: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

The Basics of Sets

Definition

A set is an unordered collection of objects.

The objects in a set are called its elements (or members).

We write x ∈ A to indicate that x is an element of set A.

We write x 6∈ A to indicate that x is not an element of set A.

Some very common sets:

Z, the set of integers1 ∈ Z −5 ∈ Z 2.1 6∈ ZR, the set of real numbers−5 ∈ R 2.1 ∈ R

√3 ∈ R

√−1 6∈ R

∅, the empty set (also written as: {})The set that contains no elements

(CIS 375) Sets 15 Sept 2016 3 / 18

Page 14: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Ways of Expressing Sets

List notation: between braces, explicitly list all elements of set

{1, 4, 5, 10, 17}{red, green, blue}

Order of elements doesn’t matter.

Duplicate entries don’t matter.

Set-builder notation: describe properties of all elements

{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”

{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”

Note: You’ll often see variations in this notation, such as:

{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”

{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)

(CIS 375) Sets 15 Sept 2016 4 / 18

Page 15: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Ways of Expressing Sets

List notation: between braces, explicitly list all elements of set

{1, 4, 5, 10, 17}{red, green, blue}

Order of elements doesn’t matter.

Duplicate entries don’t matter.

Set-builder notation: describe properties of all elements

{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”

{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”

Note: You’ll often see variations in this notation, such as:

{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”

{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)

(CIS 375) Sets 15 Sept 2016 4 / 18

Page 16: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Ways of Expressing Sets

List notation: between braces, explicitly list all elements of set

{1, 4, 5, 10, 17}{red, green, blue}

Order of elements doesn’t matter.

Duplicate entries don’t matter.

Set-builder notation: describe properties of all elements

{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”

{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”

Note: You’ll often see variations in this notation, such as:

{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”

{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)

(CIS 375) Sets 15 Sept 2016 4 / 18

Page 17: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Ways of Expressing Sets

List notation: between braces, explicitly list all elements of set

{1, 4, 5, 10, 17}{red, green, blue}

Order of elements doesn’t matter.

Duplicate entries don’t matter.

Set-builder notation: describe properties of all elements

{y : y ∈ Z and y ≤ 100}“The set of those y such that y is in set Z and y ≤ 100”

{x : x ∈ R and x3 = x}“The set of those x such that x is in set R and x3 = x”

Note: You’ll often see variations in this notation, such as:

{y ∈ Z : y ≤ 100}“The set of those y in Z such that y ≤ 100”

{2x + 1 : x ∈ Z}“The set of those numbers 2x + 1 such that x ∈ Z” (aka odd integers)

(CIS 375) Sets 15 Sept 2016 4 / 18

Page 18: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Know Thy Sets

Z: set of integers

Z+: set of positive integers

Z−: set of negative integers

N: set of natural numbers

R: set of real numbers

Q: set of rational numbers

Z+ = {n ∈ Z : n > 0}Z− = {n ∈ Z : n < 0}N = {n ∈ Z : n ≥ 0}

Q = {x ∈ R : there are p, q ∈ Z such that x =p

q}

(CIS 375) Sets 15 Sept 2016 5 / 18

Page 19: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Quick Quiz

What are these sets?

One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}

Three = {x ∈ Two : x < 0}

Answers

One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}

Three = {}

(CIS 375) Sets 15 Sept 2016 6 / 18

Page 20: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Quick Quiz

What are these sets?

One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}

Three = {x ∈ Two : x < 0}

Answers

One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

Two = {0, 2, 4, 6, 8}Three = {}

(CIS 375) Sets 15 Sept 2016 6 / 18

Page 21: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Quick Quiz

What are these sets?

One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}

Three = {x ∈ Two : x < 0}

Answers

One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}

Three = {}

(CIS 375) Sets 15 Sept 2016 6 / 18

Page 22: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Quick Quiz

What are these sets?

One = {y ∈ N : y < 10}Two = {w ∈ One : w is even}

Three = {x ∈ Two : x < 0}

Answers

One = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}Two = {0, 2, 4, 6, 8}

Three = {}

(CIS 375) Sets 15 Sept 2016 6 / 18

Page 23: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 24: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 25: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}|

= 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 26: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 27: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}|

= 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 28: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 29: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}|

= 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 30: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 31: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}|

= 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 32: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 33: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}|

= 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 34: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 35: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}|

= 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 36: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 37: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}|

= 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 38: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Cardinality

Definition

The cardinality of a set A (written |A|) is the number of elements in A.

Set A is finite provided that |A| is an integer; otherwise, the set is infinite.

Let’s practice:

|{1, 8, 5, 3}| = 4

|{1, 8, 1, 5, 3}| = 4

|{y ∈ N : y < 10}| = 10

|{}| = 0

|{{}}| = 1

|{1, {8, 5}, {3}}| = 3

|{1, {2, 6, {7, 9}}, {3, 2}, {{5, 4}}}| = 4

(CIS 375) Sets 15 Sept 2016 7 / 18

Page 39: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 40: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5}

= {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 41: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}

{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 42: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}

{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 43: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}

{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 44: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Set Equality

Definition

Sets A and B are equal (written A = B) provided that they have exactlythe same elements.

Example

{1, 3, 5, 8} = {3, 8, 1, 5} = {3, 5, 1, 3, 8}{x ∈ N : x is odd, x < 5} = {1, 3}{y + 1 : y ∈ N, y is even, y < 4} = {1, 3}{x ∈ N : x is odd, x < 5} = {y + 1 : y ∈ N, y is even, y < 4}

(CIS 375) Sets 15 Sept 2016 8 / 18

Page 45: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 46: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 47: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 48: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 49: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 50: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 51: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 52: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 53: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 54: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 55: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ Z

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 56: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ ZZ 6⊆ N

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 57: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

We write A 6⊆ B to indicate that A is not a subset of B.

Example

{1, 3} ⊆ {1, 2, 3, 4}{1, 2, 3, 4} 6⊆ {1, 3}{1, 5} 6⊆ {1, 2, 3, 4}{1, 4} ⊆ {1, 4}N ⊆ ZZ 6⊆ NZ ⊆ R

(CIS 375) Sets 15 Sept 2016 9 / 18

Page 58: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

More About Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

A simple fact

Let S be a set. Then:

(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)

(ii) S ⊆ S (every element of S is indeed an element of S)

What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}

Fact (we’ll prove it later this semester)

Let A be a finite set. Then A has exactly 2|A| subsets.

(CIS 375) Sets 15 Sept 2016 10 / 18

Page 59: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

More About Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

A simple fact

Let S be a set. Then:

(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)

(ii) S ⊆ S (every element of S is indeed an element of S)

What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}

Fact (we’ll prove it later this semester)

Let A be a finite set. Then A has exactly 2|A| subsets.

(CIS 375) Sets 15 Sept 2016 10 / 18

Page 60: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

More About Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

A simple fact

Let S be a set. Then:

(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)

(ii) S ⊆ S (every element of S is indeed an element of S)

What are the subsets of {3, 5, 8}?

∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}

Fact (we’ll prove it later this semester)

Let A be a finite set. Then A has exactly 2|A| subsets.

(CIS 375) Sets 15 Sept 2016 10 / 18

Page 61: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

More About Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

A simple fact

Let S be a set. Then:

(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)

(ii) S ⊆ S (every element of S is indeed an element of S)

What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}

Fact (we’ll prove it later this semester)

Let A be a finite set. Then A has exactly 2|A| subsets.

(CIS 375) Sets 15 Sept 2016 10 / 18

Page 62: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

More About Subsets

Definition

Let A and B be sets. A is a subset of B (written A ⊆ B) provided that:

every element of A is also an element of B.

A simple fact

Let S be a set. Then:

(i) ∅ ⊆ S (there is no x such that x ∈ ∅ and x 6∈ S)

(ii) S ⊆ S (every element of S is indeed an element of S)

What are the subsets of {3, 5, 8}?∅ {3} {5} {8} {3, 5} {5, 8} {3, 8} {3, 5, 8}

Fact (we’ll prove it later this semester)

Let A be a finite set. Then A has exactly 2|A| subsets.

(CIS 375) Sets 15 Sept 2016 10 / 18

Page 63: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Powersets

Definition

Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:

2A = {S : S ⊆ A}.

Example

The powerset of {3, 5, 8} is:

2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}

Corollary of previous fact:

For any set finite A, |2A| = 2|A|.

That is, if A has n elements, then A’s powerset has 2n elements.

(CIS 375) Sets 15 Sept 2016 11 / 18

Page 64: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Powersets

Definition

Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:

2A = {S : S ⊆ A}.

Example

The powerset of {3, 5, 8} is:

2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}

Corollary of previous fact:

For any set finite A, |2A| = 2|A|.

That is, if A has n elements, then A’s powerset has 2n elements.

(CIS 375) Sets 15 Sept 2016 11 / 18

Page 65: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Powersets

Definition

Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:

2A = {S : S ⊆ A}.

Example

The powerset of {3, 5, 8} is:

2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}

Corollary of previous fact:

For any set finite A, |2A| = 2|A|.

That is, if A has n elements, then A’s powerset has 2n elements.

(CIS 375) Sets 15 Sept 2016 11 / 18

Page 66: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Powersets

Definition

Let A be a set. The power set of A (written 2A in our text, often P(A)elsewhere) is the set whose elements are the subsets of A:

2A = {S : S ⊆ A}.

Example

The powerset of {3, 5, 8} is:

2{3,5,8} = {∅, {3}, {5}, {8}, {3, 5}, {5, 8}, {3, 8}, {3, 5, 8}}

Corollary of previous fact:

For any set finite A, |2A| = 2|A|.

That is, if A has n elements, then A’s powerset has 2n elements.

(CIS 375) Sets 15 Sept 2016 11 / 18

Page 67: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Recap: ∈ versus ⊆

Membership: X ∈ S

S is a set, and X is one of the elements of S

Subset: X ⊆ S

X and S are sets, and every element of X is an element of S

Powerset membership: X ∈ 2S

X and S are sets, and X ⊆ S

(CIS 375) Sets 15 Sept 2016 12 / 18

Page 68: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Recap: ∈ versus ⊆

Membership: X ∈ S

S is a set, and X is one of the elements of S

Subset: X ⊆ S

X and S are sets, and every element of X is an element of S

Powerset membership: X ∈ 2S

X and S are sets, and X ⊆ S

(CIS 375) Sets 15 Sept 2016 12 / 18

Page 69: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Recap: ∈ versus ⊆

Membership: X ∈ S

S is a set, and X is one of the elements of S

Subset: X ⊆ S

X and S are sets, and every element of X is an element of S

Powerset membership: X ∈ 2S

X and S are sets, and X ⊆ S

(CIS 375) Sets 15 Sept 2016 12 / 18

Page 70: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Union

Definition

Let A and B be sets. The union of A and B is the set

A ∪ B = {x : x ∈ A or x ∈ B}.

A B

Example

{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 13 / 18

Page 71: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Union

Definition

Let A and B be sets. The union of A and B is the set

A ∪ B = {x : x ∈ A or x ∈ B}.

A B

Example

{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 13 / 18

Page 72: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Union

Definition

Let A and B be sets. The union of A and B is the set

A ∪ B = {x : x ∈ A or x ∈ B}.

A B

Example

{1, 2, 3} ∪ {2, 4, 6} = {1, 2, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 13 / 18

Page 73: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Intersection

Definition

Let A and B be sets. The intersection of A and B is the set

A ∩ B = {x : x ∈ A and x ∈ B}.

A B

Example

{1, 2, 3} ∩ {2, 4, 6} = {2}

(CIS 375) Sets 15 Sept 2016 14 / 18

Page 74: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Intersection

Definition

Let A and B be sets. The intersection of A and B is the set

A ∩ B = {x : x ∈ A and x ∈ B}.

A B

Example

{1, 2, 3} ∩ {2, 4, 6} = {2}

(CIS 375) Sets 15 Sept 2016 14 / 18

Page 75: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Intersection

Definition

Let A and B be sets. The intersection of A and B is the set

A ∩ B = {x : x ∈ A and x ∈ B}.

A B

Example

{1, 2, 3} ∩ {2, 4, 6} = {2}

(CIS 375) Sets 15 Sept 2016 14 / 18

Page 76: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Set Difference

Definition

Let A and B be sets. The set difference of A and B is the set

A− B = {x : x ∈ A and x 6∈ B}.

A B

Example

{1, 2, 3} − {2, 4, 6} = {1, 3}

(CIS 375) Sets 15 Sept 2016 15 / 18

Page 77: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Set Difference

Definition

Let A and B be sets. The set difference of A and B is the set

A− B = {x : x ∈ A and x 6∈ B}.

A B

Example

{1, 2, 3} − {2, 4, 6} = {1, 3}

(CIS 375) Sets 15 Sept 2016 15 / 18

Page 78: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Set Difference

Definition

Let A and B be sets. The set difference of A and B is the set

A− B = {x : x ∈ A and x 6∈ B}.

A B

Example

{1, 2, 3} − {2, 4, 6} = {1, 3}

(CIS 375) Sets 15 Sept 2016 15 / 18

Page 79: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Symmetric Difference

Definition

Let A and B be sets. The symmetric difference of A and B is the set

A4B = {x : x ∈ A− B or x ∈ B − A}.

A B

Example

{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 16 / 18

Page 80: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Symmetric Difference

Definition

Let A and B be sets. The symmetric difference of A and B is the set

A4B = {x : x ∈ A− B or x ∈ B − A}.

A B

Example

{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 16 / 18

Page 81: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Symmetric Difference

Definition

Let A and B be sets. The symmetric difference of A and B is the set

A4B = {x : x ∈ A− B or x ∈ B − A}.

A B

Example

{1, 2, 3}4{2, 4, 6} = {1, 3, 4, 6}

(CIS 375) Sets 15 Sept 2016 16 / 18

Page 82: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 83: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 84: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 85: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 86: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 87: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Creating New Sets from Old: Cartesian Product

Definition

Let A and B be sets. The Cartesian product of A and B is the set

A× B = {(x , y) : x ∈ A and y ∈ B}.

Example

{1, 2} × {2, 4, 6} = { (1, 2), (1, 4), (1, 6), (2, 2), (2, 4), (2, 6) }

Be aware!

(1, 2) is an ordered pair, whereas {1, 2} is a set.

(1, 2) is not the same as (2, 1): order matters for pairs/tuples.

{1, 2} is the same as {2, 1}: order does not matter for sets.

(CIS 375) Sets 15 Sept 2016 17 / 18

Page 88: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Summary of Set Operations

A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}

Fact

Suppose A and B are finite sets. Then:

|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.

(CIS 375) Sets 15 Sept 2016 18 / 18

Page 89: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Summary of Set Operations

A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}

Fact

Suppose A and B are finite sets. Then:

|A ∪ B| = |A|+ |B| − |A ∩ B|

|A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.

(CIS 375) Sets 15 Sept 2016 18 / 18

Page 90: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Summary of Set Operations

A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}

Fact

Suppose A and B are finite sets. Then:

|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B|

|A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.

(CIS 375) Sets 15 Sept 2016 18 / 18

Page 91: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Summary of Set Operations

A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}

Fact

Suppose A and B are finite sets. Then:

|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|

If A ⊆ B, then |A| ≤ |B|.

(CIS 375) Sets 15 Sept 2016 18 / 18

Page 92: Sets - cis.syr.edusueo/cis375/lectures/sets-slides.pdf · Sets Prof. Susan Older 15 September 2016 (CIS 375) Sets 15 Sept 2016 1 / 18

Summary of Set Operations

A ∪ B = {x : x ∈ A or x ∈ B}A ∩ B = {x : x ∈ A and x ∈ B}A− B = {x : x ∈ A and x 6∈ B}A4B = {x : x ∈ A− B or x ∈ B − A}A× B = {(x , y) : x ∈ A and y ∈ B}

Fact

Suppose A and B are finite sets. Then:

|A ∪ B| = |A|+ |B| − |A ∩ B||A− B| = |A| − |A ∩ B||A× B| = |A| · |B|If A ⊆ B, then |A| ≤ |B|.

(CIS 375) Sets 15 Sept 2016 18 / 18