Docsity

Proofs and Problem Solving in CS 1050A: Constructing Proofs, Assignments of Computer Science

Toggle sidebar
bg1
CS 1050A: Constructing Proofs
Solutions to Problem Set 3
Problem 1
Prove that ((p→q)∧(q→r)) →(p→r) is a tautology (using truth table or otherwise).
Proof. Truth Table for ((p→q)∧(q→r)) →(p→r) is as follows:
p q r (p→q) (q→r) (p→q)∧(q→r) (p→r) ((p→q)∧(q→r)) →(p→r)
0 0 0 1 1 1 1 1
0 0 1 1 1 1 1 1
0 1 0 1 0 0 1 1
0 1 1 1 1 1 1 1
1 0 0 0 1 0 0 1
1 0 1 0 1 0 1 1
1 1 0 1 0 0 0 1
1 1 1 1 1 1 1 1
Problem 2
Determine the truth value of each of these quantified statements if the domain of each variable
consists of all real numbers. Provide necessary justification.
1. ∀x∃y(x=y2)
Proof. For x=−1, xis real,
x=y2⇒y=|√−1| ⇒ yis not a real number.
Therefore, ∀x∃y(x=y2) is False.
2. ∃x∃y(x+ 2y= 2 ∧2x+ 3y= 5)
Proof. (x+ 2y= 2 ∧2x+ 3y= 5)
⇒(x= 2 −2y∧x=5−3y
2)
⇒(2 −2y=5−3y
2)
⇒(4 −4y= 5 −3y)
⇒(y=−1, x = 4)
Therefore, ∃x∃y(x+ 2y= 2 ∧2x+ 3y= 5) is True.
Problem 3
Prove by induction that for every integer n≥1,
1. 12+ 22+ 32+. . . + (n−1)2+n2=n(n+1)(2n+1)
6
1
pf3
pf4

Partial preview of the text

Download Proofs and Problem Solving in CS 1050A: Constructing Proofs and more Assignments Computer Science in PDF only on Docsity!

CS 1050A: Constructing Proofs

Solutions to Problem Set 3

Problem 1

Prove that ((p → q) ∧ (q → r)) → (p → r) is a tautology (using truth table or otherwise).

Proof. Truth Table for ((p → q) ∧ (q → r)) → (p → r) is as follows: p q r (p → q) (q → r) (p → q) ∧ (q → r) (p → r) ((p → q) ∧ (q → r)) → (p → r) 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1

Problem 2

Determine the truth value of each of these quantified statements if the domain of each variable consists of all real numbers. Provide necessary justification.

  1. ∀x∃y (x = y^2 )

Proof. For x = −1, x is real, x = y^2 ⇒ y = |

− 1 | ⇒ y is not a real number. Therefore, ∀x∃y (x = y^2 ) is False.

  1. ∃x∃y (x + 2y = 2 ∧ 2 x + 3y = 5)

Proof. (x + 2y = 2 ∧ 2 x + 3y = 5) ⇒ (x = 2 − 2 y ∧ x = 5 − 23 y) ⇒ (2 − 2 y = 5 − 23 y) ⇒ (4 − 4 y = 5 − 3 y) ⇒ (y = − 1 , x = 4) Therefore, ∃x∃y (x + 2y = 2 ∧ 2 x + 3y = 5) is True.

Problem 3

Prove by induction that for every integer n ≥ 1,

  1. 12 + 2^2 + 3^2 +... + (n − 1)^2 + n^2 = n(n+1)(2 6 n+1)

Proof. Base Case : n = 1 LHS = 1^2 = 1 RHS = n(n+1)(2 6 n+1)= 1 ×^26 × 3 = 1 Therefore, the statement is true for n = 1. Inductive Hypothesis : The statement is true for n = k i.e. - 12 + 2^2 + 3^2 +... + (k − 1)^2 + k^2 = k(k+1)(2 6 k+1) Inductive Step : For n = k + 1, 12 + 2^2 + 3^2 +... + (k − 1)^2 + k^2 + (k + 1)^2 = k(k+1)(2 6 k+1)+ (k + 1)^2 = (k + 1)[ 2 k

(^2) +7k+ 6 ] = (k+1)(2k 6 +3)(k+2) = (k+1)((k+1)+1)(2( 6 k+1)+1) Therefore, the statement is true for n = k + 1.

  1. (^11) · 2 + (^21) · 3 + (^31) · 4 +... + (^) n·(n^1 +1) = (^) nn+

Proof. Base Case : n = 1 LHS = (^11) · 2 = (^12) RHS = (^) nn+1 = (^12) Therefore, the statement is true for n = 1. Inductive Hypothesis : The statement is true for n = k i.e. - 1 1 · 2 +^

1 2 · 3 +^

1 3 · 4 +^...^ +^

1 k·(k+1) =^

k k+ Inductive Step : For n = k + 1, 1 1 · 2 +^

1 2 · 3 +^

1 3 · 4 +^...^ +^

1 k·(k+1) +^

1 (k+1)·(k+2) = (^) kk+1 + (^) (k+1)^1 ·(k+2) = k (^2) +2k+ (k+1)·(k+2) = (k+1)

2 (k+1)·(k+2) = k k+1+ Therefore, the statement is true for n = k + 1.

Problem 4

Let h > 0 be a (fixed) real number. Prove by induction that for every integer n ≥ 1,

(1 + h)n^ ≥ 1 + hn

Proof. Base Case : n = 1 LHS = (1 + h)^1 = 1 + h RHS = 1 + h · 1 = 1 + h Therefore, the statement is true for n = 1. Inductive Hypothesis : The statement is true for n = k i.e. - (1 + h)k^ ≥ 1 + hk Inductive Step : For n = k + 1, (1 + h)(k+1) = (1 + h)k^ · (1 + h)

Problem 7

Find a flaw in the following “proof” that all horses have the same color.

Let P (n) be the proposition that all horses in a set of n horses have the same color. We will prove by induction that P (n) is true for every integer n ≥ 1. (Base case): Clearly P (1) is true since it is just a single horse. (Inductive step): Assume that P (k) is true for some k ≥ 1, i.e. for any set of k horses, they all have the same color. We will prove that P (k + 1) is true. Well, given any set of k + 1 horses, if you exclude the last horse, you get a set of k horses. By the inductive hypothesis, these k horses all have the same color. Similarly, by excluding the first horse, you can conclude that the last k horses have the same color. Since the sets of first k horses and the last k horses overlap, all k + 1 horses have the same color. Hence proved.

The Base Case is true. However, there is a flaw in the Inductive Step. The inductive step does not work when you try to prove P (2) assuming that P (1) is true. For k = 1, and given a set of k + 1 horses, the set of first k horses does not overlap with the set of last k horses. Both sets have one horse each and are disjoint.