CSCE 222 Lecture 9

From Notes
Jump to navigation Jump to search

« previous | Wednesday, February 9, 2011 | next »


Sets

A set is an unordered collection of unique objects, called elements.

Sets are equal (A=B) iff

x(xAxB)

Set A is a subset of set B (AB) iff

x(xAxB)

Examples of Sets

  • 0={0,1,2,3,} (set of all natural numbers starting with 0)
  • ={1,2,3,4,} (set of all natural numbers starting with 1)
  • ={,2,1,0,1,2,} (set of all integers)
  • =all real numbers
  • ={} (empty set)
  • A={a,a,b}={a,b}


Note: Properties of Sets
  1. The empty/null set is a subset of all sets
  2. Every set is a subset of itself


Cardinality

Let S be a finite set (containing a finite number of elements):

number of elements n=|S|


Power Sets

Given a set S, P(S) is the set of all subsets of S:

P({1,2})={{1},{2},{1,2},}
Note: If a finite set S has n elements, then P(S) has 2n elements.


Cartesian Products

A cartesian product between two finite sets A and B is the set of all unique tuples that can be created from the elements of A and B:

A×B={(a,b) | aA, bB}
Note: |A×B|=|A||B|