Mandatory Assignment 01 Solutions
Mandatory Assignment 01 Solutions
Mandatory Assignment 01 Solutions
1. Q: Prove that the sum of n real numbers if rational if all of them are
rational. Is the converse true? Prove or disprove that the product of
n real numbers is rational (resp. irrational) if all of them are rational
(resp. irrational).
A: We will prove the first part by induction. Of course, the base case is
trivial: the sum of a single rational number is clearly rational. Then,
suppose that the sum of n rational numbers is always rational. Given
n + 1 rational numbers ab11 , ab22 , . . . , abn+1
n+1
, their sum is:
a1 a2 an an+1
+ + ... + +
b1 b2 bn bn+1
By the induction hypothesis, the sum of the first n of these numbers
is some rational number pq , so the above expression is:
p an+1 pbn+1 + qan+1
= + =
q bn+1 qbn+1
which is rational. So by induction, the sum of n rational numbers is
rational.
The converse is not necessarily true, i.e. if a number is rational,
√ it
√ is
not necessarily only a sum of rational numbers, e.g. 0 = − 2 + 2.
Finally, a product of rational numbers is clearly rational (by multi-
plying all numerators together and all denominators together), but
a√ product
√ of irrational numbers need not be irrational. Indeed,
2 ∗ 2 = 2.
2. Q: Prove that if n is a positive integer, then n is odd if and only if 5n + 6
is odd.
Remark. Just some extra information if you are curious! You don’t need to
know anything about this, but you may find it interesting.
The previous two questions hint at a pattern: is it true that nk −n is divisible
by k for every k ≥ 2 and n ≥ 0? We can easily verify that this is not always
the case: indeed, 24 − 2 = 14 which is not divisible by 4.
However, if p is prime, then np − n is always divisible by p. We only need a
basic algebraic fact to prove this – the so-called “freshman’s dream” – that
if p is prime, then for any integers x and y:
(x + y)p ≡ xp + y p (mod p)
(n + 1)p − (n + 1) ≡ np + 1p − n − 1 = np − n (mod p)
Since we’ve assumed that np −n ≡ 0 (mod p), then we are done by induction.
This result is known as Fermat’s little theorem, and its more general form is
seen in Euler’s theorem.
5. Q: We had shown in class that the set of real numbers in the interval
[0, 1] is uncountable. What can you then say about the cardinality
of the set of real numbers in the interval [0.5, 0.6]? If it is countable,
why is it? If it is uncountable, present the arguments in the same
way we did the proof for the interval [0, 1]. Given what was taught
in class, could you have come up with an easier proof?
A: You are asked to present a similar argument to the one shown in class:
such an argument is called a diagonalisation, or a diagonal argument.
We proceed by contradiction. Suppose [0.5, 0.6] is countable. Then,
we can exhaustively enumerate its elements in a sequence s1 , s2 , . . ..
X R = xi xi−1 . . . x1
Y R = yj yj−1 . . . y1
XY = x1 x2 . . . xi y1 y2 . . . yj
(XY )R = yj yj−1 . . . y1 xi xi−1 . . . x1
Y R X R = yj yj−1 . . . y1 xi xi−1 . . . x1
So (XY )R = Y R X R .
(A ∪ B)R = {X R : X ∈ A ∪ B} = {X R : X ∈ A or X ∈ B}
= {X R : X ∈ A} ∪ {X R : X ∈ B} = AR ∪ BR
9. Q: If the languages A and B are countably infinite and we use the nota-
tion of Question 8, what can you say about the size of the language
obtained by concatenating (AB)R and (A∪B)R . Is the size of the set
(AB)R · (A ∪ B)R any larger or smaller than the size of the language
obtained by concatenating BR and AR ?