Mathematics for computer science

Mathematics for Computer Science

Problem 1. [24 points]
Translate the following sentences from English to predicate logic. The domain that you are
working over is X, the set of people. You may use the functions S(x), meaning that “x has
been a student of 6.042,” A(x), meaning that “x has gotten an ‘A’ in 6.042,” T(x), meaning
that “x is a TA of 6.042,” and E(x, y), meaning that “x and y are the same person.”
(a) [6 pts] There are people who have taken 6.042 and have gotten A’s in 6.042
(b) [6 pts] All people who are 6.042 TA’s and have taken 6.042 got A’s in 6.042
(c) [6 pts] There are no people who are 6.042 TA’s who did not get A’s in 6.042.
(d) [6 pts] There are at least three people who are TA’s in 6.042 and have not taken 6.042

Problem 2. [24 points]

Use a truth table to prove or disprove the following statements:
(a) [12 pts]
¬(P ∨ (Q ∧ R)) = (¬P) ∧ (¬Q ∨ ¬R)
(b) [12 pts]
¬(P ∧ (Q ∨ R)) = ¬P ∨ (¬Q ∨ ¬R

Problem 3
(a) [12 pts] For each of the following expressions, find an equivalent expression using only
nand and ¬ (not), as well as grouping parentheses to specify the order in which the operations
apply. You may use A, B, and the operators any number of times.
(i) A ∧ B
(ii) A ∨ B
(iii) A ⇒ B
(b) [4 pts] It is actually possible to express each of the above using only nand, without
needing to use ¬. Find an equivalent expression for (¬A) using only nand and grouping
parentheses.
(c) [8 pts] The constants true and false themselves may be expressed using only nand.
Construct an expression using an arbitrary statement A and nand that evaluates to true regardless of whether A is true or false. Construct a second expression that always evaluates
to false. Do not use the constants true and false themselves in your statements.

Problem 4. [10 points] You have 12 coins and a balance scale, one of which is fake. All
the real coins weigh the same, but the fake coin weighs less than the rest. All the coins
visually appear the same, and the difference in weight is imperceptible to your senses. In at
most 3 weighings, give a strategy that detects the fake coin. (Note: the scale in this problem
is a scale with two dishes, which tips toward the side that is heavier. For clarification, do an
image search for “balance scale”).

Problem 5. [6 points] Prove the following statement by proving its contrapositive: if r is
irrational, then r1/5 is irrational. (Be sure to state the contrapositive explicitly.)

Problem 6. [12 points] Suppose that w2 + x2 + y2 = z2, where w, x, y, and z always
denote positive integers. (Hint: It may be helpful to represent even integers as 2i and odd
integers as 2j + 1, where i and j are integers)
Prove the proposition: z is even if and only if w, x, and y are even. Do this by considering
all the cases of w, x, y being odd or even.