Mathematics for Computer Science MIT 6.042J/18.062J Sets & Functions What is a Set? Informally: set is a collection of mathematical objects, with the collection treated as a single mathematical object. (This is circular of course: what s a collection?) lec 2F.1 lec 2F.2 Some sets real numbers, R complex numbers, C integers, Z empty set, set of all subsets of integers, pow(z) the power set Some sets {7, lbert R., π/2, T} set with 4 elements: two numbers, a string, and a oolean. Same as {T, lbert R., 7, π/2} -- order doesn t matter lec 2F.3 lec 2F.4 Membership x is a member of : x π/2 {7, lbert R., π/2, T} π/3 {7, lbert R., π/2, T} 14/2 {7, lbert R., π/2, T} Synonyms for Membership x x is an element of x is in Examples: 7 Z, 2/3 Z, Z pow(r) lec 2F.5 lec 2F.6 1
In or Not In n element is in or not in a set: {7, π/2, 7} is same as {7, π/2} (No notion of being in the set more than once) Subset ( ) is a subset of is contained in Every element of is also an element of : x [x IMPLIES x ] lec 2F.7 lec 2F.8 examples: Subset Z R, R C, {3} {5,7,3}, every set everything def: x [x IMPLIES x ] false true lec 2F.9 lec 2F.10 New sets from old union Venn Diagram for 2 Sets lec 2F.14 lec 2F.15 2
intersection set difference lec 2F.16 lec 2F.17 set-theoretic equality set-theoretic equality ( C) = ( ) ( C) proof: Show these have the same elements, namely, x Left Hand Set iff x RHS for all x. ( C) = ( ) ( C) proof uses fact from last time: P OR (Q ND R) equiv (P OR Q) ND (P OR R) lec 2F.18 lec 2F.19 set-theoretic equality set-theoretic equality ( C) = ( ) ( C) proof: x ( C) x OR x ( C) iff (def of ) iff x OR (x ND x C) (def ) iff (x OR x ) ND (x OR x C) (by the equivalence) proof: (x OR x )ND(x OR x C) iff (x )ND(x C) (def ) iff x ( ) ( C) (def ). QED lec 2F.20 lec 2F.21 3
is taking subject relation Relations & Functions students is taking subjects 6.042 6.003 6.012 lec 2F.25 Feb 17 Image by MIT OpenCourseWare. Copyright lec 2F.26 formula evaluation relation arithmetic formulas numbers evaluates to 1+2 3 nonstop bus trip relation cities cities nonstop bus oston oston sqrt(9) Providence Providence 50/10 3 2 New York New York Feb 17 Copyright lec 2F.27 lec 2F.28 inary relations binary relation, R, from a set to a set associates of elements of with elements of. inary relation R from to domain R: codomain b 1 a 1 b 2 a 2 b 3 a 3 arrows b 4 lec 2F.33 Feb 17 lec 2F.34 4
inary relation R from to domain R: codomain b 1 inary relation R from to R: b 1 a 1 b 2 a 1 b 2 a 2 b 3 a 2 b 3 a 3 b 4 Feb. 17, a 3 graph(r) ::= the arrows b 4 lec 2F.35 Feb. 17, graph(r) = {(a 1,b 2 ), (a 1,b 4 ), (a 3,b 4 )} lec 2F.37 archery on relations,, = 1 arrow out,,= 1 arrow in f: function, f, from to is a relation which associates each element, a, of with at most one element of. called f(a) Feb. 17, 2009 lec 2F.38 Feb. 17, lec 2F.39 function archery function archery 1 arrow out 1 arrow out Feb. 17, 2009 lec 2F.40 Feb. 17, 2009 lec 2F.41 5
function archery 1 arrow out f( ) = total relations R: is total iff every element of is associated with at least one element of Feb. 17, 2009 lec 2F.42 Feb. 17, 2009 lec 2F.44 total relation archery total relation archery 1 arrow out 1 arrow out Feb. 17, 2009 lec 2F.45 Feb. 17, 2009 lec 2F.46 1 arrow out total relation archery total & function archery exactly 1 arrow out f( ) = Feb. 17, 2009 lec 2F.47 Feb. 17, 2009 lec 2F.49 6
surjections (onto) R: is a surjection iff every element of is associated with some element of surjection archery 1 arrow in Feb. 17, 2009 lec 2F.53 Feb. 17, 2009 lec 2F.54 surjection archery surjection archery 1 arrow in 1 arrow in Feb. 17, 2009 lec 2F.55 Feb. 17, 2009 lec 2F.56 surjective & function injection archery 1 arrow out 1 arrow in 1 arrow in Feb. 17, 2009 lec 2F.58 Feb. 17, 2009 lec 2F.62 7
injection archery injection archery 1 arrow in 1 arrow in Feb. 17, 2009 lec 2F.63 Feb. 17, 2009 lec 2F.64 bijection archery exactly 1 arrow out exactly 1 arrow in Team Problems Problems 1 3 Feb. 17, 2009 Copyright lbert R. February Meyer, 12, 2009. 2010 ll rights reserved. lec 2F.69 lec 2F.71 8
MIT OpenCourseWare http://ocw.mit.edu 6.042J / 18.062J Mathematics for Computer Science Spring 2010 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.