lee appendix a

Upload: etpon

Post on 10-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Lee Appendix A

    1/28

    APPEND I X ASets ahd ~ u h c t l o h S

    qhis appendix establishes the notation of sets and functions as used inthe text. We review the use of this mathematical language to describe sets in avariety of ways; to combine sets using the operations of union, intersection, andproduct; and to derive logical consequences. We also review how to formulateand understand predicates and define certain sets that occur frequently in thestudy of signals and systems. Finally, we review functions.

    A.1 SetsA se t is a collection of elements. The set of natural numbers, for example, isthe collection of all positive integers. This set is denoted (identified) by the nameNaturals,

    INaturals = (I , 2, 3, . . . J.. (Al)In (AI ) the left side is the name of the set and the right side is an enumeration orlist of all the elements of the set. We read (AI ) as "Naturals is the set consistingof the numbers 1,2,3, and so on:' The ellipsis . . . means "and so on." BecauseNaturals is an infinite set, we cannot enumerate all its elements, and so we have

    589

  • 8/8/2019 Lee Appendix A

    2/28

    592 A P PEN D I X A : Sets and tunctions

    the expression is dearly an assignment, as indicated by "Define the set" ,",However, in the following context,

    If we define MyNumbers by MyNumbers = (1,3, 5), then MyNumbers {3, 5, l} ,the first "=" is an assignment, but the second is an assertion.

    A.1.2 Sets o f setsAnything can be an element of a set, so of course sets can be elements of sets.Suppose, for example, thatX is a set. Then we can construct the set of all subsetsof X, which is written P(X) and is called the power set of x.* Notice that sinceoc X, then 0 E P(X). (0 denotes the empty set.)A.1.3 Variables and predicatesWe can refer to a particular element of a set by using its name, for example,the element 55 in Naturals, or Berkeley in USCities. We often need to refer to ageneral element in aset. We do this by using avariable.We usually use lowercaseletters for variable names, such as x, y, n, t. Thus, n E Naturals refers to any naturalnumber. Naturals is the range of the variable n. We may also use a characterstring for a variable name such as city E USCities. We say that "n is a variable overNaturals" and "city is a variable over USCities."

    A variable can be assigned (or substituted by) any value in its range. Thus,the assignment n = 5 assigns the value 5 to n, and city Berkeley assigns thevalue Berkeley to city.Once again the use of "=" in an expression like n 5 is ambiguous, becausethe expression could be an assignment or an assertion, depending on the con-text. Thus, for example, in the context,

    Let n = 5, m = 6, k = 2, then m = k + nthe first three "=" are assignments, but the last is an assertion, which happens tobe false.

    * The power set of X is sometimes written 2X.

  • 8/8/2019 Lee Appendix A

    3/28

    A.1 Sets 593

    PROBING~ u d i c a t e g in !11f1Q'cflZS@* FURTHERIn MATLAB, "=" is always used as an assignment. while "==" is usedto express an assertion.Thus the MATLAB program.

    n = ~ m = ~ k = ~ m=k+nreturns

    n = 5. m= 6, k = 2, m= 7because the expression m=k+n assigns the value 7 to m. However. the MATLAB program

    n m k m==k+nreturns

    n = 5. m= 6, k = 2. ans = 0where ans 0 means that the assertion m== k+n evaluates to false.

    * MAT LAB is a registered trademark of The MathWorks, Inc.

    We can use variables to form expressions such as n 5. Now, when we assigna particular value to n in this expression, the expression becomes an assertionthat evaluates to true or false. (For instance, n 5 evaluates to true for n= 3and to false for n = 6.) An expression such as x 5, which evaluates to true orfalse when we assign the variable a specific value, is called a predicate (in x).*Predicates are used to define new sets from old ones, as in this example:

    8 = {x E Naturals 1x 5},which reads "8 is the set of all elements x in Naturals such that (the symbol'1' means 'such that') the predicate x 5 is true:" More generally; we use thefollowing prototype expression to define a new set NewSet from an old set Set:

    __=_{x E Set IPred(x)}'j (A4) A specific value is said to satisfy a predicate if the p redicate evaluates to true with that value, andnot to satisfy the predicate if the predicate evaluates to false.

  • 8/8/2019 Lee Appendix A

    4/28

  • 8/8/2019 Lee Appendix A

    5/28

    The symbol "V" reads "for all;' so the expression reads, "for all values of x in A,x < 7:' The phrase "V x E A" is called universal quantification. Note that in theexpression CAS), x is again a dummy variable; the meaning of the expression isunchanged if we use another variable name. Note, also, that CAS) is an assertionwhich, in this case, evaluates to true. However, the assertion

    "Ix EA , x> 3is false, since for at least one value of x E A, namely x = 1, x > 3 is false.Suppose we want to say that there is at least one element in A that is largerthan 3. We can say this using existential quantification as in

    3x EA , x> 3. CA6)The symbol "3" reads "there exists;' so the expression CA6) reads "there existsa value of x in A, x > 3:' Once again, any other variable name could be used inplace of x, and the meaning of the assertion is unchanged.

    In general, the expression,CA7)

    is an assertion that evaluates to true if Pred(x) evaluates to true for every valueofx A,and

    CA8)is an assertion that evaluates to true if Pred(x) evaluates to true for at least onevalue of x E A.Conversely, the assertion CA.7) evaluates to false if Pred(x) evaluates to falsefor at least one value of x E A, and the assertion CA8) evaluates to false if Pred(x)evaluates to false for every value of x E A.

    We can use these two quantifiers to define sets using the prototype new setconstructor CA.4). For example,

    EvenNumbers = (n E Naturals 13k E Naturals, n = 2k}is the set of all even numbers, since the predicate in the variable n,

    3 k E Naturals, n 2k,evaluates to true if and only if n is even.

    A.1 Sets 595

  • 8/8/2019 Lee Appendix A

    6/28

    596 A P PEN D I X A: Sets 411d {jUl1ctiohiJ

    A.1.S Some useful setsThe following sets are frequently used in the book:

    Naturals = (1,2, . . . } natural numbersNaturalso = to, 1,2" .. } nonnegative integers

    Integers = { .. ,-2, -1,0,1,2, . . . } integersIntegers+ {0,1,2, . . . } nonnegative integers, same as Natura

    Reals ( -00, (0) real numbersReals+ = [0, :::0) nonnegative real numbers

    Complex = {x + jy Ix,y E Reals} complex numbers,j = J=1If a, fj are real numbers, then

    [a, fj] {x E Reals Ia s x S fj}(a, fj) {x E Reals Ia < x < fj}(a, f3] = {x E Reals I a < x S fj}

    . ( -00, (0) = Reals.Note the meaning of the difference in notation: both end-points a and fj aincluded in [a, fj], and we say that [a, fj] is a closed interval; neither end-pois included in (a, fj), and we call this an open interval; the interval (a, fj] is sato be haif-open, half-closed. Whether an end-point is included in an intervalnot is indicated by the use of square brackets [, ] or parentheses (,).Other useful sets are:

    Binary = to, I}, the binary valuesBinary* = to, l}*,set of al l finite binary strings

    Bools = {true, false}, truth valuesBools* = {true, false} * set of all finite sequences of truth values

    Char =set of all alphanumeric charactersChar* = set of all finite character strings

  • 8/8/2019 Lee Appendix A

    7/28

    A.1 Sets 597

    A.1.6 Set operations: union, intersection, co.mpiementLet A = {l , 2, . .. , 1O}, and B {I , . . . , 5}. Clearly B is included in A, and A isincluded in Naturals. We express these assertions as:

    B c A, A c Naturals,which we read "B is contained in or included in A" and "A is contained in orincluded in Naturals." For the sets above,

    Naturals c Naturalso c Integers C Reals C Complex.If A and B are sets, then A n B is the set consisting of all elements that are in bothA and B, and A U B is the set consisting of all elements that are either in A or inB or in both A and B. An B is called the intersection of A and B, and A U B iscalled the union of A and B. We can express these definit ions using variables as:

    A n B = {x Ix E A A X E B}, A U B = {x Ix E A v X E B}where A is the notation for the logical and and v is the symbol for the logical or.The predicate "x E A A X E B" reads "x is a member of A and x is a member ofB"; "x E A v X E B" reads "x is a member of A or x is a member of 8:' The logicaland of two predicates is also called their conjunction and their logical or s alsocalled their disjunction. The symbols A and v are called logical connectives.If A, X are sets, then X \ A is the set consisting of all elements in X that arenot in A (think of it as set subtraction, X A). When A C X, X \ A is called thecomplement of A in X. When X is understood, we can write N instead of X \ A.

    We gain some intuitive understanding by depicting sets and set operationsusing pictures. Figure A.t illustrates union, intersection, and complement.A.1.7 Predicate operationsGiven two predicates P(x) and Q(x), we can form their conjunction P(x) A Q(x)and their disjunction P(x) v Q(x). These predicate operations correspond to theset operations of intersection and union:

    P(x) A Q(x)} = {x E X IP(x)} n {x E X I Q(x)}P(x) v Q(x)} = {x EX IP(x)} U {x EX I

    There is a helpful visual similarity between A and n, and between v and U.The counterpart of the complement of a set is the negation of a predicate.We denote by -.Pred(x) the predicate that evaluates to false for any value of x

  • 8/8/2019 Lee Appendix A

    8/28

    598 A P PEN D I X A : Sets tVla ~ u n c t i o n s

    (a) (b)FI G U R E A.1: (a) Union and intersection. (b) Set complement.

    for which Pred(x) evaluates to true, and that evaluates to true for any value of xfor which Pred(x) evaluates to false. We read "-.Pred(x)" as "not Pred(x)" or the"negation of Pred(x):' For example,

    {n E Naturals I -.(n < 5)} = {5, 6, 7, . . . },because -.(n < 5) evaluates to true if and only if n < 5 evaluates to false, whichhappens if and only if n is larger than or equal to 5.

    In general we have the following correspondence between predicate nega-tion and set complement:{x EX I-.Pred(x)} =X \ {x EX IPred(x)}. (A.9)

    We can combine the operations to obtain more complex identities. If P(x) andQ(x) are predicates, then

    {x E X I -.(P(x) j \ Q(x}=I {x E X I -.(P(x) v Q(x} {x E X I -'P(x) j \ -.Q(x)}. iL-.________ ____ ..__ ...__ ..__

    These identit ies have counterparts for set operations. For somesetX, if and Y eXand Z c X, thenX \ (Y n Z) = (X \ Y) u (X \ Z)X \ (Y uZ) = (X \ y) n (X \ Z).

  • 8/8/2019 Lee Appendix A

    9/28

    A.1 Sets 599

    When the set X is understood, we can write these as

    These identities are called de Morgan's rules.

    A.1.8 Permutations and combinationsGiven asetX with a finite number n of elements, we sometimes wish to constructa subset with a fixed number m :s n of elements. The number of such subsets isgiven by

    (A10)(:) n!mien m)!'where the exclamation point denotes the factorial function. The notation ( ~ ) isread "n choose m". It gives the number of combinations of m elements chosenfrom the set n.A combination is a set, so order does not matter. Sometimes, however, ordermatters. Suppose, for example, thatX = {a, b,c}. The number of subsets with twoelements is

    3) = 3! = 3( 2 2!l! 2 .

    These subsets are {a, b}, {a, c}, and {b, c}. Suppose instead that we wish toconstruct ordered subsets of X with two elements. In other words, we wishto consider [a, b] to be distinct from [b, a] (note the temporary use of squarebrackets to avoid confusion with unordered sets). Such ordered subset'> arecalled permutations. The number of m-lement permutations of a set of sizen is given by

    n! (All)(n - m)!The number of permutations is a factor of m! larger than the number of combinations in (A 10). For example, the number of 2-element permutations ofX={a,b,c} is six. They are [a,b], [a,c], [b,c], [b,a], [c,a], and [c,b].

  • 8/8/2019 Lee Appendix A

    10/28

    600 A P PEN D I X A: Sets and 6unctumg

    BASICS

    Given N sets, Xl, Xl< .. . ,XN, which may be identical, an N-tuple is an ordered collectionof one element from each set. It is written in parentheses, as in

    whereXi E Xi for each i E {1, 2, . . . ,NJ.

    The elements of an N-tuple are called its components or coordinates. Thus, xi is the ithcomponent or coordinate of (xl,' . . , xN)' The order in which the components are given isimportant; it is part of the definition of the N-tuple. We can use a variable to refer to theentire N-tuple, as in X = (Xl, ' . . ,XN).Frequently, the sets from which the tuple components are drawn are all identical,as in

    This notation means simply that each component in the tuple is a member of the same setX. Of course, this means that a tuple may contain identical components. For example, ifX = (a, b, c), then (a, a) is a 2-tuple over X.

    Recall that a permutation is ordered, like a tuple, but like a set and unlike a tuple, itdoes not allow duplicate elements. In other words, (a, a) is not a permutation of {a, b, c). Soa permutation is not the same as a tuple. Similarly, an ordered set does not allow duplicateelements, and thus is not the same as a tuple.

    We define the set of finite sequences over X to be(X " . . ,XN) IXi EX , 1::: i ::: N, N E Natura/sol.

    where if N =e call the sequence the empty sequence. This allows us to talk about tu-ples without specifying N. Finite sequences are also called strings, although by convention,strings are written differently, omitting the parentheses and commas, as in

    We may even wish to allow N to be infinite. We define the set of infinite sequence overa set X to be

    ((Xl, Xl< . . ) IXi EX , i E Natura/sol.

  • 8/8/2019 Lee Appendix A

    11/28

    A.1 Sets 601

    A.1.9 Product setsThe product X x Y of two sets X and Y consists of all pairs of elements (x,y)with x E X andy E Y, that is,

    Xx Y={(X,Y)IXEX,YEY).

    The product of two sets may be visualized as in figure A.2. These pictures areinformal, to be used only to reinforce intuition. In figure A.2(a), the setX [0,6]is represented by a horizontal line segment, and the set Y = [l , 8] is representedby the vertical line segment. The productsetX x Y = [0,6] x [L 8] is representedby the rectangle whose lower left corner is the pair (0, 1) and upper right corneris (6,8).

    In figure A.2(b) , the discrete set X = {l, 2, 3, 4, 5, 6} is represented by sixpoints, while Y [1,8] is represented as before. The product set is depicted by six

    (6,8)

    Y=[1,8]= [1,8] [0, 6] x [1,8]

    (0,1)X = [0,6]

    (a)

    Y= {g, h, i,j}

    {a, b, c, d, e, f) x {g, h, i, j)g h

    abcdefX ={a, b, c, d, e, f)

    (c)

    {l, 2, 3,4,5,6) x [1,8]

    +- (5,6)l

    123456X {I , 2, 3, 4, 5, 6}

    (b)

    FIGURE A.2: Visualization of product sets. (a) The rectangle depicts the product set[0,6] x ['1,8]. (b) Together, the six vertical lines depict the product set {1, . . . , 6J x [1,8].(c) The array of dots depicts the set {a, b, c, d, e, f) x {g, h, i,jJ.

  • 8/8/2019 Lee Appendix A

    12/28

    602 A P PEN D I X A: Se t s tUld ~ u h c t i o h S

    vertical line segments, one for each element of X. For example, the fifth segmentfrom the left is the set {(5, y) l iS y S 8}. One point in that set is shown.In figure A.2(c), the product of two discrete sets is shown as an array ofpoints. Unless these are ordered sets, there is no significance to the left-ta-right

    or top-ta-bottom order in which the points are shown. In all three cases in thefigure, there is no significance to the choice to depict the first set in the productX x Y on the horizontal axis, and the second set on the vertical axis. We couldhave done it the other way around. Although there is no significance to which isdepicted on the vertical axis and which on the horizontal, there is significanceto the order of X and Y in X x Y. The set X x Y is not the same as Y x X unlessX Y.

    We generalize the product notation to three or more sets. Thus, if X, Y, Z aresets, then X x Y x Z is the set of all triples or 3-tuples,

    X x Y x Z = {(x,y,z) Ix EX,y E Y,z EZ},and if there are N sets, Xl> X2, ... ,XN , their product is the set consisting of N-tuples,

    (A.12)

    We can alternatively write (A. 12) as

    (A. 13)

    The large IT operator indicates a product of its arguments.X x X is also written as X2. The N-fold product of the same set X is also

    written asXN. For example, RealsN is the set of all N-tuples of real numbers, andComplexN is the set of all N-tuples of complex numbers. In symbols,

    = {x = (xj, . . . ,xN) IXi E Reals,i = 1, . . . ,N}= {z = (z!, . .. ,ZN) IZj E Complex, i = 1, . . . ,N}.Predicates on produ.ctse tsA variable over X x Y is denoted by a pair (X,y), with x as the variable over Xand y as the variable over Y. We can use predicates in x and y to define subsetsof X x Y.

    http:///reader/full/produ.cthttp:///reader/full/produ.ct
  • 8/8/2019 Lee Appendix A

    13/28

    A.1 Sets 603

    Y =[0, 2]x=y

    X=[O,l]FIG UREA. 3: The rectangle depicts the set [0, 1J x [0, 2]. the shaded region depictsthe set given by (A. 14), and the unshaded triangle depicts the set given by (A.15).

    Example A.1: The set{(x, y) E [0, 1] x [0,2] Ix ::: yJ (A. 14)

    can be depicted by the shaded region in figure A3. The unshaded triangledepicts the set{(x,y) E [0,1] x [0,2] Ix 2: y} . CJ (A1S)

    Example A.2: The solid line in figure A.4(a) represents the set{(x,y) E Rea/s2 1x +y = I},

    the shaded region (including the solid line) depicts{(x,y) E Rea/s2 Ix +Y 2: I},

    and the unshaded region (excluding the solid line) depicts((x,y) E Rea/s2 , x + y < II.

    Similarly, the shaded region in figure A.4(b) depicts the set((x,y) E Rea/s2 , -x + y 2: IJ.

    The overlap region in figure A.4(c) depicts the intersection of the two shadedregions, and corresponds to the conjunction of two predicates;{(x,y) E Rea/s2 , [x +y > 1] 1\ [ -x +y.2: Ill. 8

  • 8/8/2019 Lee Appendix A

    14/28

    604 A P PEN D I X A: Sets tV ld 6u'ltctio11!/

    (a) (b)

    -x+ y= 1

    (c)FIGURE A.4: (a) The solid line depicts the subset of Rea/52 satisfying the predicatex + y = 1. The shaded region satisfies x + y :::: 1. (b) The solid line satisfies -x + y 1,and the shaded region satisfies -x + y :::: 1. (c) The overlap region satisfies [x +y ::::1]/\ [-x + y :::: 1].

    Example A.3: The set TallerThan consists of all pairs of students (namelname2) such that name] is taller than name2:

    Tal/erThan = {(namej, name2) E Students2 1 name1 is taller than name2}.NearbyCities consists of pairs of cities that are less than 50 miles apart:

    NearbyCities {(city], city2) E USCities2 I distance(city], city2) ::: 50}.In the preceding predicate, distance (city > city2) is the distance in miles between city] and city2' :J

  • 8/8/2019 Lee Appendix A

    15/28

    A.1.10 Evaluating an expressionWe have evaluated expressions several times in this appendix : each time relyingon our mathematical abil ity with s imple expressions. We can develop systematicmethods for evaluating expressions that rely less on intuition, and can thereforehandle more complicated and intricate expressions.

    Some examples of patterns of expressions are:A, B, Naturals, . . . , names of setsA= {list of elements}x E A, X A, set membershipA= B, B c A, and A :J B, set inclusionAn B,A UB, X x Y, X \A , AC , set operationsx, y, . . . , names of variablesP(x), Q(x), . . . , predicates in x'V x E Set, P(x) where P is a predicateNewSet {x E Set IPred(x)}, set definitionP(x) 1\ Q(x), P(x) v Q(x), -,(P(x, predicate operationsThe patterns define the rules of grammar of the notation. The notation itself

    consists of expressions, that are composed ofconstants, such as numbers and predefined sets,variables, which are names that are not predefined,operators, such as E, n, or = (as an assertion),quantifiers, such as 'V and 3, ordefinitions, name = (a

  • 8/8/2019 Lee Appendix A

    16/28

    606 A P PEN D I X A : Sets and tunctlons

    say that in the expression "x + 3: x is a free variable. It has no assigned valuin the expression. An expression with a free variable acquires a meaning whethat free variable is given a meaning, if it is well formed with that meaning. Foexample, "x + 3" has meaning 13 if x has meaning 10, but it is not well formedx has meaning Berkeley. Quantifiers remove free variables from expressions.

    Example A.4: In the predicate "x 0;' x is free. In the expression "3 x EReais, x = 0," x is no longer free. In fact, this expression has value true. Ithe expression "V x E Reals, x 0: again x is not free, but this expression havalue false. The expression "3 y E Rea/s, x + 1= y" still has free x. However"V x Reals, 3 y E Reals, x + 1= y" hac; no free variables, and has valutrue. The expression "V x E Reals, x + 7;' however, is not well formed. It haneither free variables nor a value. :JApredicate expression is one that either has a meaning that is a truth valu(true or false), or can have such a meaning if its free variables are appropriateldefined. Expression (AI6) is an example of a predicate expression.Expressions also contain punctuation, such as parentheses. These help define the relationships among the components of the expression. It is beyond th

    scope of this book to define completely the rules for constructing expressions,but we can hint at the issues with a brief discussion of parsing.ParsingTo show that (A16) is indeed a well-formed predicate expres.c;ion, we musshow that it can be constructed using the syntax. We do this by parsing thexpression (A16) with the help of matching brackets and parentheses. Parsinthe expression will also enable us to evaluate it in a systematic way.The result is the parse tree shown in figure AS. The leaves of this tree (thbottom-most nodes) are labeled by the elementary predicates P, Q, R, and thother nodes of the tree are labeled by one of the predicate operations 1\ , v, ...Each of the intermediate nodes corresponds to a sub-predicate of CAt6). Twsuch sub-predicates are shown in the figure. The last leaf on the right is labeleP(x). Its parent node is labeled ..... , and so that parent node corresponds to thsub-predicate .....(P(x. Its parent node is labeled 1\, and it has another child nodlabeled R(x), so this node corresponds to the sub-predicate R(x) 1\ -.(P(x.If we go up the tree in this way, we can see that the top of the tree (the roonode) indeed corresponds to the predicate (A 16). Since at each intermediatnode, the sub-predicate is constructed using the syntax. the root node is a wellformed predicate.EvaluatingSuppose we know whether the predicates P(x), Q(x). R(x) evaluate to true ofalse for some value ofx. Then we can use the parse tree to figure out whether th* A text on compilers lo r computer programming languages will typically do this.

  • 8/8/2019 Lee Appendix A

    17/28

    1\

    v v

    -, Q(x) pix) 1\ -R(x) 1\ -.,(P(x))

    Pix) R(x) -. , _ - , (P ( x ) )

    Pix)FIGURE A.S: Parse tree for the expression (A 16).

    predicate (A.I6) evaluates to true or false. To do this, we begin with the knowntruth values at the leaves of the parse tree, use the meaning of the predicateoperations to figure out the truth values of the sub-predicates corresponding tothe parents of the leaf nodes, and then the parents of those nodes, and work ourway up the tree to figure out the truth value of the predicate (A.16) at the rootnode. In figure A.6, the parse tree is annotated with the truth values of each of

    ....., +- False

    1\ +- True

    v +- True v +- True

    -, +- False True True 1\ +- False

    True True -, +- FalseTrue

    FIG UREA. 6: Parse tree for the expression (A 16) annotated with the truth values of eachof the nodes.

    A.1 Sets 607

  • 8/8/2019 Lee Appendix A

    18/28

    608 A P PEN D I X A : Se tB 41ld tU1lCtio1lB

    the nodes, where the values of P(x)Q(x) , R(x) are all assumed to be true. Sincethe root node is annotated "false;' we conclude that (A.16) evaluates to false.Truth tablesThe way in which the predicate operations transform the truth values is given inthe following truth table:

    P(x) Q{x) P{x) P{x) 1\ Q(x) P(x) v Q{x)True True False True TrueTrue False False False TrueFalse True True False TrueFalse False True False False

    Consider a particular row of this table, say the first row. The first two entriesspecify that P(x) is true and Q(x) is true. The remaining three entries give the cor-responding truth values for ...,P(x),P(x) A Q(x) , and P(x) v Q(x), namely, -P(x)is false, P(x) A Q(x) is true, and P(x) v Q(x) is true. The four rows correspond tothe four possible truth value assignments of P(x) and Q(x). This truth table canbe used repeatedly to evaluate any well-formed expression given the truth valueof P(x) and Q(x).

    Thus, given the truth values of predicates P1(x), . . . , Pn(X) , the truth valueof any well-formed expression involving these predicates can be obtained by acomputer algorithm that constructs the parse tree and uses the truth table above.Such algorithms are used to evaluate logic circuits.

    A.2 ;!Ul1cti01t8In the notation

    f:X ---+ Y, (A.I7)

    X and Yare sets, and f is the name of a function. The function is an assignmentrule that assigns a value in Y to each element inX. If the element in X isx, thenthe value is written f(x).We read (A.17) as "f is (the name of) a function from X into (or to) Y:

    We also say that f maps X into Y. The set X is called the domain of f, writtenX domain(f), the set Y is called the range of f, written Y = range(f).* When* In some mathematics texts, the se t Y, which we call the range, is cal led the codomain, and range(f)is defined to be the set of all values that f takes, that is, range(f) = {f (x) Ix E XI. However, we do notuse this terminology.

  • 8/8/2019 Lee Appendix A

    19/28

    A.2 ;;'ul1ction!1 609

    the domain and range are understood from the context, we write "f" by itself torepresent the function or the map. If x is a variable over X, 'we also say "f is afunction of x:'

    Example A.S: Recall the set Students of all the students in a class. Each element of Students is represented by a student's name,

    Students = {John Brown, Jane Doe, . . . J.We assign to each name in Students the student's grades on the final ex-amination, a number between 0 and 100. This name-ta-marks assignment is an example of a function. Just as we give names to sets (e.g., Students), we give names to functions. In this example the function might be named Score. When we evaluate the function Score at any name, we get the marks assigned to that name. We write this as

    Score(John Brown) = 90, Score(Jane Doe) = 91.2, . . .Figure A.7 illustrates the function Score. Three things are involved in

    defining Score: the set Students, the set [0, 100J of possible marks, and the assignment of marks to each name. In the figure this assignment is depicted by the arrows: the tail of the arrow points to a name and the head of the arrow points to the marks assigned to that name. We denote these three things by

    Score:Students -+ [0, ]00],which we read as "Score is a function from Students into [0, 100):' The domain of the function Score is Students, and the range of Score is [0, 100). :1

    IohnBrown

    IaneDoe

    [0, 100]

    StudentsFIG U REA. 7: Illustration of Score.

  • 8/8/2019 Lee Appendix A

    20/28

    610 A P PEN D I X A : Se t s t1l1d 6uI1ctiol1s

    It is easy to imagine other functions with the same domain Students. Foexample, Height assigns to each student his or her height measured in cm, SSNassigns students their Social Security Number, and Address assigns students theiaddress. The range of these functions is different. The range of Height might bdefined to be [0,200] (200 cm is about 6.5 feet). Since a Social Security Numbeis a nine-digit number, we can take {O, 1, . . . ,9}9 to be the range of SSN. And wcan take the range of Address to be Char JOo, assuming that an address can bexpressed as a string of 100 characters, including blank spaces.

    We usually use lowercase letters for function names, such as {, g, h, or mordescriptive names such as Score, Voice, Video, SquareWaue, AMSignal.Avoid a bad habit: It is important to distinguish between aand its value ((x) at a particular point x E domain(f). Thea rule that assigns a value in range({) to each x E domain({),((x) is a point or element in range(f). Unfortunately; too manyencourage the bad habit by using "(x)" as a shorthand for "{function of x: ' If you keep the distinction between { and {(x),easier to avoid confusion when we study systems.

    A.2.1 Defining functionsTo define a function, you must give the domain, the range, and the rule thaproduces an element in the range given an element in the domain. There armany ways to do this, as explored in greater depth in chapter 2. Here we mentioonly two. The first is enumeration. That is, in tabular form or some other formeach possible value in the domain is associated with a value in the range. Thimethod would be appropriate for the Score function, for example. Alternativelyfunctions can be mathematically defined by the prototype: define {:X -+ Y,

    'r/ x E X, {(x) = expression in x.The "expression in x" may be specified by an algebraic expression, by giving thgraph of {, by a table, or by a procedure.

    A.2.2 Tuples and sequences as functionsAn N-tuple x (x], . . . ,xlV) XlV can be viewed as a function

    x: {I, . . . ,N} -+ X.

  • 8/8/2019 Lee Appendix A

    21/28

    A.2 "!fWtctio119 611

    For each integer in 11" , , ,N}, it assigns a value inK An infinite sequencey overthe set Y can also be viewed as a functiony: Naturals - '? Y,

    ory: Naturalso - '? Y,

    depending on whether you wish to begin indexing the sequence at zero or one(both conventions are widely used). This view of sequences as functions is in factour model for discrete-time signals and event traces, as developed in chapter 1,

    A.2.3 Function propertiesA function {: X - ' ? Y is one-to-one if

    ' i Xl E X and ' i x2 E X, XI -:f= x2 = } {(Xl) -:f= {(X2)'Here the logical symbol "=}" means "implies" so the expression is read: If x], x2are two different elements in X, then {(Xl), ((X2) are different.

    Example A.6: The function Cube: Reals - '? ReaL" given by3' i X Cube(x) =x

    is one-to-one, because if Xl -:f= x2, then xf -:f= x ~ . But Square:Reals - '? Reals is not one-to-one because, for example, Square(l) =Square(- ]). ::JA function (:X - Y is onto if

    ' iY E Y, 3 X E X, such thatf(x) = y.The symbol "3" is the existential quantifier, which means "there exists" or "for some:' So the preceding expression reads "For each y in Y, there exists X in X such thatf(x) =y:' Accordingly, { is onto if for every y in its range there is some X in its domainsuch thaty = (ex).

    Example A.7: The function Cube: Reals - '? Reals is onto, while Square:Reals- ' ? Reals is not onto. However, Square: Reals - '? R e a l s ~ is onto. (J

  • 8/8/2019 Lee Appendix A

    22/28

    612 A P PEN D I X A: Sets and iunctlons

    PROBINGFURTHER

    The size of a set A, denoted IAI, is the number of elements it contains. By counting, weimmediately know that 11, 2, 3, 4} and la, b, c, d} have the same number of elements,whereas 11,2,3) has fewer elements. But we cannot count infinite sets. It is more difficultto compare the number of elements in the fol lowing infinite sets:

    A =Naturals = {1,2, 3,4, . . . J, B= {2, 3,4, 5 . . . J, C = [0, 1].At first, we might say that A has one more element than B, since A includes B and has oneadditional element, 1E A. In fact, these two sets have the same size.

    Thecardinality of a set is the number of elements in the set, but generalized to handleinfinite sets. Comparing the cardinality of two sets is done by matching elements, usingone-to-one functions. Consider tw o sets A and B, finite or infinite. We say that A has asmaller cardinality than B, written IAI '::::'IBI, if there exists a one-to-one function mappingA into B. We say that A and B have the same cardinality, written IAI = IBI, if IAI .::::. 181 andIBI.::::.IAIThe cardinality of the infinite set A =Naturals is denoted ~ o ' read" aleph null U (alephis the first letter of the Hebrew alphabet). It is quite easy to prove using the definition ofcardinality that n < for any finite number n.

    We can now show that the cardinality of B is also ~ o . There is a one-to-one functionf:A - r B, namely,

    VnEA, f (n)=n+1,

    so that IAI .::::. IBI, and there is a one-to-one function g:B - r A, namely,V nEB, g(n) = n 1,

    so that IBI .::::.IAI. A similar argument can be used to show that the set of even numbersand the set of odd numbers also have cardinality ~ o .

    It is more difficult to show that the cardinality of Naturals x Naturals is also ~ o . Tosee this, we can define a one-to-one function h:Naturals2 -+ Naturals as follows (see figureA.B).

    hL 1 = 1, h2, 1 = 2, h2,2 3,h1,2 4, h1,3 = 5, . . . .

    Observe that since a rational number min can be identified with the pair (m, n) E Naturals2,the argument shows that the cardinality of the set of all rational numbers is also ~ o .

  • 8/8/2019 Lee Appendix A

    23/28

    ---

    A.2 Z/-u.nctio11S 613

    (5,1)~ 4 ' 4 ) f4,1)

    (1,3) (1,2)

    (1,1) (2,1) (3,1) (4,1)FIG UREA. 8: A correspondence between Naturals2 and Naturals,

    2.Vn 6l'}'}tz se tsWe can show that the cardinality of [0, 1] is strictly larger than that of Naturals (i.e.,1[0, 1]1 > INaturalsj). Since the function f: Naturals -l- [0, 1] defined by

    V n E Naturals, fen) = 1jnis one-to-one, we have INaturalsl 1[0,1]1, However, we can show that there is no one-toone function in the other direction. If there were such a function g: (0, 1]-l- Naturals, thenit would be possible to enumerate all the elements of [0, 1) in an ordered list,

    3[0,1]={x1,x2,x , .. . j, (AlB)(The superscript here is not raising to a power, but just indexing.) We can show that thisis not possible, If we express each element of [0, 1J by its decimal expansion (ignoring theelement 1.0), this list looks like

    x' OxixN,x2 = O x f x ~ x ~ . . ,

    3 3 3 3X = X,x2x3'"xn = Ox7x;x ...

    continued on next page

    IIIIId ill n 11_P RO BI NGF U R T H E R

    P RO BI NG F U R T H E R

  • 8/8/2019 Lee Appendix A

    24/28

    614 A P P E N D I X A : Sets 411d 6u1Ictlo1ls

    P R O B I N G F U R T H E R

    Construct any number Y E [0, 1] with the decimal expansionY 0,y1Y2Y3'"

    such that for each i, Yi ;6 xi where xi is the ith term in the decimal expansion of xl Clearly,such a number exists and is in [0, 1]. But then for every i, Y , so thatY cannot be in thelist {xl, x2,x3, . .. J. Thus, the list (A.18) is not complete in that it does not include all theelements of [0, 1].

    The cardinality of [0, 1] is denoted l'{1, and is strictly greater than l'{o. In this sense wecan say that the continuum [0, 1] has more elements than the denumerable set Natura/s,even though both sets have infinite size.

    The obvious question is whether there are cardinalities larger than l'{1' The answer isyes; in fact, there are sets of ever higher cardinality,

    l'{o < l'{1 < l ' {2 , ' "

    and sets with cardinality larger than all of these!

    a representative for an element of a set. A predicate over a set is an expressioninvolving a variable that evaluates to true or false when the variable is assigneda particular element of the set. Predicates are used to construct new sets fromexisting sets. If the variable in a predicate is quantified, the expression becomean assertion.

    Sets can be combined using the operations of union, intersection, and complement. The corresponding operations on predicates are disjunction, conjunction, and negation. New sets can also be obtained by the product of two sets.

    There are precise rules that must be followed in using these operations. Thcollection of these rules is the syntax of sets and predicates. By parsing a compleexpression, we can determine whether it is well formed. The truth value ofpredicate constructed from elementary predicates using predicate operationcan be calculated using the parse tree and the truth table.

    Functions are mathematical objects representing a relationship between twosets, the domain and the range of the function. We have introduced the followingpatterns of expressions for functions

    f,g, h,Score, . . . , names of functions,f:X --)- Y,X domain(f), Y = range(f), a function from X to Y.

    A function f:X --)- Y assigns to each value x E X a value f(x) E Y.

    Sets are mathematical objects representing collections of elements. A variable i

  • 8/8/2019 Lee Appendix A

    25/28

    KEY: E = mechanical T =requires plan of attack C=more tC1an 1 answer 'E 1. In the spirit of figure A.2, give a pic ture of the following sets:

    (a ) {l,2,3},(b) [0,1] x to, 1),(c ) [O,lJx[a,b].(d ) {l,2,3} x {a,b},(e) {a, b} x [0, I].

    E 2. How many elements are there in the sets (a) {l, . . . ,6}, (b ) {-2, - I , . . . ,1O}, and (c ) to, 1, 2} x {2,3}?

    T 3. Determine which of the following expressions are true and which arefalse:(a ) "I n E Naturals, n> 1,(b) 3 n E Naturals, n < 10,(c) I fA={l ,2,3}andB={2,3,4} , then"lxEA,"IYEB, x::sy,(d ) HA = {l, 2,3} and B = {2,3,4}, then "I x EA, 3y E B, x ::sy,(e) !fA = {l,2,3} andB = {2, 3,4}, then 3x EA, "I y EB, x ::sy.

    T 4. In the following figure, X = {(x,Y) Ix 2 + y2 = I} is depicted as a twodimensional circle and Z = [0, 2] is shown as a one-dimensional linesegment. Explain why it is reasonable to show the product set as a threedimensional cylinder.

    o XxZZ xE 5. In the spirit of figure A.2, give a picture forthe productset (M, Tu, W, Th,F}

    x [8.00, 17.00J and indicate on your drawing the lecture hours for thisclass.

    E 6. In the spirit of figure A.2, give a picture for the set A= {(x ,Y) Ix E [1,2], Y E[1,2]} and the set B = {(x, x) Ix E [1, 2]}. Explain why the two sets aredifferent.

    2xe' lclsu: 615

    EXERCISES

  • 8/8/2019 Lee Appendix A

    26/28

    616 AP PE NDIX A: Sets ahd dUhctwl1S

    c 7. Give a precise expression for the predicate belowso that Triangle is indeea triangle:Triangle = ((x,Y) E Real52 IPred(x,Y)}.

    There are many ways of writing this predicate. One way is to expresPred(x,y) as the conjunction of three linear inequality predicates. HinWe used the conjunction of two linear inequality predicates in figure AA

    T 8. IfX has m elements and Y has n elements, how many elements are therin X x Y? If Xi has mi elements, for I = 1, . . . ,/ , for some constant /, howmany elements are there in

    i= /DXi=X j x xX,?i= l

    T 9. How many different 10-1etter strings are there if each letter is drawn fromthe set Alphabet consisting of the 26 lowercase letters of the alphabetHow many such strings are there with exactly one occurrence of thletter a?

    T 10. Recall that a set cannot contain duplicate elements. Now suppose Xcontains 10 elements.(a) How many two-element combinations of elements fromX are there(b ) How many two-element permutations are there?

    ell. Construct predicates for use in the prototype (AA) to define the followingsets. Define them in terms of examples of sets introduced in this appendix(a) The set of U.S. cities with a population exceeding 1 million.(b) The male students in a class.(c) The old books in the library.

    T 12. Which of the following expressions are wel l formed? For those that are weformed, state whether they are assertions. For those that are assertionsevaluate the assertion to true or false. For those that are not assertionsfind an equivalent simpler expression.(a) 2 E {I, 3, 4},(b) 3c{l,3.4},(c) {3}c{l,2,3},(d) 2U{I,3.4},(e) {2} U {I, 3.4},

  • 8/8/2019 Lee Appendix A

    27/28

    2Xe'lcise!1 617

    (D [2.3,3.4] = {x E Reals 12.3 S x S 3.4},(g) {x E Reals 1x > 3 1\ X < 4},(h) [ l,2]n [3,4)=0.

    E 13. Define the following sets in terms of the sets named in section A.1.S.(a ) The se t of all 1 )..letter passwords.(b ) The set of ailS x 6 matrices of real numbers.(c ) The se t of all complex numbers with magnitude at most 1.(d) The set of all two-dimensional vectors with magnitude exactly 1.

    E 14. Give the se t of all subse ts P(X) of the se t X = {a, b, c}.T 15. Suppose a se t X has n elements. Let P(X) be the power se t of X. How

    many elements are there in P(X)?T 16. Use MATLA.8 to depict the following sets using the plot command:

    (a) {(t, x) E Reals2 1 x = sin(l), and t E {O, ~ 2 l t , to 2lt, . . . , ~ g 2 l t } } ,(b) {cy,x) E Rea/s2 lY = eX, andx E {-I, - I + ~ , 1+ to, ... ,I}}.(c) {cy,x)EReals2 I y=e -x , a n d x E { - I , - l + ~ , - I + t o , . . . ,I}}.

    T 17. Determine which of the following functions are onto, which are one-toone, an d which are neither, and give a short explanation for your answer.(a ) License:CalVehicles -+ Char* given by Vvehicle E CalVehicles,

    License(vehicle) is the California license number of the vehicle(b) f:Reals -+ [-2,2], given by Vx E Reals, f(x) = 2 sin(x)(c) f:Reals -+ Reals, given by Vx E Reals, f(x) = 2 sin(x)(d ) conj:Complex -+ Complex, the complex conjugate function(e ) f:Complex -+ Reals2, given byV z E Complex, fez) = (Re(z),lm(z)),

    where Re(z) is the real part of z and Im(z) is the imaginary part of z.2 2 2CO M:Reals -+ Reals , V (xl,x2) E Rea/s ,

    M(XJ, X2) = CYl,Y2),where

    n[ ~ ~ ]= [ ~ ~ ] .(g) Zero:Reals4 -+ Rea/s4, Vx E Reals4, Zero(x) (0,0,0,0)

  • 8/8/2019 Lee Appendix A

    28/28

    618 A P PEN D I X A: Sets and tunctions

    T 18. letA, B, and C be arbitrary sets. Letf:A -+ Aand g:A -+ A be two functionswith domain and range A. Which of the following assertions is true forall choices of A, B, C, f, and g'? Note that fog is function composition,defined in section 2.1.5. X \ Y is the complement of Y in X, as explainedin section A.l.6. P(X) is the power set of X, as explained in section A.l.2.(a) (A U B) \ C = (A \ C) U (B \ C).(b) peA U B) = peA) U PCB).(c ) f og=go f .(d) If both f and g are one-to-one, then fog is one-to-one.

    E 19. Each of the following expressions is intended to be a predicate expression. Determinewhether it is true or false, orwhether it is not well formed,or has a free variable. If it has a free variable, identify the free variable.(a) Y sets x, x c P(x), where P(x) is the power set of x.(b) 3 x E Reals, {x E Integers Ix + 3 = 1O}.(c) YnENaturals, n 2=} (n,n+ 1) E {1,2,3}2.(d) 3x E Naturals, x + y 10.