Computer Science Foundation Exam

Similar documents
Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Mathematical Reasoning & Proofs

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics. Introductory Notes in Discrete Mathematics Solution Guide

UNIVERSITY OF VICTORIA DECEMBER EXAMINATIONS MATH 122: Logic and Foundations

Boolean Algebra CHAPTER 15

RED. Name: Instructor: Pace Nielsen Math 290 Section 1: Winter 2014 Final Exam

1. Consider the conditional E = p q r. Use de Morgan s laws to write simplified versions of the following : The negation of E : 5 points

Number Theory and Graph Theory. Prime numbers and congruences.

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

Packet #2: Set Theory & Predicate Calculus. Applied Discrete Mathematics

Chapter 1 The Real Numbers

MATH FINAL EXAM REVIEW HINTS

MATH 215 Final. M4. For all a, b in Z, a b = b a.

1. Prove: A full m- ary tree with i internal vertices contains n = mi + 1 vertices.

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

CSE 20. Final Review. CSE 20: Final Review

The least element is 0000, the greatest element is 1111.

Midterm Exam Solution

Math 230 Final Exam, Spring 2008

Computer Science Foundation Exam

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Logic Synthesis and Verification

Propositional Logic, Predicates, and Equivalence

1 Direct Proofs Technique Outlines Example Implication Proofs Technique Outlines Examples...

The Pumping Lemma and Closure Properties

Chapter 1 : The language of mathematics.

Lecture Notes on DISCRETE MATHEMATICS. Eusebius Doedel

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

Practice Midterm Exam Solutions

Mathematical Preliminaries. Sipser pages 1-28

University of Ottawa CSI 2101 Midterm Test Instructor: Lucia Moura. February 9, :30 pm Duration: 1:50 hs. Closed book, no calculators

Homework 4 Solutions

Math 109 September 1, 2016

MATH 271 Summer 2016 Practice problem solutions Week 1

A B is shaded A B A B

Contribution of Problems

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

Binary Logic and Gates

COT 2104 Homework Assignment 1 (Answers)

8. Given a rational number r, prove that there exist coprime integers p and q, with q 0, so that r = p q. . For all n N, f n = an b n 2

CS1800 Discrete Structures Spring 2018 February CS1800 Discrete Structures Midterm Version A

Math Final Exam December 14, 2009 Page 1 of 5

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall

Math 10850, fall 2017, University of Notre Dame

Topics in Logic and Proofs

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications

Recitation 7: Existence Proofs and Mathematical Induction

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

LECTURE NOTES DISCRETE MATHEMATICS. Eusebius Doedel

Homework 3, solutions

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.

MATH10040: Chapter 0 Mathematics, Logic and Reasoning

0 Sets and Induction. Sets

1.1 Language and Logic

CSE 20 DISCRETE MATH. Winter

1. Propositions: Contrapositives and Converses

DISCRETE MATH: FINAL REVIEW

3 Boolean Algebra 3.1 BOOLEAN ALGEBRA

With Question/Answer Animations. Chapter 2

Informal Statement Calculus

Proofs. Joe Patten August 10, 2018

MATH 3330 ABSTRACT ALGEBRA SPRING Definition. A statement is a declarative sentence that is either true or false.

2.2: Logical Equivalence: The Laws of Logic

(e) Commutativity: a b = b a. (f) Distributivity of times over plus: a (b + c) = a b + a c and (b + c) a = b a + c a.

1. Given the public RSA encryption key (e, n) = (5, 35), find the corresponding decryption key (d, n).

Theory of Computation 1 Sets and Regular Expressions

MATH10040: Numbers and Functions Homework 1: Solutions

Automata Theory and Formal Grammars: Lecture 1

Packet #1: Logic & Proofs. Applied Discrete Mathematics

Combinational Logic Design Principles

Logic, Sets, and Proofs

Lecture 2. Logic Compound Statements Conditional Statements Valid & Invalid Arguments Digital Logic Circuits. Reading (Epp s textbook)

Preliminaries to the Theory of Computation

0.Axioms for the Integers 1

Chapter 1. Logic and Proof

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall Set-builder notation (a more precise way of describing a set)

CSC 125 :: Final Exam May 3 & 5, 2010

Chapter 2: Switching Algebra and Logic Circuits

Notation Index. gcd(a, b) (greatest common divisor) NT-16

Writing Assignment 2 Student Sample Questions

Logic and Proofs. (A brief summary)

2 Elementary number theory

MATH 2200 Final Review

CHAPTER 2 BOOLEAN ALGEBRA

1 Take-home exam and final exam study guide

Definition 2. Conjunction of p and q

Digital Logic Design: a rigorous approach c

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

Writing Mathematical Proofs

2 Truth Tables, Equivalences and the Contrapositive

Lecture 2: Axiomatic semantics

CS1800 Discrete Structures Fall 2016 Profs. Gold & Schnyder April 25, CS1800 Discrete Structures Final

means is a subset of. So we say A B for sets A and B if x A we have x B holds. BY CONTRAST, a S means that a is a member of S.

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Compound Propositions

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

Boolean Algebra and Proof. Notes. Proving Propositions. Propositional Equivalences. Notes. Notes. Notes. Notes. March 5, 2012

Transcription:

Computer Science Foundation Exam August 2, 2002 Section II A DISCRETE STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: SSN: In this section of the exam, there are two (2) problems. You must do both of them. Each counts for 25% of the total exam grade. Show the steps of your work carefully. Problems will be graded based on the completeness of the solution steps and not graded based on the answer alone Credit cannot be given when your results are unreadable.

FOUNDATION EXAM (DISCRETE STRUCTURES) Answer two problems of Part A and two problems of Part B. Be sure to show the steps of your work including the justification. The problem will be graded based on the completeness of the solution steps (including the justification) and not graded based on the answer alone. NO books, notes, or calculators may be used, and you must work entirely on your own. PART A: Work both of the following problems (1 and 2). 1) Whenever Binary Billy acts up, his punishment is to write binary numbers on the board. He always starts writing 0, 1, 10, 11, 100, etc. Depending on the severity of behavior, Billy has to write all the binary numbers starting at 0 upto all binary numbers with a certain number of digits. For example, if Billy's bad behavior was rated at a 5, then Billy would have to write all the binary numbers from 0 through 11111. Let B(n) denote the total number of binary digits Billy must write for a bad behavior rating of n. Using induction on n, prove that B(n) = (n-1)2 n + 2, for all positive integers n. 2) Prove the following assertions for sets A and B from an universe U without using Venn Diagrams or membership tables: a.) A B if and only if A B =. b.) A B if and only if A B = U.

Solution to Problem 1: Whenever Binary Billy acts up, his punishment is to write binary numbers on the board. He always starts writing 0, 1, 10, 11, 100, etc. Depending on the severity of behavior, Billy has to write all the binary numbers starting at 0 upto all binary numbers with a certain number of digits. For example, if Billy's bad behavior was rated at a 5, then Billy would have to write all the binary numbers from 0 through 11111. Let B(n) denote the total number of binary digits Billy must write for a bad behavior rating of n. Using induction on n, prove that B(n) = (n-1)2 n + 2, for all positive integers n. Base case. n=1. Billy must write two digits, 0 and 1, thus B(1) = 2. Looking at the right hand side we find it equal to (1-1)2 1 + 2 = 2, thus the given formula is true for n=1. Inductive hypothesis: Assume that for an arbitrary value of n=k that B(k) = (k-1)2 k + 2. Inductive step: Prove, under the inductive hypothesis, that for n=k+1, B(k+1) = ((k+1)-1)2 k+1 + 2 = k2 k+1 + 2. Let b(n) = number of binary numbers with EXACTLY n digits. For example, b(2) = 2 since there are two binary numbers, 10 and 11 with exactly 2 digits. In particular, using the multiplication principle, we have that b(n) = 2 n-1. This is because the first binary digit of the n digits must be 1. The rest can either be 0 or 1. Thus, we have 2 choices for each of the n-1 remaining digits. Since each of these choices are independent, we multiply 2 by itself n-1 times to obtain the total number of possible binary numbers with exactly n digits. Now, to prove the assertion: B(k+1) = B(k) + (k+1)*b(k+1), since we are adding b(k+1) numbers with k+1 digits = (k-1)2 k + 2 + (k+1)2 (k+1)-1 = (k-1)2 k + 2 + (k+1)2 k = ((k-1)+(k+1))2 k + 2 = (2k)2 k + 2 = k2 k+1 + 2

Prove the following assertions for sets A and B from an universe U without using Venn Diagrams or membership tables: (Note: when I say A B, I mean A is not a subset, not A is not a proper subset.) a.) A B if and only if A B =. First we will show A B A B =. In order to show that the intersection of two sets is empty, we must show that the two sets, in this case A and B share no common elements. Assume the contrary, that there exists an element x such that x A and x B. By definition of a complement set, then xˇb. But, if x A and xˇb, we can deduce that A B. But, this contradicts our given information. Thus, our initial assumption, that A B was non-empty is incorrect and we have shown that A B =. Now, we must prove A B = A B. Let's prove the contrapositive of this statement: A B A B. If A B, then there exists an element x such that x A and xˇb. But if xˇb, then we know that x B. It follows that x A B. Thus, A B, as desired. b.) A B if and only if A B = U. First let's show that A B A B = U. In order to show that A B = U, we must show that there is no element x such that x ˇ A B. Assume such an x exists. Then we have that x ˇ A B. If x is not an element of this union, then we can deduce that xˇ A and x ˇB. If this is the case, then x A. But that would contradict the given information that A B. Thus, no such element x exists and we can conclude that A B = U. Now, let's show that A B = U A B. We can prove the contrapositive of this statement: A B A B U. If A B, then there exists an element x U such that x A and xˇb. But if this is the case, it is clear that xˇ A and xˇb, so xˇ A B. It follows that A B U.

Computer Science Foundation Exam August 3, 2002 Section II B DISCRETE STRUCTURES NO books, notes, or calculators may be used, and you must work entirely on your own. Name: SSN: In this section of the exam, there are two (4) problems. You must do two (2) of them. Each counts for 25% of the total exam grade. You must clearly identify the problems you are solving. Show the steps of your work carefully. Problems will be graded based on the completeness of the solution steps and not graded based on the answer alone Credit cannot be given when your results are unreadable.

3) a) Show that the logical expression ((p q) (q p)) is equivalent to the logical expression p q, without the use of a truth table. ((p q) (q p)) (p q) (q p), using the definition of an implication ( ( p q)) ( q p), using the definition of an implication (p q) ( q p), using De Morgan's law, double negation (p (p q)) q, using associative/commutative of or p q, using the absorption law. b) The boolean function f(p, q, r) is represented below in a truth table. p q r f(p,q,r) F F F F F F T T F T F F F T T F T F F F T F T F T T F T T T T F Write out an expression for f(p, q, r) in terms of p, q, and r, only using the boolean operators and( ) and not( ). (Hints: A logical expression remains unchanged if you negate it twice. Use DeMorgan's Law.) f(p, q, r) = ( p q r) (p q r) = (( p q r) (p q r)) = ( ( p q r) (p q r) )

4) Intelligent life has finally been discovered on Mars! Upon further study, linguistic researchers have determined several rules to which the Martian language adheres: 1) The Martian alphabet is composed of three symbols: a, b, and c. 2) Each word in the language is a concatenation of four of these symbols. 3) Each command in the language is composed of three words. a.) How many distinct commands can be created if words in a single command can be repeated and two commands are identical only if the three words AND the order in which the words appear are identical? (Thus, the commands "aaca baaa aaca" and "baaa aaca aaca" are two DIFFERENT commands.) Total of 12 symbols in a command. For each of these symbols, we have 3 choices without any restrictions. These choices are independent of one another, so the total number of commands we have is 3 12. b.) How many distinct commands can be created if word position does not affect meaning and a given word may appear at most once in a single command? (Thus, "abca bbac abbb" and "bbac abbb abca" should NOT count as different commands, and "aaca baaa aaca" is an INVALID command.) Since we are not allowed to repeat words and word order doesn't matter, we are essentially choosing three words out of the a possible number of words. Thus, we must first figure out the possible number of words. There are three choices for each of four symbols, using the multiplication principle as we did in part a, we have 3 4 = 81 possible Martian words. Of these, we can choose three to make a valid command. Thus, the total number of possible commands here is 81 C 3 = (81)(80)(79)/6 = 85320

5) The greatest common divisor(gcd) of three positive integers a, b, and c is simply defined as the largest positive integer that is a factor of a, b, and c. a) Show that the following is false: gcd(a, b, c) = gcd(a, b+c). Let a=6, b=5, c=7. Clearly gcd(a,b,c) = 1 since none of the values share a common factor. But, we have gcd(a,b+c) = gcd(6,12) = 6. Thus, the given statement is indeed false. b) Describe a method (that does NOT use prime factorization of the three integers) to compute the gcd of three integers, and use this method to find gcd(26, 78, 117). gcd(a,b,c) = gcd(gcd(a,b),c). Thus, we can use Euclid's algorithm to compute the gcd of a and b. Let this value be d. Then, reuse Euclid's algorithm to calculate the gcd of c and d. (Let this be e.) This value, is the desired gcd. This works because we know that d a, d b, e d and e c. Since e d, it follows that e a and e b. This shows that our algorithm returns a common divisor of a, b and c. Now, we need to show that this is the greatest common divisor of the three values. Let f be a divisor of a, b and c. We will show that f e, proving that e is the gcd. Surely, if f a and f b, f d, since d is the greatest common divisor of a and b. (All common divisors of a number divide into it's gcd.) But we also know that f c. Thus, f is a common divisor of c and d. It follows that f e, which is the gcd(c,d). Using the technique on the given values: gcd(26, 78) = 26, since 78 = 3x26 gcd(26, 117) = 13 117 = 4x26 + 13 26 = 2x13 Thus, we have that gcd(26, 78, 117) = 13.

6) a) Prove that a relation R A A is transitive if and only if R 2 R. First we will show that R A A is transitive R 2 R. Let (x,y) be an arbitrary element of R 2. We must show that it is also an element of R. If (x,y) R 2, by the definition of relation composition, we have that there exists an element z A such that (x,z) R and (z,y) R. Since we are given that R is transitive, we can deduce that (x,y) R as desired. Now, lets show that R 2 R R is transitive. We must show that for any arbitrary elements x, y and z, if (x,y) R and (y,z) R, then (x,z) R. If we have that (x,y) R and (y,z) R, by definition of relation composition, it follows that (x,z) R 2. But, we are given that R 2 R. So it necessarily follows that (x,z) R, which is what we needed to show. b) Prove or disprove: If a relation R A A is symmetric then R 2 is symmetric as well. We must show for arbitrary elements x and y, if (x,y) R 2, then (y,x) R 2. If (x,y) R 2, by definition of relation composition, there exists an element z A such that (x,z) R and (z,y) R. Since R is symmetric, we know that (y,z) R, and (z,x) R. By using the definition of relation composition again, we have that (y,x) R 2, as desired.