Mathematics for Computer Science

(Frankie) #1

Chapter 4 Mathematical Data Types68


symbol set elements
; the empty set none
N nonnegative integers f0;1;2;3;:::g
Z integers f:::;3;2;1;0;1;2;3;:::g
Q rational numbers^12 ;^53 ; 16;etc.
R real numbers ; e;9;

p
2;etc.
C complex numbers i;^192 ;

p
2 2i;etc.

A superscript “C” restricts a set to its positive elements; for example,RCdenotes
the set of positive real numbers. Similarly,Zdenotes the set of negative integers.


4.1.2 Comparing and Combining Sets


The expressionST indicates that setSis asubsetof setT, which means that
every element ofSis also an element ofT(it could be thatSDT). For example,
NZandQR(every rational number is a real number), butC6Z(not every
complex number is an integer).
As a memory trick, notice that thepoints to the smaller set, just like asign
points to the smaller number. Actually, this connection goes a little further: there
is a symbolanalogous to<. Thus,STmeans thatSis a subset ofT, but the
two arenotequal. SoAA, butA6A, for every setA.
There are several ways to combine sets. Let’s define a couple of sets for use in
examples:


XWWDf1;2;3g
YWWDf2;3;4g

 Theunionof setsXandY(denotedX[Y) contains all elements appearing
inXorY or both. Thus,X[Y Df1;2;3;4g.

 TheintersectionofXandY(denotedX\Y) consists of all elements that
appear inbothXandY. SoX\YDf2;3g.

 Theset differenceofXandY(denotedXY) consists of all elements that
are inX, but not inY. Therefore,XYDf 1 gandYXDf 4 g.

4.1.3 Complement of a Set


Sometimes we are focused on a particular domain,D. Then for any subset,A, of
D, we defineAto be the set of all elements ofDnotinA. That is,AWWDDA.
The setAis called thecomplementofA.

Free download pdf