Relations: Operations & Properties. Power Sets Set of all subsets of a set A. –A = {1,2} –P(A) = 2 A = { {}, {1}, {2}, {1,2} } We note that each element.

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

Functions Reading: Epp Chp 7.1, 7.2, 7.4
Relations Relations on a Set. Properties of Relations.
Discussion #27 Chapter 5, Sections /15 Discussion #27 Closures & Equivalence Relations.
The Engineering Design of Systems: Models and Methods
Chapter 7 Relations : the second time around
Discussion #25 1/13 Discussion #25 Set Topics & Applications.
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
Relations binary relations xRy on sets x  X y  Y R  X  Y Example: “less than” relation from A={0,1,2} to B={1,2,3} use traditional notation 0 < 1,
Theory and Applications
Discussion #26 Chapter 5, Sections /15 Discussion #26 Binary Relations: Operations & Properties.
Discrete Mathematics Lecture#11.
Partially Ordered Sets (POSets)
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Section 1.8: Functions A function is a mapping from one set to another that satisfies certain properties. We will first introduce the notion of a mapping.
CSE 460: Switching Theory David M. Zar
Exam 2 Review 8.2, 8.5, 8.6, Thm. 1 for 2 roots, Thm. 2 for 1 root Theorem 1: Let c 1, c 2 be elements of the real numbers. Suppose r 2 -c 1.
Mathematics. Session Set, Relation & Function Session - 3.
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
INM175 Topic 7 1 Module INM175 Discrete Mathematics Topic 7 Set Theoretic Models.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
R. Johnsonbaugh, Discrete Mathematics 5 th edition, 2001 Chapter 2 The Language of Mathematics.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
1 Annoucement n Skills you need: (1) (In Thinking) You think and move by Logic Definitions Mathematical properties (Basic algebra etc.) (2) (In Exploration)
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Sets Define sets in 2 ways  Enumeration  Set comprehension (predicate on membership), e.g., {n | n  N   k  k  N  n = 10  k  0  n  50} the set.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Discrete Mathematics R. Johnsonbaugh
Discrete Mathematics Relation.
Relations and their Properties
CHAPTER 3 FUZZY RELATION and COMPOSITION. 3.1 Crisp relation Product set Definition (Product set) Let A and B be two non-empty sets, the product.
Sets. Definitions (I) Collection of elements such that: There are no duplicates There is no order Special sets Universe (U or E): all elements under consideration.
Mathematical Preliminaries
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
Discrete Mathematics Lecture # 15 Types of Relations (contd.)
Basic Structures: Sets, Functions, Sequences, and Sums.
DISCRETE COMPUTATIONAL STRUCTURES
1 Discrete and Combinatorial Mathematics R. P. Grimaldi, 5 th edition, 2004 Chapter 5 Relations and Functions.
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
Relations Section 9.1, 9.3—9.5 of Rosen Spring 2012
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
RelationsCSCE 235, Spring Introduction A relation between elements of two sets is a subset of their Cartesian products (set of all ordered pairs.
Set Theory Concepts Set – A collection of “elements” (objects, members) denoted by upper case letters A, B, etc. elements are lower case brackets are used.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 41 May 7, 2008.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Relations and Their Properties
Chapter 5 Relations and Operations
CSE 2813 Discrete Structures
Unit-III Algebraic Structures
Partial Orderings CSE 2813 Discrete Structures.
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Equivalence Relations
Relations Chapter 9.
Partial Orderings.
Relations and Digraphs
Dr. Ameria Eldosoky Discrete mathematics
Cartesian product Given two sets A, B we define their Cartesian product is the set of all the pairs whose first element is in A and second in B. Note that.
Relations: Operations & Properties
CS201: Data Structures and Discrete Mathematics I
Sungho Kang Yonsei University
Relations: The Second Time Around
Presentation transcript:

Relations: Operations & Properties

Power Sets Set of all subsets of a set A. –A = {1,2} –P(A) = 2 A = { {}, {1}, {2}, {1,2} } We note that each element of A is either present (1) or not present (0). If we treat the elements of A as a sequence, we get a bit-string that represents the set. –If A = {a,b,c,d}, we can order the elements in a sequence. –Then, we can let the bit-string say which elements are present: e.g means {b,c}. –We can represent all the subsets of A, from  = 0000 to U = This bit-string notation also helps us know the number of subsets in the powerset (just count in binary) –2 #A, 2 |A| = 2 · 2 · … · 2(|A| times) –This motivates the notation 2 A for the power set.

Bit-String Operations on Power Sets With bit string representations –Set intersection:  = pairwise  –Set union:  = pairwise  –Set complement: ~ = bit complement –Set minus: – = mask out using 1’s = complement 2 nd operand and do pairwise  E.g. using {a,b,c,d} –1011  1101 = 1001i.e. {a,c,d}  {a,b,d} = {a,d} –1011  1101 = 1111i.e. {a,c,d}  {a,b,d} = {a,b,c,d} –~1011 = 0100i.e. ~{a,c,d} = {b} –1010 – 1100 = 0010i.e. {a,c} – {a,b} = {c}

Binary Relations Sets of ordered 2-tuples (pairs) with values selected from domains (sets) Formally, a relation R from set A to set B is a set of pairs (x,y) such that x  A and y  B. We may write R:A  B to express this. –R  A  B –If (x,y)  R, we say that x is R-related to y; we may also write xRy. –Example: NNN<: N  N (where N is the set of natural numbers) (2,3)  < or 2<3 –Predicates also define relations <:{0,1,2}  {  1,0,1,2}= {(x,y) | x  {0,1,2}  y  {  1,0,1,2}  x < y} = { (0,1), (0,2), (1,2) }

Representations for Binary Relations Tables < Matrices Graphs - directed graph or digraph - directed arcs

Domains and Ranges for Binary Relations Let R = {(0,1), (0,2), (1,2)}, then Domain of R = dom R = dom(R) = {x |  y((x,y)  R)} –i.e. {0,1} –like  X R Range of R = ran R = ran(R) = {y |  x((x,y)  R)} –i.e. {1,2} –like  Y R Range Space Range Domain Space Domain

Inverse If R: A  B, then the inverse of R is R ~ : B  A. R -1 is also a common notation R ~ is defined by {(y,x) | (x,y)  R}. –If R = {(a,b), (a,c)}, then R ~ = {(b,a), (c,a)} –> is the inverse of < on the reals Note that R ~  ~R –The complement of < is  –But the inverse of

Set Operations Since relations are sets, set operations apply (just like relational algebra). The arity must be the same  indeed, the sets for the domain space and range space must be the same (just like in relational algebra).

Restriction & Extension Restriction decreases the domain space or range space. Example: Let < be the relation {(1,2), (1,3), (2,3)}. The restriction of the domain space to {1} restricts < to {(1,2), (1,3)}. Extensions increase the domain space or range space. Example: Let < be the relation {(1,2), (1,3), (2,3)}. The extension of both the domain space and range space to {1,2,3,4} extends < to {(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)} Extensions and restrictions need not change the relation. –Suppose {M 1, M 2, M 3 } are three males and {F 1, F 2, F 3 } are three females and married_to is {(M 1,F 3 ), (M 2,F 2 )}. –Removing the unmarried male M 3 or the unmarried female F 1 does nothing to the relation, and adding the unmarried male M 4 or the unmarried female F 4 does nothing to the relation.

Composition Let R:A  B and S:B  C be two relations. The composition of R and S, denoted by R  S, contains the pairs (x,z) if and only if there is an intermediate object y such that (x,y) is in R and (y,z) is in S. Given R:A  B and S:B  C, with A = {1,2,3,4}, B = {1,2,3,4,5}, C = {1,2,3,4}, and R = {(1,3), (4,2), (1,1)} and S = {(3,4), (2,1), (4,2)}, we have: R  S = {(1,4), (4,1)} S  R = {(3,2), (2,3), (2,1)} (i.e. not commutative) R  (S  R) = {(1,2), (4,3), (4,1)} (R  S)  R = {(1,2), (4,3), (4,1)} (i.e. is associative) R S Graphically:

Composition & Matrix Multiplication Relation matrices only contain 0’s and 1’s. For relational matrix multiplication, use  for *,  for +, with 1=T and 0=F R S R  S (1,1) = (1  0)  (0  1)  (1  0)  (0  0)  (0  0) = RSRS  = R  S = {(1,4), (4,1)}

Combined Operations All operations we have discussed can be combined so long as the compatibility requirements are met. Example: R = {(1,1), (3,1), (1,2)} S = {(1,1), (2,3)} (R  S) ~  R = {(1,1), (3,1), (1,2), (2,3)} ~  R = {(1,1), (1,3), (2,1), (3,2)}  R = {(1,1), (1,2), (2,1), (2,2)} R: A  B S: B  A A = {1,2,3} B = {1,2,3}

Properties of Binary Relations Properties of binary relations on a set R: A  A help us with lots of things  groupings, orderings, … Because there is only one set A: –matrices are square |A|  |A| –graphs can be drawn with only one set of nodes R = {(1,3), (4,2), (3,3), (3,4)}

Reflexivity Reflexive:  x(xRx) =, , “is in same major as”, etc. Reflexive IrreflexiveNeither Note: e.g., “loves”e.g., <

Symmetry Symmetric:  x  y(xRy  yRx) Antisymmetric:  x  y(xRy  yRx  x = y) “sibling” is symmetric  are antisymmetric (if a  b and b  a, then a=b) = is symmetric and antisymmetric “loves” is neither symmetric nor antisymmetric (always both ways) (but to self is ok) (never both ways) Note: antisymmetry is NOT asymmetry

Transitivity Transitive:  x  y  z(xRy  yRz  xRz) “taller” is transitive < is transitivex<y<z “ancestor” is transitive “brother-in-law” is not transitive Transitive: “If I can get there in two, then I can get there in one.” (for every x, y, z) if and then x y z

Transitivity (cont’d) Note: xRy  yRz corresponds to xR  Rz, which is equivalent to xR×Rz = xR 2 z; thus we can define transitivity as:  x  y  z(xR 2 z  xRz) “If I can get there in two, then I can get there in one.” For transitivity: –if reachable through an intermediate, then reachable directly is required. –if (x,z)  R 2, then (x,z)  R  (x,z)  R 2  (x,z)  R  R 2  R ( recall our def. of subset: x  A  x  B, then A  B)

Transitivity (cont’d)  =  = R R R 2  R R R Not Transitive Transitive 1 2 3

Closures & Equivalence Relations

Closure Closure means adding something until done. –Normally adding as little as possible until some condition is satisfied –Least fixed point similarities

Reflexive Closure Reflexive closure of a relation: R (r) –smallest reflexive relation that contains R (i.e. fewest pairs added) –R (r) = R  I A (R is a relation on a set A, and I A is the identity relation  1’s on the diagonal and 0’s elsewhere.) R = R (r) =  x (xRx)

Symmetric Closure Symmetric closure of a relation: R (s) –smallest symmetric relation that contains R (i.e. fewest pairs added) –R (s) = R  R ~ (R ~ is R inverse) R = R ~ = R  R ~ =  x  y(xRy  yRx)

Transitive Closure Transitive closure of a relation: R (t) = R + –smallest transitive relation that contains R (i.e. fewest pairs added) –for each path of length i, there must be a direct path. (This follows from x  y, y  z  x  z; since, if we also have v  x, we must have v  z, a path of length 3.) –R (t) = R  R 2  R 3  …  R |A|. (No path can be longer than |A|, the number of elements in A.)

R  R 2  R 3 = R×R 2 = R 3 = Transitive Closure – Example R = R 2 = All paths of length 3 All paths of length 2 All paths of length

Transitive Closure – Example R = R 2 = R×R 2 = R 3 = R  R 2  R 3 = All paths of length 3 All paths of length 2 Paths of any length All paths of length 1

Reflexive Transitive Closure Reflexive transitive closure of a relation: R * –smallest reflexive and transitive relation that contains R –R * = I A  R + = R 0  R + = R 0  R 1  R 2  …R |A| Example: I A = R 0 = R 1  R 2  R 3 = R 0  R 1  R 2  R 3 =

Equivalence Relations A relation R on a set A is an equivalence relation if R is reflexive, symmetric, and transitive. –Equivalence relations are about “equivalence” –Examples: = for integersx = xreflexive x = y  y = xsymmetric x=y  y=z  x=ztransitive = for setsA = Areflexive A = B  B = Asymmetric A=B  B=C  A=Ctransitive Let R be “has same major as” for college students xRx  reflexive: same major as self xRy  yRx  symmetric: same major as each other xRy  yRz  xRz  transitive: same as, same as  same as

Partitions A partition of a set S is –a set of subsets S i=1,2,…n of S –such that  n i=1 S i = S, S j  S k =  for j  k. Each S i is called a block (also called an equivalence class) Example: –Suppose we form teams (e.g. for a doubles tennis tournament) from the set: {Abe, Kay, Jim, Nan, Pat, Zed} then teams could be: { {Abe, Nan}, {Kay, Jim}, {Pat, Zed} } Note: “on same team as” is reflexive, symmetric, transitive  an equivalence relation. Equivalence relations and partitions are the same thing (two sides of the same coin).

Partitions (cont’d) Since individual elements can only appear in one block (S j  S k =  for j  k), blocks can be represented by any element within the block. e.g.Nan’s Team Jimmer’s 2011 sweet-16 team Formally, [x] = set of all elements related to x and y  [x] iff xRy e.g.[Nan] represents {Abe, Nan}, Nan’s team [Abe] represents {Abe, Nan}, Abe’s team [Jimmer] represents the set of players who played on BYU’s 2011 sweet-16 team

Partitions & Equivalence Relations The mod function partitions the natural numbers into equivalence classes. –0 mod 3 = 0 so 0 forms a class [0] –1 mod 3 = 1 so 1 forms new class [1] –2 mod 3 = 2 so 2 forms new class [2] –3 mod 3 = 0 so 3 belongs to [0] –4 mod 3 = 1 so 4 belongs to [1] –5 mod 3 = 2 so 5 belongs to [2] –6 mod 3 = 0 so 6 belongs to [0] –… Thus, the mod function partitions the natural numbers into equivalence classes. –[0] = {0, 3, 6, …} –[1] = {1, 4, 7,…} –[2] = {2, 5, 8, …} Example:

Partitions  Equivalence Relations Theorem: If {S 1, …, S n } is a partition of S, then R:S  S is an equivalence relation, where R is “in same block as.” Note: to prove that R is an equivalence relation, we must prove that R is reflexive, symmetric, and transitive. Proof: Reflexive: since every element is in the same block as itself. Symmetric: since if x is in the same block as y, y is in the same block as x. Transitive: since if x and y are in the same block and y and z are in the same block, x and z are in the same block.

Equivalence Relations  Partitions Theorem: If R:S  S is an equivalence relation and [x] = { y | xRy }, then { [x] | x  S } is a partition P of S. Note: to prove that we have a partition, we must prove (1) that every element of S is in a block of P, and (2) that for every pair of distinct blocks S j and S k (j  k) of P, S j  S k = . Proof: (1) Since R is reflexive, xRx, every element of S is at least in its own block and thus in some block of P. (2) Suppose S j  S k   for distinct blocks S j and S k of P. Then, at least one element y is in both S j and S k. Let S j = {y, x 1, … x n } and S k = {y, z 1, … z m }, then yRx i, i=1, 2, …, n, and yRz p, p=1, 2, …, m. Since R is symmetric, x i Ry, and since R is transitive x i Rz p. But now, since the elements of S j are R-related to the elements of S k, x 1, …, x n, y, z 1, …, z m are together in a block of P and thus S i and S k are not distinct blocks of P.

Partial Orders

Total orderings: single sequence of elements Partial orderings: some elements may come before/after others, but some need not be ordered Examples of partial orderings: foundation framing plumbingwiring finishing {a, b, c} {a, b}{a, c}{b, c} {a}{b}{c}  “must be completed before” “set inclusion,  ”

Partial Order Definitions (Poset Definitions) A relation R: S  S is called a (weak) partial order if it is reflexive, antisymmetric, and transitive A relation R: S  S is called a strict partial order if it is irreflexive, antisymmetric, and transitive e.g.  on the integers e.g. < on the integers

Total Order A total ordering is a partial ordering in which every element is related to every other element. (This forces a linear order or chain.) Examples: R:  on {1, 2, 3, 4, 5} is total. Pick any two; they’re related one way or the other with respect to . {a,b} {a} {b}  R:  on {{a, b}, {a}, {b},  } is not total. We can find a pair not related one way or the other with respect to . {a} & {b}: neither {a}  {b} nor {b}  {a}

Hasse Diagrams We produce Hasse Diagrams from directed graphs of relations by doing a transitive reduction plus a reflexive reduction (if weak) and (usually) dropping arrowheads (using, instead, “above” to give direction) 1) Transitive reduction  discard all arcs except those that “directly cover” an element. 2) Reflexive reduction  discard all self loops.  {b}{a} {a, b}  {b}{a} {a, b}  For  we write:

Upper and Lower Bounds If a poset is built from relation R on set A, then any x  A satisfying xRy is an upper bound of y, and any x  A satisfying yRx is a lower bound of y. Examples: If A = {a, b, c} and R is , then {a, c} - is an upper bound of {a}, {c}, and . - is also an upper bound of {a, c} (weak poset). - is a lower bound of {a, b, c}. - is also a lower bound of {a, c} (weak poset).

Maximal and Minimal Elements If a poset is built from relation R on set A, then y  A is a maximal element if there is no x such that xRy, and x  A is a minimal element if there is no y such that xRy. (Note: We either need the poset to be strict or x  y.) In a Hasse diagram, every element with no element “above” it is a maximal element, whereas every element with no element “below” it is a minimal element. Maximal elements Minimal elements

Least Upper and Greatest Lower Bounds A least upper bound of two elements x and y is a minimal element in the intersection of the upper bounds of x and y. A greatest lower bound is a maximal element in the intersection of the lower bounds of x and y. Examples: –For , {a, c} is a least upper bound of {a} and {c},  is a greatest lower bound of {a} and {b, c}, and {a} is a least upper bound of {a} and . –For the following strict poset, lub(x,y) = {a,b}, lub(y,y) = {a,b,c}, lub(a,y) = , glb(a,b) = {x,y}, glb(a,c) = {y} a b x y c

Functions

A function is a special kind of binary relation. A binary relation f  A  B is a function if for each a  A there is a unique b  B Function Definition α β γ x y

NOT Functions α β γ f = {(1, α), (2, β)} “For each” violated Some x’s do not have corresponding y’s x y

NOT Functions Uniqueness violated for some x’s x y α β γ f = {(1, α), (2, β), (3, β), (3, γ)} uniqueness violated for 3  appears twice

An (n+1)-ary relation f  A 1  A 2  …  A n  B is a function if for each  A 1  A 2  …  A n there is a unique b  B. Functions with N-Dimensional Domains α β γ

We can use various notation for functions: for f = {(1, α),(2, β),(3, β)} Notation for Functions Notation (x, y)  f f : x→yy = f(x) Example (2, β)  f f : 2→ββ = f(2) In the notation, x is the argument or preimage and y is the image. We can also have the image of a set of arguments. For functions with n-ary domains, use in place of x.

Function Domain and Range f : A → B –A is the domain space same as the domain (since all elements participate) dom f, dom(f), or domain(f) –B is the range space may or may not be the same as the range, which is: –{y |  x(y=f(x))} –All rhs values in pairs (all that get “hit”) –  B f ran f, ran(f), range(f) f : D 1  D 2  …  D n → Z f : D n → Z (when all domains are the same)

Remove the requirement that each a  A must participate. Retain the uniqueness requirement. Partial Functions Partial Function: α β γ f = {(, β),(, β),(, γ)} not unique α β γ NOT a Partial Function: α β γ Partial Function: (A Total Function is also a Partial Function.)

Identity Function –I A : A → A –I A = {(x, x) | x  A} Constant Function –C : A → B –C = {(x, c) | x  A  c  B } –Often A and B are the same C : A → A C= {(x, c) | x  A  c  A} Special Functions

Overloading The same name can be used for different functions depending on the domain. Examples a – b Means number subtraction if a and b are numbers Means set subtraction if a and b are sets a + b Implemented differently for integers and reals Could potentially be overridden and implemented by a programmer for very long integers

Composition of Functions Composition is written “°” Range space of f = domain space of g a c f g b α β 3 f(a) = 2g(2) = αg(f(a)) = α g ° f(a) = α f(b) = 2g(2) = αg(f(b)) = α g ° f(b) = α f(c) = 4g(4) = βg(f(c)) = β g ° f(c) = β

Injection: “one-to-one” or “1-1” –  x  y(f(x) = f(y)  x = y) –For f : A → B, the elements in B are “ hit ” at most once Injection a b d c Injective a b d c NOT Injective x y x y

Surjection: “onto” –  y  x(y = f(x)) –For f : A → B, the elements in B are all “ hit ” at least once Surjection a b c 3 SurjectiveNOT Surjective x y x y a b c 3 { not “hit”

Bijection: “one-to-one and onto” or “1-1 correspondence” –  x  y(f(x) = f(y)  x = y)   y  x(y = f(x)) –For f : A → B, every B element is “ hit ” once and only once Bijection 1 2 a b c 3 BijectiveNOT Bijective x y x y a b c 3 NOT Surjective NOT injective

Notes on Bijection 1.|A| = |B| –An “extra” B cannot be “hit” (not a surjection) –An “extra” A requires that at least one B must be “hit” twice (not an injection) 2.If f is a bijection, swapping the elements of the ordered pairs is a function –Called the inverse –Denoted f -1 –Is also a bijection –f -1 (f(x)) is the identity function, i.e. f -1 (f(x)) = x.

Notes on Bijection (cont’d) 3.The inverse of an injection is a partial function. If f : A →B is an injection, then f -1 is a partial function 4.Restricting the range space of an injective function to the range yields a bijection Remove b a b d c f a b d c f -1

NR[0..1] Which is bigger? N or R[0..1]? NR[0..1] Assume |N| = |R[0..1]|, then there exists a bijection: … …diagonalization … R[0..1] But now there exists a number in R[0..1] such that d 1 = not 3, d 2 = not 4, d 3 = not 0, …. Hence, not surjective and thus not bijective.

NZ Which is bigger? N or Z? f(x) = x odd: (x+1)/−2 x even: x/2 y negative: −2x−1 y positive: 2x g(y) = { { x y − −2 4 2 NZNZ Since g = f −1, there is a bijection from N to Z and thus |N| = |Z|. N Countable if same cardinality as some subset of N. N Alternatively, a set S is countable if there exists an injective function from S to N.