See attachments
Due in 12hours
Department of Computer Science
COMPSCI 225 Assignment 1 Due: Thursday August 8, 4pm in SRC
Note: Please deposit your solutions in the appropriate box in the basement of Building 303
by 4pm on the due date. Late assignments or assignments placed into incorrect boxes will
not be marked. Please use a Computer Science Department cover sheet available from outside
the Resource Centre.
1. [4 marks] Use the standard logical equivalences to show that
p → (q → r) ⇔ q → (p → r).
State which standard logical equivalence(s) you are using in each line of your derivation.
2. [4 marks] Consider the following theorem:
The sum of a rational number and an irrational number is an irrational number.
What is the hypothesis of the theorem? What is the conclusion? Give a proof by contradiction.
3. [3 marks] Draw a truth table for the following proposition, and state whether it is a tautology,
a contradiction or a contingent.
(r ∧ (p ↔ q)) → ((p∨ q) → (p∧ r))
4. [6 marks]
(a) Prove that n2 + 3n is even for each integer n.
(b) Prove or disprove: if n is a prime number, then 2n − 1 is a prime number.
(c) Let n,k be integers. Prove the following statement by contraposition. “If n + k < 11 or
n + k > 21, then n < 2 or n > 7 or k < 9 or k > 14. ”
5. [3 marks]
(a) Write down the symmetric difference of the sets {2, 7, 10} and {5, 10, 7}.
(b) Write down the power set of {∅}
(c) Let A = {2, 3, 4} and B = {2, 4, 6}. Write down |A∩B|, |A∪B| and |(A∪B)⊕(A∩B)|.
6. [3 marks] Describe by enumeration the Cartesian products A × B, B2 and A3 for the sets
A = {0, 2} and B = {0, 1, 4}.
7. [4 marks] For each of the following functions state whether it is injective and whether it is
surjective. Briefly explain your answers.
(a) f : R → R where f(x) = x3.
(b) f : [0,π/2] → R where f(x) = sin x.
(c) f : R → R where f(x) = |x|.
(d) f : (0, 1] → [−1, 1] where f(x) = sin(1/x).
COMPSCI 225 Assignment 1 Page 1 of 1