- By
**lara** - Follow User

- 79 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' CS 173: Discrete Mathematical Structures' - lara

**An Image/Link below is provided (as is) to download presentation**

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

- I’ve read it.
- 25% done
- 50% done
- 75% done

- Homework 2 returned this week.
- Homework 3 available. Due 09/16.
- LaTex workshop Th, 9/15, at 6:30p in SC 2405.
- The following reflects my status on hwk #3…

Cs173 - Spring 2004

|S| = 1.

|S| = 0.

|S| = 3.

CS 173 Set Theory - CardinalityIf S is finite, then the cardinality of S, |S|, is the number of distinct elements in S.

If S = {1,2,3},

If S = {3,3,3,3,3},

If S = ,

If S = { , {}, {,{}} },

If S = {0,1,2,3,…}, |S| is infinite. (more on this later)

Cs173 - Spring 2004

We say, “P(S) is the set of all subsets of S.”

2S = {, {a}}.

2S = {, {a}, {b}, {a,b}}.

2S = {}.

2S = {, {}, {{}}, {,{}}}.

CS 173 Set Theory - Power setsIf S is a set, then the power set of S is

2S = { x : x S }.

If S = {a},

If S = {a,b},

If S = ,

If S = {,{}},

Fact: if S is finite, |2S| = 2|S|. (if |S| = n, |2S| = 2n)

Cs173 - Spring 2004

We’ll use these special sets soon!

AxB

|A|+|B|

|A+B|

|A||B|

CS 173 Set Theory - Cartesian ProductThe Cartesian Product of two sets A and B is:

A x B = { <a,b> : a A b B}

If A = {Charlie, Lucy, Linus}, and B = {Brown, VanPelt}, then

A x B = {<Charlie, Brown>, <Lucy, Brown>, <Linus, Brown>, <Charlie, VanPelt>, <Lucy, VanPelt>, <Linus, VanPelt>}

A1 x A2 x … x An = {<a1, a2,…, an>: a1 A1, a2 A2, …, an An}

Cs173 - Spring 2004

A

CS 173 Set Theory - OperatorsThe union of two sets A and B is:

A B = { x : x A v x B}

If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then

A B = {Charlie, Lucy, Linus, Desi}

Cs173 - Spring 2004

A

CS 173 Set Theory - OperatorsThe intersection of two sets A and B is:

A B = { x : x A x B}

If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then

A B = {Lucy}

Cs173 - Spring 2004

CS 173 Set Theory - Operators

The intersection of two sets A and B is:

A B = { x : x A x B}

If A = {x : x is a US president}, and B = {x : x is deceased}, then

A B = {x : x is a deceased US president}

B

A

Cs173 - Spring 2004

A

Sets whose intersection is empty are called disjoint sets

CS 173 Set Theory - OperatorsThe intersection of two sets A and B is:

A B = { x : x A x B}

If A = {x : x is a US president}, and B = {x : x is in this room}, then

A B = {x : x is a US president in this room} =

Cs173 - Spring 2004

- = U and

U =

CS 173 Set Theory - OperatorsThe complement of a set A is:

A = { x : x A}

If A = {x : x is bored}, then

A = {x : x is not bored}

=

U

Cs173 - Spring 2004

A

B

CS 173 Set Theory - OperatorsThe set difference, A - B, is:

A - B = { x : x A x B }

A - B = A B

Cs173 - Spring 2004

A

B

CS 173 Set Theory - OperatorsThe symmetric difference, A B, is:

A B = { x : (x A x B) v (x B x A)}

= (A - B) U (B - A)

Cs173 - Spring 2004

CS 173 Set Theory - Operators

A B = { x : (x A x B) v (x B x A)}

= (A - B) U (B - A)

Proof:

{ x : (x A x B) v (x B x A)}

= { x : (x A - B) v (x B - A)}

= { x : x ((A - B) U (B - A))}

= (A - B) U (B - A)

Cs173 - Spring 2004

Don’t memorize them, understand them!

They’re in Rosen, p89.

CS 173 Set Theory - Famous Identities- Two pages of (almost) obvious.
- One page of HS algebra.
- One page of new.

Cs173 - Spring 2004

A U U = U

A U A = A

A U = A

A = A

A A = A

(Lazy)

CS 173 Set Theory - Famous Identities- Identity
- Domination
- Idempotent

Cs173 - Spring 2004

A = A

A A=

CS 173 Set Theory - Famous Identities- Excluded Middle
- Uniqueness
- Double complement

Cs173 - Spring 2004

B A

A U (B U C)

A U (B C) =

A (B C)

A (B U C) =

CS 173 Set Theory - Famous Identities- Commutativity
- Associativity
- Distributivity

A U B =

A B =

(A U B)U C =

(A B) C =

(A U B) (A U C)

(A B) U (A C)

Cs173 - Spring 2004

(A B)= A U B

Hand waving is good for intuition, but we aim for a more formal proof.

CS 173 Set Theory - Famous Identities- DeMorgan’s I
- DeMorgan’s II

p

q

Cs173 - Spring 2004

Like truth tables

Like

Not hard, a little tedious

CS 173 Set Theory - 4 Ways to prove identities- Show that A B and that A B.
- Use a membership table.
- Use previously proven identities.
- Use logical equivalences to prove equivalent set definitions.

Cs173 - Spring 2004

CS 173 Set Theory - 4 Ways to prove identities

Prove that

- () (x A U B) (x A U B) (x A and x B) (x A B)

2. () (x A B) (x A and x B) (x A U B) (x A U B)

Cs173 - Spring 2004

Haven’t we seen this before?

CS 173 Set Theory - 4 Ways to prove identitiesProve that using a membership table.

0 : x is not in the specified set

1 : otherwise

Cs173 - Spring 2004

(A UB)= A U B

= A B

= A B

CS 173 Set Theory - 4 Ways to prove identitiesProve that using identities.

Cs173 - Spring 2004

(A UB)= {x : (x A v x B)}

= A B

= {x : (x A) (x B)}

CS 173 Set Theory - 4 Ways to prove identitiesProve that using logically equivalent set definitions.

= {x : (x A) (x B)}

Cs173 - Spring 2004

CS 173 Set Theory - A proof for us to do together.

X (Y - Z) = (X Y) - (X Z). True or False?

Prove your response.

(X Y) - (X Z) = (X Y) (X Z)’

= (X Y) (X’ U Z’)

= (X Y X’) U (X Y Z’)

= U (X Y Z’)

= (X Y Z’)

= X (Y - Z)

Cs173 - Spring 2004

A = B

A B =

A-B = B-A =

Trying to pv p --> q

Assume p and not q, and find a contradiction.

Our contradiction was that sets weren’t equal.

CS 173 Set Theory - A proof for us to do together.Pv that if (A - B) U (B - A) = (A U B) then ______

A B =

Suppose to the contrary, that A B , and that x A B.

Then x cannot be in A-B and x cannot be in B-A.

DeMorgan’s!!

Then x is not in (A - B) U (B - A).

Do you see the contradiction yet?

But x is in A U B since (A B) (A U B).

Thus, A B = .

Cs173 - Spring 2004

CS 173 Set Theory - Generalized Union

Ex. Let U = N, and define:

A1 = {2,3,4,…}

A2 = {2,4,6,…}

A3 = {3,6,9,…}

Cs173 - Spring 2004

Composites

N

I have no clue.

primes

CS 173 Set Theory - Generalized UnionEx. Let U = N, and define:

Then

Cs173 - Spring 2004

CS 173 Set Theory - Generalized Intersection

Ex. Let U = N, and define:

A1 = {1,2,3,4,…}

A2 = {2,4,6,…}

A3 = {3,6,9,…}

Cs173 - Spring 2004

A

Wrong.

CS 173 Set Theory - Inclusion/ExclusionExample:

How many people are wearing a watch?

How many people are wearing sneakers?

How many people are wearing a watch OR sneakers?

What’s wrong?

|A B| = |A| + |B| - |A B|

Cs173 - Spring 2004

173

217 - (157 + 145 - 98) = 13

CS 173 Set Theory - Inclusion/ExclusionExample:

There are 217 cs majors.

157 are taking cs125.

145 are taking cs173.

98 are taking both.

How many are taking neither?

Cs173 - Spring 2004

kidding.

CS 173 Set Theory - Generalized Inclusion/ExclusionSuppose we have:

B

A

C

And I want to know |A U B U C|

|A U B U C| = |A| + |B| + |C|

- |A B| - |A C| - |B C|

+ |A B C|

Cs173 - Spring 2004

CS 173 Set Theory - Inclusion/Exclusion

Example:

How many people are wearing a watch?

How many people are wearing sneakers?

How many people are wearing a watch AND sneakers?

How many people are wearing a watch OR sneakers?

Cs173 - Spring 2004

CS 173 Set Theory - Sets as bit strings

Let U = {x1, x2,…, xn}, and let A U.

Then the characteristic vector of A is the n-vector whose elements, xi, are 1 if xi A, and 0 otherwise.

Ex. If U = {x1, x2, x3, x4, x5, x6}, and A = {x1, x3, x5, x6}, then the characteristic vector of A is

Cs173 - Spring 2004

Bit-wise AND

CS 173 Set Theory - Sets as bit stringsEx. If U = {x1, x2, x3, x4, x5, x6}, A = {x1, x3, x5, x6}, and B = {x2, x3, x6},

Then we have a quick way of finding the characteristic vectors of A B and A B.

Cs173 - Spring 2004

domain

co-domain

CS 173 FunctionsSuppose we have:

And I ask you to describe the yellow function.

What’s a function?

Notation: f: RR, f(x) = -(1/2)x - 25

Cs173 - Spring 2004

CS 173 Functions

Definition: a function f : A B is a subset of AxB where a A, ! b B and <a,b> f.

Cs173 - Spring 2004

A

A point!

A collection of points!

CS 173 FunctionsDefinition: a function f : A B is a subset of AxB where a A, ! b B and <a,b> f.

B

A

Cs173 - Spring 2004

Download Presentation

Connecting to Server..