You are on page 1of 18

Today is Monday!

Recitations started this morning.

Study groups
Rutgers Learning Centers

Dr. Mary Emenike


Mary.Emenike@echo.rutgers.edu

Email also for help with rooms for self-organized


study groups

Rushit Sanghrajka
James Kersh
John Yang
Registration (open until Sunday)
https://secure.rutgers.edu/rlcstudygroup/login.aspx

Basics: Set Theory


(Chap 2.1-2.2)

Def: Set
Set: unordered collection of objects called
elements or members of the set.

Notation: a A
Set A contains object a

Roster Method

The four cardinal directions

D = {east, west, north, south}

Set builder notation


S = {x !+ | x is a square}
Generate
all positive
integers

Check if x fulfills condition (i.e.


is a square) and only keep
those x which do.

Set Notation

Description

Logic

EF

E is subset of F
(F superset of E)

eE eF

EF

E union F

EF

E intersect F

EC

E complement

{} or

Empty set

e EF

eE or eF

e EF

eE and
eF

eE

eEC EC =S\E

How to show
A is subset of B: if x belongs to A then
x also belongs to B

A is not a subset of B: Find a single x


A such that x B.

A = B: Show A is a subset of B and B is a


subset of A

Alternative Notation
One way ...

another way ...

Subset or Equal

AB

AB

Proper Subset
(not equal)

AB

AB

A proper subset of B: there must be at least one


element in B, not in A

Cardinality of a set
If there are n distinct elements in a set A,
then A is finite and |A| = n

Examples:
|{east, west, north, south}| = 4
| {x ! | x divisible by 2 and x 100} |= 50
A is called infinite if is is not finite. E.g.
+

S = {x !+ | x is a square}

Power set
For a set S, P(S) denotes the power set of S,
the set of all subsets of S

Ex: S = {2,5,7}
P(S) = {, {2}, {5}, {7}, {2,5}, {2,7}, {5,7}, {2,5,7}}

Size of the power set


Claim: If |S| = n, then | P(S) | = 2
Question: How to represent sets in the
n

computer?

Cartesian products

The Cartesian product of sets A and B is the set of


all ordered pairs
A B = {(a,b) | a A, b B}

The Cartesian product of sets A1,..., Ar is the set of


all ordered r-tuples
A1 A2 A3 ... Ar =
{(a1, a2, a3,..., ar) | a1 A1, a2 A2,..., ar Ar}

Cartesian products &


code

A B = {(a,b) | a A, b B}
As Python code:
for a in A:
for b in B:
print (a,b)

You might also like