Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 7

rwerSet partitions, Cartesian product of sets, Power sets

1.)Set partitions
Two sets are disjoint if they have no elements in common, i.e. their intersection is the empty set.

A and B are disjoint sets iff A Ç B = Æ

Definition: Consider a set A, and sets A1, A2, … An, such that:
A1 È A2 È …È An = A

A1, A2, … An, are mutually disjoint, i.e. for all i and j, Ai Ç Aj = Æ

The set {A1, A2, … An} is called a partition of A

Example:
1.) A = {a, b, c, d, e, f, g}

A1 = {a, c, d}

A2 = {b, f}

A3 = {e, g}

The set {{a, c, d}, {b, f}, {e, g}} is a partition of A.

2.) A = {a, b, c, d, e, f, g}

Is {{a, d, e},{b, c}{d, f, g}} a partition?

No: the sets {a, d, e} and {d, f, g} have a common element d

3.) A = {1, 2, 3, 4, 5}

Is {{1, 3},{4, 5}} a partition?


No: the union of {1,3} and {4, 5} is not equal to the set A.

4.) A = {1, 2, 3, 4, 5}

Is {{1, 3},{4, 2, 5}} a partition?

Yes : {1, 3} Ç {4, 2, 5} = Æ , {1, 3} È {4, 2, 5} = A

Important: Each element of A should appear in exactly one of the sets in the partition.

Application: classes of equivalence (to be studied later)

2.) Cartesian product


Consider the identification numbers on license plates: x1x2x3 Y1Y2Y3

where x1x2x3 is a 3-digit number and Y1Y2Y3 is a combination of 3 letters

How do we make sure that each license plate would have a different identification number?

The program that assigns numbers uses Cartesian product of sets.

Definition: Let A and B be two sets. The Cartesian product of A and B is defined as the set
A x B = {(x,y) | x є A L y є B}

Note: the order of x and y matters; this is an ordered pair

Example 1:
A = {0, 1, 2, 3}

B = {a, b}

A x B = {(0,a), (0,b), (1,a), (1,b), (2,a), (2,b), (3,a), (3,b)}


Example 2:
A = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

A x A = {(0,0), (0,1), (0,2), …. (0,9),

(1,0), (1,1), (1,2), ... ,(1,9),

……

(9,0), (9,1), (9,2), ... ,(9,9)}

We can consider the result to be the set of all 2-digit numbers.

Example 3:
A = {A, B, C, …. X, Y, Z}

A x A x A = {(A, A, A), (A, A, B), (A, A, C), …

(A, B, A), (A, B, B), ….

….

(Z, A, A), (Z, A, B), …..

….

(Z, Z, A), …… (Z, Z, Z)}

Here the result is all possible sequences of 3 letters, e.g. used in license plates.

Let

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

A = {A, B, ….. Z}

Then the license plates are obtained by the Cartesian product

D x D x D x A x A x A = D3 x A3

Here we use the shortcut notation: A x A = A2, A x A x A = A3, etc.

Application of Cartesian products: to generate strings of symbols.


Let A = {a, b, c}

A x A = {(a,a),(a,b),(a,c),(b,a),(b,b),(b,c),(c,a),(c,b),(c,c)}

We can disregard the parentheses and the comma, and write the product thus:

A x A = {aa, ab, ac, ba, bb, bc, ca, cb, cc}

We obtain here strings over the alphabet A = {a,b,c}

By definition a string of length n is an element of An, where A is a set of some symbols.

A0 = {e }, e - the empty string of length 0

A1 is the set of all strings of length 1

A2 is the set of all strings of length 2

…..

Strings are very important objects, studied in Linguistics, in Mathematics and in Computer Science. All
languages - natural and programming, are built out of strings.

3.)Power sets
Definition: The set of all subsets of a given set A is called power set of A.

Notation 2A , or P (A)

Example:
A - { a,b,c,d}

P (A) = {Æ, {a},{b},{c},{d}

{a,b},{a,c},{a,d},{b,c},{b,d},{c,d}

{a,b,c},{a,b,d},{a,c,d}, {b, c, d}

{a,b,c,d}}
The number of elements in P (A) is 2 N, where N = number of elements in A

Why 2 N ? To answer this question, we examine the bit notation of sets, described below.

Bit notation: For a set A with n elements, each subset of A can be represented by

a string of length n over {0,1}, i.e. a string consisting of 0s and 1s.

Example:
A = {a, b, c, d}

{a,b} = 1 1 0 0

{a,c} = 1 0 1 0

{b,c,d} = 0 1 1 1

The i-th element in the string is 1 if the element ai is in the subset, otherwise it is 0.

Thus the subset {a,b,d} of the set {a,b,c,d} can be represented by the string '1101'.

There are 2n different strings with length n over {0,1}(why?),

hence the number of the subsets is 2n .

Application

Consider an alphabet A, i.e. a set of characters.

The set of all possible strings of length 2 is A x A = A2.

The set of all possible strings of length 3 is A x A x A = A3.

The set of all possible strings of any length is:

A * = A0 È A1 È A2 È …È An È …

A formal language is defined as any subset of A*.

We may be interested to examine certain languages with length of strings not greater

than some fixed n.

For example, let A = {a, b, c} and n = 2, i.e. we are interested in A1 È A2.

In particular, we may be interested how many languages are there in A1 È A2.


Each language using the letters a, b, and c, and with length of strings not greater than 2,

is a subset of A1 È A2.

So the question is: how many subsets are there in A1 È A2,

i.e. how many elements are there in P (A1 È A2)?

We use |A| to denote the number of elements in A.

We have:
|P (A1 È A2)| = 2|(A1 È A2)|.

A1= {a, b, c}

A2 = {aa, ab, ac, ba, bb, bc, ca, cb, cc}

|A1| = |A| = 3

|A2| = |A| x |A| = 3 x 3 = 9.

The number of the elements in A1 È A2 is 12, hence the number of subsets is 212 = 4096.

4.)Using bit notation to compute intersection, union,


complement and difference
If two sets are given in bit notation, the operations intersection, union, difference and complementation
are easily performed using disjunction, conjunction and negation.

Example: E = {a, b, c, d}, A = {a, b}, B = {b, d}.


Bit notation:

E=1111

A=1100

B=0101
Ac = ~(1 1 0 0 ) = 0 0 1 1 = {c, d}

A È B = (1 1 0 0) V (0 1 0 1) = 1 1 0 1 = {a, b, d}

A Ç B = (1 1 0 0) L (0 1 0 1) = 0 1 0 0 = {b}

A - B = A Ç Bc = (1 1 0 0) L ~(0 1 0 1) = (1 1 0 0) L (1 0 1 0) = 1 0 0 0 = {a}

You might also like