Professional Documents
Culture Documents
Cardinality
(another)Denition:ThecardinalityofasetAis
equaltothecardinalityofasetB,denoted
|A|=|B|,
ifandonlyifthereisabijectionfromAtoB.
IfthereisaninjectionfromAtoB,thecardinalityof
AislessthanorthesameasthecardinalityofBand
wewrite|A||B|.
Cardinality
Denition:Asetthatiseitherniteorhasthesame
cardinalityasthesetofpositiveintegers(Z+)iscalled
countable.Asetthatisnotcountableisuncountable.
Thesetofallnitestringsoverthealphabetof
lowercaselettersiscountable.
ThesetofrealnumbersRisanuncountableset.
ShowingthataSetisCountable
Aninnitesetiscountableifandonlyifitispossible
tolisttheelementsofthesetinasequence(indexed
bythepositiveintegers).
Thereasonforthisisthatabijectionffromthesetof
positiveintegerstoasetScanbeexpressedinterms
ofasequencea1,a2,,an,wherea1=f(1),a2=
f(2),,an=f(n),
ShowingthataSetisCountable
Example1:Showthatthesetofpositiveevenintegersis
countableset.
Proof:LetEbethesetofevenintegersandf(x)=2xbea
functionfromNtoE.
123456..0
24681012
ThenfisabijectionfromNtoEsincefisbothonetoone
andonto.Toshowthatitisinjective,supposethatf(n)
=f(m).Then2n=2m,andson=m.Toseethatitis
surjective,supposethattissomeevenpositiveinteger.
Thent=2kforsomepositiveintegerkandf(k)=t.
ShowingthataSetisCountable
Example2:ShowthatthesetofallintegersZis
countable.
Proof:Wecanlisttheintegersinasequence:
0,1,1,2,2,3,3,..0
LetfbeafunctionfromNtoZdenedas
Whenniseven:f(n)=n/2
Whennisodd:f(n)=(n1)/2
thatgeneratesthislist.Wenowshowthatthisfunction
isabijection.Firstweshowthatitisinjectivebycase
analysisontheparityofN.
ShowingthataSetisCountable
Letmandnbetwoevennaturalnumbers,then
f(m)=m/2andf(n)=n/2,itfollowsthatf(m)=f(n)impliesm=n.
Letmandnbetwooddnaturalnumbers,then
f(m)=(m1)/2andf(n)=(n1)/2,itfollowsthatf(m)=f(n)
impliesm=n.
Therefore,fisinjective.Wenowshowthatfissurjectivebycase
analysisonthesignofsomeintegertinZ.
Lettbepositive,thentwillappearinanevenpositioninthe
sequence,thusf(2k)=2k/2=twitht=k.Thisimpliesthatfor
everypositivevaluetinZthereisanaturalnumber2k.
Lettbenegative,thentwillappearinanoddpositioninthe
sequence,thusf(2k1)=(2k11)/2=twitht=k.Thisimpliesthat
foreverynegativevaluetinZthereisanaturalnumber2k1.
Therefore,fissurjective.(QED)
Strings
Example4:ShowthatthesetofnitestringsSover
thelowercaselettersiscountablyinnite.
Proof:Showthatthestringscanbelistedinasequence.
Firstlist
1. Allthestringsoflength0inalphabeticalorder.
2. Thenallthestringsoflength1inlexicographic(asin
adictionary)order.
3. Thenallthestringsoflength2inlexicographicorder.
4. Andsoon.
ThisimpliesabijectionfromNtoSandhenceitisa
countablyinniteset.
ThesetofallJavaprogramsis
countable.
Example5:ShowthatthesetofallJavaprogramsiscountable.
Solution:LetSbethesetofstringsconstructedfromthe
characterswhichcanappearinaJavaprogram.Usethe
orderingfromthepreviousexample.Takeeachstringinturn:
FeedthestringintoaJavacompiler.(AJavacompilerwill
determineiftheinputprogramisasyntacticallycorrectJava
program.)
IfthecompilersaysYES,thisisasyntacticallycorrectJava
program,weaddtheprogramtothelist.
Wemoveontothenextstring.
InthiswayweconstructanimpliedbijectionfromNtotheset
ofJavaprograms.Hence,thesetofJavaprogramsiscountable.
TheRealNumbersare
Uncountable
Example:Showthattherealnumbersarenotcountable.
Proof:Itissucienttoshowthattherealnumbersbetween0and1are
notcountable.Proofbycontradiction.Assumethattherealnumbers
between0and1arecountable,thenwecanlistthem,
However,giventhislistwecannowconstructanewrealnumberrq
between0and1thatdoesnotappearonthislist,
rq = 0.dq1dq2 dq3 dqn
with dq1 ! d11, dq2 ! d22 , dq3 ! d33,, dqn ! dnn ,
TheRealNumbersare
Uncountable
Withthisconstructionrqdiersfromanyrealnumberonthelistinat
leastoneposition.Thisisacontradiction.Therefore,therealnumbers
between0and1areuncountable.(QED)