Lecture 18: Functions reprise and counting very very big sets!

Last time we talked about functions as mappings from one set (usually
A) to another set (often B).  This mapping is a function if:

"Every element in A is mapped to exactly one element in B", that is:
    .) There are no elements in A that are not mapped, and
    .) There are no elements in A that get mapped to multiple things.

Functions also may or may not have interesting properties.  The most
interesting of these are:
    .) 1-1:  (an injection).  Each element of B gets mapped to only once.
    .) onto: (a surjection).  Each element of B gets mapped to at most
    once.

One of the uses of functions is to reason about how big sets are.

Suppose you have two sets A and B.
  If you can find a 1-1 function mapping A to B, then you know that 
    |B| > |A|
  Why? because each element of B gets "its own" element of A.

  If you can find an onto function mapping A to B, then you know that 
    |A| > |B|
  Why? because every element of B gets mapped to by something (and
    things only map once).

Even more, if you can find a function that is 1-1 *and* onto, then you
know that the sets |A| and |B| have the same number of elements.
Alternatively, if you find a function f from A to B that is onto, and
a function g from B to A that is only, then you know that the sets |A|
and |B| have the same number of elements.

Evener morer coolerer, this reasoning works when the sets A,B are
infinite.  When sets might be infinite, we sometimes talk about the
"size" of a set as its "cardinality", which is a word that warns you
the sets might be infinite.

So we can now prove, perhaps that the set of integers and the set of
even integers have the same cardinality.


Then, we can prove that the set of positive rational numbers and the
set of positive integers have the same cardinality.




Then, we can prove that the set of "real numbers" between 0 and 1 is
larger than the set of integers.  We do this with a proof by
contradiction, which goes as follows:
 
  "Suppose you did have a 1-1 and onto functions between real numbers
   and integers.  This leads to a contradiction.  Therefore no 1-1 and
   onto function exists, so the two sets must be a different size." 

   A number of cool things can be proved this way, and this proof
   style goes by the name "diagonalization".

  we need one little trick to do this.  The trick is to have a
  representation of real numbers.  How can we represent real numbers?
  One way is to write them out in their decimal notation

  0.091019419827381....
  0.083241913441414....
  . 
  .
  . and so on...

    This list goes on forever (down), and, each number goes on forever
    (to the right), so we clearly can't write the list.  But we can
    think about it.
  
  let f be a 1-1 and onto function between integers and real numbers

  that means that we have f(1) = some real number, 
  and                     f(2) = some real number,
  and                     f(3) = some real number,

  and all real numbers eventually appear on this list (... must
  happen, if f is onto.)

  Now we are going to make a contradiction that all real numbers
  appear on this list.  In particular, we are going to construct a
  number not on the list.
     
    (as a side note, this is a little bit like the proof that there is
     no largest prime number... we assumed there was one, and
     constructed a larger prime number).

  so how does this construction work?  This is called a
  diagonalization because we are going to make a new number by working
  down the diagonal of this list of numbers

  0.a91019419827381....
  0.0b3241913441414....
  .   c 
  .    d
  .     e

  So if we look along the diagonal, there is a number:
    0.abcde...
  
  If we change every digit of 0.abcde... to something different (like
    "add 1 to the digit, unless its a 9, when you make it 0), then we
    get a new number: 0.ABCDE...     where all the digits are different.
   
  Now (ready?!) here is the claim:
     0.ABCDE... is *not* anywhere on the list of real numbers.  That's
     a problem! because it proves that our function "f" is not onto.

  And we didn't use any property of "f", so it proves that no function
     "f" is onto.  And since no onto function exists, then the Reals
     from 0,1 must be bigger than the integers.


  Strong claims, how do we prove it?  (crikey, another proof by contradiction)
     Suppose this number *was* somewhere on the list, say in position x
       then it must be that    f(x) =  0.ABCDE... 

     But we made this number 0.ABCDE...  so that it's x-th digit was
     *different* than f(x), so there can be no "x" such that f(x) =
     0.ABCDE.
 
     This proves the claim that the number isn't on the list.