# Solutions to Practice First Midterm Exam

### Directions:

• Answer the problems on the exam pages.
• There are four problems for 100 total points. Scale will be determined after the exam but a good guess is A = 90, C = 60.
• If you need extra space use the back of a page.
• No books, notes, calculators, or collaboration.

Exam text is in black, solutions in blue.

Corrections in green made 25 September 2015.

```  Q1: 15 points
Q2: 30 points
Q3: 25 points
Q4: 30 points
Total: 100 points
```

• Question 1 (20): Briefly identify the following terms or concepts (3 points each):

• (a) the converse of an implication

The converse of an implication "p → q" is the implication "q → p". It is not equivalent to the original.

• (b) the contrapositive of an implication

The contrapositive of an implication "p → q" is the implication "¬q → ¬p". It is equivalent to the original.

• (c) an existential quantifier

The existential quantifier ∃ is put before a predicate along with a variable that is free in the predicate. If P(x) is a statement with free variable x, "∃x: P(x)" means "P(x) is true for some x" or "there exists an x such that P(x) is true".

• (d) the DeMorgan rules for ∧ and ∨

"¬(p ∧ q) ↔ (¬p ∨ ¬q)" and "¬(p ∨ q) ↔ (¬p ∧ ¬q)"

• (e) a contradiction (as a kind of compound proposition)

A contradiction is a compound proposition that is false for all possible values of its atomic propositions. Its negation is a tautology.

• Question 2 (30): For each of these three number sequences, give the next three numbers in the sequence, find a recursive formula, and find a closed formula. (10 points each)

• a1 = 3, a2 = -2, a3 = -7, a4 = -12, a5 = -17

a6 = -22, a7 = -27, a8 = -32. Recursive: a1 = 3, an+1 = an = 5. Closed form: an = -5n + 8.

• b1 = 3, b2 = 0, b3 = -1, b4 = 0, b5 = 3

b6 = 8, b7 = 15, b8 = 24. Recursive: b1 = 3, bn+1 = bn + 2n - 7. Closed: bn = n2 - 6n + 8. (How to get this? The solution is a quadratic, of the form xn2 + yn + z. You can plug in n = 1 to get x + y + z = 3, n=2 to get 4x + 2y + z = 0, and n = 3 to get 9x + 3y + z = -1. Subtracting the first equation from the others gives 3x + y = -3 and 8x + 2y = -4, from which you can get 6x + 2y = -6 ,2x = 2, x = 1, and y = -2. Then you solve for z in any of the three equations.)

• c1 = 3, c2 = 4, c3 = 6, c4 = 10, c5 = 18

c6 = 34, c7 = 66, c8 = 130. Recursive: c1 = 3, cn+1 = 2cn - 2. Closed: cn = 2n-1 + 2. (How to get this? The solution is going to involve 2n because of the doubling. So look for a similarity with 2, 4, 8, 16, 32, 64, 128, and see that cn is the n-1'st entry of this sequence, plus 2.

• Question 3 (25): Translate the following statements as indicated. The dogs Cardie and Duncan are denoted symbolically by c and d respectively. The proposition p means "Cardie is soft", and q means "Duncan is fierce". If x and y are dogs, the predicate S(x, y) means "dog x is smaller than dog y". (5 points each)

• (a) (to symbols) Cardie is soft, and if Duncan is fierce then Cardie is not soft.

p ∧ (q → ¬p)

• (b) (to English) p → ∃x: S(d, x)

If Cardie is soft, then there exists a dog larger than Duncan.

• (c) (to symbols) Every dog is smaller than some dog that is larger than Duncan.

∀x: &exists;y: S(x, y) ∧ S(y, d)

• (d) (to English) (p ⊕ (q ∧ S(c, d))) → ∀x: S(x, d)

Either Cardie is soft, or if Duncan is fierce and Cardie is smaller than Duncan, than all dogs are smaller than Duncan, but not both.

• (e) (to symbols) Cardie is either soft or smaller than every dog except Duncan, or both.

p ∨ ∀x: (x ≠ d) → S(x, d)

• Question 4 (30): Establish the following facts with truth tables.

• (a, 15) The compound proposition "p → (q → p)" is a tautology.

``````
p   -->  (q  -->   p)
0    1    0   1    0
0    1    1   0    0
1    1    0   1    1
1    1    1   1    1
``````

Since the second column is all ones, the statement is a tautology.

• (b, 15) The compound propositions "p ∧ (q ∨ ¬r)" and "(p ∨ q) ∧ (¬q ∨ p) ∧ (p ∨ ¬r)" are logically equivalent.

``````(p and (q or not r)    <-->  (p or q) and (not q or p) and (q or not r)
0  0   0 1   1  0       1    0  0 0   0    1  0  1 0   0   0 1   1  0
0  0   0 0   0  1       1    0  0 0   0    1  0  1 0   0   0 0   0  1
0  0   1 1   1  0       1    0  1 1   0    0  1  0 0   0   1 1   1  0
0  0   1 1   0  1       1    0  1 1   0    0  1  0 0   0   1 1   0  1
1  1   0 1   1  0       1    1  1 0   1    1  0  1 1   1   0 1   1  0
1  0   0 0   0  1       1    1  1 0   1    1  0  1 1   0   0 0   0  1
1  1   1 1   1  0       1    1  1 1   1    0  1  1 1   1   1 1   1  0
1  1   1 1   0  1       1    1  1 1   1    0  1  1 1   1   1 1   0  1
``````

The ↔ operation is applied to the second column and the fifth from last
column.

``````
``` ```
``` Last modified 25 September 2015 ```