Download Solution

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Big O notation wikipedia , lookup

Infinitesimal wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Large numbers wikipedia , lookup

List of first-order theories wikipedia , lookup

Real number wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Hyperreal number wikipedia , lookup

History of the function concept wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Principia Mathematica wikipedia , lookup

Non-standard calculus wikipedia , lookup

Series (mathematics) wikipedia , lookup

Function (mathematics) wikipedia , lookup

Infinity wikipedia , lookup

Function of several real variables wikipedia , lookup

Order theory wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
CITS2211 Discrete Structures
Week 6 Tutorial
1. Which of the following functions are injective, which surjective, which
bijective?
(a) f1 : N → N where f1 (n) = 2n.
(b) f2 : N → E where f2 (n) = 2n (recall E is the set of natural even
numbers).
(c) f3 : N → N where f3 (n) = n/2 if n is even and f3 (n) = (n + 1)/2
otherwise.
(d) f4 : R → R where f4 (x) = 2x.
(e) f5 : R → R>0 where f5 (x) = x2 .
Solution:
(a) f1 is injective (if f1 (m) = f1 (n) then 2m = 2n, so m = n) but
not surjective (1 is not f1 (n) for any n ∈ N).
(b) f2 is injective (if f2 (m) = f2 (n) then 2m = 2n, so m = n) and
surjective (every even number n is the image of an integer,
namely n/2), hence bijective.
(c) f3 is not injective (f3 (2) = 1 = f3 (1) but 2 6= 1) but it is
surjective (every even number n is the image of an integer,
namely 2n).
(d) f4 is injective (if f4 (x) = f4 (y) then 2x = 2y, so x = y) and
surjective (every real number x is the image of a real number,
namely x/2), hence bijective.
(e) f5 is not injective (f5 (1) = 1 = f5 (−1) but 1 6= −1) but it is
surjective (every non-negative
real number x is the image of a
√
real number, namely x).
1
2. Let A = {1, 2, 3} and B = {a, b}.
(a) How many functions f : A → B are there?
(b) How many functions f : A → B are injective, how many surjective?
(c) How many functions f : A → B are bijective?
Solution:
(a) There are 2 choices for f (1), 2 choices for f (2) and 2 choices
for f (3), so there are 2 ∗ 2 ∗ 2 = 8 such functions.
(b) Since A has size 3 and B has size 2, there are no such injections.
To count surjections, it is easier to count the “non-surjections”.
For f not to be a surjection, it has to map every element of
A to the same element of B, either a or b. Hence there are
2 non-surjections. The total number of functions, as seen in
Part (a), is 8. Thus there are 6 surjections.
(c) If there existed a bijection from A to B, we would have |A| =
|B|. So there are no bijections.
3. Show that |A ∪ B| = |A| + |B| − |A ∩ B|, when A and B are finite sets.
Solution: We have that A ∪ B is the disjoint union of A − B,
B − A and A ∩ B, so |A ∪ B| = |A − B| + |B − A| + |A ∩ B|. Now A
is the disjoint union of A − B and A ∩ B, so |A| = |A − B| + |A ∩ B|.
Similarly |B| = |B − A| + |A ∩ B|.
Thus |A − B| = (|A| − |A ∩ B|) + (|B| − |A ∩ B|) + |A ∩ B| =
|A| + |B| − |A ∩ B|.
Solution: (alternative)
Divide A ∪ B into two disjoint parts:
A ∪ B = A ∪ (B − A).
We know they’re disjoint, so the cardinality is
|A ∪ B| = |A| + |B − A|.
Now let’s work out the cardinality of B − A.
B − A = B − (A ∩ B),
2
and we know they are disjoint, too, so
|B − A| = |B| − |A ∩ B|.
So the cardinality of the whole expression is
|A ∪ B| = |A| + |B| − |A ∩ B.
4. Of the integers x, 100 ≤ x ≤ 999: how many are divisible by 5? How
many are not divisible by 5? How many are divisible by 4? How many
are divisible by 4 and 5? How many are divisible by 4 or 5? How many
are divisible by neither 4 nor 5?
Solution:
There are 900 numbers altogether.
Let A denote those divisible by 5 and B denote those divisible by
4.
Then
A = {100 + 5k | k ∈ {0, 1, . . . 179}}
and so |A| = 180. So |A| = 900 − 180 = 720, that is the number of
numbers not divisible by 5.
Then
B = {100 + 4k | k ∈ {0, 1, . . . 224}}
and so |B| = 225.
Then A ∩ B contains all the numbers divisible by 20, so
A ∩ B = {100 + 20k | k ∈ {0, 1, . . . , 44}}
and so |A ∩ B| = 45.
Divisible by 4 or 5 is the set A ∪ B which has
180 + 225 − 45 = 360
elements.
This leaves |A ∪ B| = 900 − 360 = 540 divisible by neither.
5. Show that the union of two countable sets is countable.
3
Solution: If the two sets are finite, it is obvious. If one is finite
and the other infinite countable, make a list by first putting the
finite set in any order then the infinite set, which we know can be
ordered in a list since it is countable.
Now assume both sets A and B are infinite countable. We know
we can order both sets A = {a1 , a2 , a3 , . . .} and B = {b1 , b2 , b3 , . . .}.
Now we can order A ∪ B the following way:
a1
a2
a3
a4
a5
a6
a7
a8
a9 a10 . . .
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10 . . .
so A ∪ B is infinite countable.
6. Which of the following sets are countable? Justify your answer.
(a) The set P(N>0 ), the power set of the positive natural numbers.
(b) The set S of all functions f : {0, 1} → N>0 .
(c) The set T of all functions f : N>0 → {0, 1}.
(d) The set A × A, where A is an infinite countable set.
Solution:
(a) The set P(N>0 ) is uncountable because the power set of a set
always has greater cardinality than the set.
(b) The set S of all functions f : {0, 1} → N>0 is countable because it has the same cardinality as N>0 × N>0 , which we have
seen in lectures is countable. To prove that we will exhibit a
bijection between S and N>0 × N>0 :
g : S → N>0 × N>0 defined by g(f ) = (f (0), f (1)).
• g is injective since if g(f1 ) = g(f2 ) then (f1 (0), f1 (1)) =
(f2 (0), f2 (1)) so f1 (0) = f2 (0) and f1 (1) = f2 (1), which
means that f1 and f2 are the same function.
4
• g is surjective since (a, b) ∈ N>0 × N>0 is g(f ) for the
function f mapping 0 to a and 1 to b.
(c) The set T of all functions f : N>0 → {0, 1} is uncountable
because it is the same size as P(N>0 ). To prove that we will
exhibit a bijection between T and P(N>0 ):
g : T → P(N>0 ) defined by g(f ) = {n ∈ N>0 |f (n) = 1}.
• g is injective since if g(f1 ) = g(f2 ) then {n ∈ N>0 |f1 (n) =
1} = {n ∈ N>0 |f2 (n) = 1} so f1 (n) = 1 exactly whenever
f2 (n) = 1. It follows f1 (n) 6= 1 (so f1 (n) = 0) exactly
(You can refer to question 6(c).)whenever f2 (n) 6= 1 (so
f2 (n) = 0), which means that f1 and f2 are the same
function.
• g is surjective since C ∈ P(N>0 ) is g(f ) for the function
f mapping every element in C to 1 and everything else to
0.
(d) The set A × A is countable, by a zig-zag argument similar to
the one we saw in lectures for N>0 × N>0 .
Solution: (alternative solution for (b)):
Any function f from the set {0, 1} to the positive natural numbers
will be of the form:
f (n) = when n is 0, f (n) = x
when n is 1, f (n) = y
where x and y are two positive natural numbers.
Let us give these functions names - fx,y will be the name of the
function for which f (0) = x and f (1) = y.
We can now put the names of this functions in a grid, as we have
done in lectures with pairs of integers:
f1,1 f1,2 f1,3 ...
f2,1 f2,2 f2,3 ...
f3,1 f3,2 f3,3 ...
...
We can then exhibit a bijection between these and the natural num-
5
bers, by enumerating them in a “zig-zag” fashion (refer to to lecture
notes for the function).
Therefore, the number of functions is countable.
(Trivia: a path which goes left and then right alternately is a boustrophedon path - from the Greek for “ox turning”, from the pattern
an ox makes when plowing a field. So we could call this “zig-zag”
a diagonal boustrophedon path.)
7. (challenge problem) There is a smallest legal Java program. It looks
like:
public class A{public static void main(String[] a){}}
What is the cardinality of the set of all legal Java programs, J?
There is also a set of functions from N to {T, F } - call it P . What is
the cardinality of this set? (You can refer to question 6(c).)
How do the cardinalities of J and P compare - is one larger than the
other? If so, what do you deduce from this?
6