Docsity

Final Exam Practice Problems - Constructing Proofs | CS 1050, Exams of Computer Science

Toggle sidebar
bg1
A few practice problems for the final
1. Is √5 + √7 a rational number? Prove that your answer is correct.
2. Is the statement
p∧r→[(q∧ ¬r)→((¬p)→r)]
a tautology? Why?
3. Is the statement ‘for any sets A,Band C, (A∪B)\C= (A\C)∪(B\C)’
true? Why?
4. Define the relation Ron the set of real numbers by
xRy⇐⇒ x2≤y2.
Is R:
(i) reflexive
(ii) symmetric
(iii) transitive
(iv) antisymmetric
Prove formally that your answers are correct.
5. Let fand gbe functions from the set of real numbers into the set of real
numbers. By f+gwe mean the function that assigns f(x) + g(x) to any
real number x(f+gis also a function from the set of real numbers to
into itself). Is it true that:
(i) If fand gare one-to-one then so is f+g?
(ii) If fand gare onto then so is f+g?
Give a proof or a counterexample (depending on your answer) for each
part.
6. Prove that for any integers aand b,
gcd(gcd(a2, b),gcd(a, b2)) = gcd(a, b).
7. Prove that for any prime number pand integers a, b,
p|a∧p|a2+b2=⇒p|b.
8. What is the last digit of the number 52006 written in the ternary (base-3)
system?
9. What are all possible values of gcd(a3+a2+ 2a+ 3, a + 2) if ais an integer?
10. Find the solution of the recurrence an= 2an−1−an−2+ 1, a0=a1= 1.
1
pf2

Partial preview of the text

Download Final Exam Practice Problems - Constructing Proofs | CS 1050 and more Exams Computer Science in PDF only on Docsity!

A few practice problems for the final

  1. Is

7 a rational number? Prove that your answer is correct.

  1. Is the statement p ∧ r → [(q ∧ ¬r) → ((¬p) → r)] a tautology? Why?
  2. Is the statement ‘for any sets A, B and C, (A ∪ B) \ C = (A \ C) ∪ (B \ C)’ true? Why?
  3. Define the relation R on the set of real numbers by

xRy ⇐⇒ x^2 ≤ y^2.

Is R:

(i) reflexive (ii) symmetric (iii) transitive (iv) antisymmetric

Prove formally that your answers are correct.

  1. Let f and g be functions from the set of real numbers into the set of real numbers. By f + g we mean the function that assigns f (x) + g(x) to any real number x (f + g is also a function from the set of real numbers to into itself). Is it true that:

(i) If f and g are one-to-one then so is f + g? (ii) If f and g are onto then so is f + g?

Give a proof or a counterexample (depending on your answer) for each part.

  1. Prove that for any integers a and b,

gcd(gcd(a^2 , b), gcd(a, b^2 )) = gcd(a, b).

  1. Prove that for any prime number p and integers a, b,

p | a ∧ p | a^2 + b^2 =⇒ p | b.

  1. What is the last digit of the number 5^2006 written in the ternary (base-3) system?
  2. What are all possible values of gcd(a^3 + a^2 + 2a + 3, a + 2) if a is an integer?
  3. Find the solution of the recurrence an = 2an− 1 − an− 2 + 1, a 0 = a 1 = 1.
  1. Assume you are walking on a plane. You want to reach a point that you can reach by walking n miles North and then m miles West. You walk in the following way. First you choose one of the two directions: West or North. You walk one mile in that direction. Then you select one of the two directions again and move one mile in that direction. You continue like this until you reach the desired destination. In how many ways would you be able to get there?
  2. There are 5 points in an equilateral triangle with edge length 1. Prove that some two are no more than 0.5 away.
  3. Describe an O(n log n) or better algorithm for finding the k-th smallest element among the input n elements.
  4. Describe how to find the smallest element and the second smallest element in a list of n elements in O(n) time.
  5. Prove that (^) n ∑

i=

(2i − 1) = n^2.