Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Computer Science Foundation Exam May 4, 2007 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 three (3) problems. You must do all of them. They count for 40% of the Discrete Structures 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. Question # Category 1 2 3 ALL PRF (Induction) PRF (Direct Proof) PRF (Logic) --- Score Pass Thresh 8 8 8 Max Score 15 15 10 40 FOUNDATION EXAM (DISCRETE STRUCTURES) Answer all of Part A and all 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 all of the following problems (1, 2, 3 and 4). 1) (15 pts) (PRF) Induction The sequence of Fibonacci numbers is defined as follows: F0 0 , F1 1 and Fn Fn1 Fn2 for all integers n greater or equal to 2. Using induction on n, prove that n 1 1 Fn 1 1 0 F n for all positive integers n. Fn , Fn 1 Remarks: Recall that 2x2 matrices are multiplied as follows: a b e c d g f ae bg h ce dg af bh . cf dh 1 2 5 6 1(5) 2(7) 1(6) 2(8) 19 22 For example, . 3 4 7 8 3(5) 4(7) 3(6) 4(8) 43 50 A matrix raised to a positive integer exponent n indicates multiplying that matrix by itself 1 1 1 1 1 1 1 3 n times. For example, 0 2 0 2 0 4 . 0 2 2 2) (15 pts) (PRF) Sets Let A, B and C be arbitrary sets taken from the universe of integers, and let P(X) denote the power set of a set X. Prove the following assertion using direct proof. Specifically, show that both of the listed sets are subsets of each other. P( A) P( B) P( A B) 3) (10 pts) (PRF) Logic Use the laws of inference to justify the following argument: p (s q) (q p) r r (s t ) ______________ t Please name the law of inference used in each step of your proof. Solution to Problem 1: (PRF) The sequence of Fibonacci numbers is defined as follows: F0 0 , F1 1 and Fn Fn1 Fn2 for all integers n greater or equal to 2. Using induction on n, prove that n 1 1 Fn 1 1 0 F n for all positive integers n. Fn , Fn 1 1 1 1 1 1 Base case: n = 1. LHS = , RHS = 0 1 0 1 Thus, the given statement is true for n = 1. (2 pts) F2 F 1 F1 1 1 F0 1 0 Inductive hypothesis: Assume for an arbitrary positive integer n=k that k Fk 1 1 1 1 0 F k Fk . (2 pts) Fk 1 1 1 Inductive step: We have to prove for n=k+1 that 1 0 1 1 1 0 k 1 1 = = k 1 F k 2 Fk 1 Fk 1 . (2 pts) Fk k 1 1 1 1 1 0 1 0 1 1 1 Fk 1 Fk 1 0 F k Fk 1 (2 pts) using the IH (2 pts) Fk 1 Fk Fk Fk 1 using def of matrix mult (2 pts) F Fk k 1 Fk 2 Fk 1 = F applying def of Fibonacci numbers (2 pts) k 1 Fk This completes the proof of the inductive step. n 1 1 Fn 1 Fn Conclusion: Therefore, is true for all positive integers n. (1 pts) 1 0 Fn Fn 1 = Solution to Problem 2: (PRF) Let A, B and C be arbitrary sets taken from the universe of integers, and let P(X) denote the power set of a set X. Prove the following assertion using direct proof. Specifically, show that both of the listed sets are subsets of each other. P( A) P( B) P( A B) We must prove the following two assertions: (3 pts) (1) P( A) P( B) P( A B) . (2) P( A B) P( A) P( B) First we prove (1): We must show for an arbitrary element x, if x P( A) P( B) , then x P( A B) . Using direct proof, we assume for an arbitrarily chosen element x, that x P( A) P( B) . (1 pt) This implies that x P ( A) and x P (B ) , by the definition of set intersection. (1 pt) By definition of a power set, we derive that x A and x B. (1 pt) Since the elements of x are completely contained in both A and B, it follows that x A B . (2 pt) Finally, by definition of a power set, we conclude that x P( A B) , as desired. (1 pt) Now we prove (2): We must show for an arbitrary element x, if x P( A B) , then x P( A) P( B) . Using direct proof, we assume for an arbitrarily chosen element x, that x P( A B) . (1 pt) By definition of a power set, this implies that x A B . (1 pt) Since x must be completely contained in the intersection of the elements of A and B, x must be completely contained in the elements of A, and the elements of B. Thus, x A and x B . (2 pt) By definition of a power set, we have that x P ( A) and x P (B ) . (1 pt) Finally, by the definition of set intersection, we have that x P( A) P( B) as desired. (1 pt) Solution to Problem 3: (PRF) Use the laws of inference to justify the following argument: p (s q) (q p) r r (s t ) ______________ t Please name the law of inference used in each step of your proof. 1 2 3 4 5 6 7 8 9 10 s q q p q p q pr r r (s t ) (s t ) s t Premise Conj Simplification Premise 2, 3, and Conjunction Premise 4, 5, and Detachment (Modus Ponens) Premise 6, 7, and Detachment (Modus Ponens) 1 and Conj Simplification 8, 9, and Disjunctive Syllogism Grading: 1 point for each step. If all the steps are correct but the names of the rules are omitted, subtract 3 points total. Computer Science Foundation Exam May 4, 2007 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 four (4) problems. You must do ALL of them. Each counts for 15% of the Discrete Structures 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. Question # Category 4 5 6 7 ALL CTG (Counting) PRF (Direct) PRF (Direct) NTH (Number Theory) --- Score Pass Thresh 10 8 10 8 36 Max Score 15 15 15 15 60 PART B: Work ALL 4 of the problems 4 – 7. 4) (CTG) Counting (a) (5 pts) Given 20 distinct points, such that no three are on the same line, how many unique triangles can be formed using these points? (b) (10 pts) How many different seven letter strings can be formed from the letters contained in the word "BALLOONS"? (Note: The order of the letters matters, thus, BALLOON is different from LABLOON. Also, the number of times a letter appears in the string can NOT exceed the number of times it appears in BALLOONS.) Solutions (a) Any choice of three points out of the 20 possible points will form a unique triangle, since no three of the points are on the same line. Thus, we must count the number of 20 (20)(19)(18) ways of choosing three points out of 20 which is 1140 . 3! 3 Grading: 2 points for observing that each choice of points corresponds to a unique triangle. 1 point for using a combination in the answer, 1 point for 20 and 1 point for 3. (b) We will split our counting into three separate groups: (1) strings with 2 Os and 2 Ls (2) strings with 2 Os and 1 L (3) strings with 1 O and 2 Ls For the first group of strings, there are 4 choices for the set of three other letters. (These choices are BAN, BAS, BNS and ANS.) For each of these four choices, we are permuting seven letters with 2 Os and 2 Ls. Using the permutation with repetition 7! formula, we get permutations. We must multiply this by 4 to obtain the total number 2!2! 7! 7! (4 pts – 1 for the 4, 3 for the perms) of permutations in this set, which is 4 2!2! For the second group of strings, there is only one choice for the set of the four remaining 7! letters: BANS. Thus, the total number of permutations in this group is simply , since 2! we have to account for the 2 Os. (3 pts) Finally, the third group has the same number of strings as the second, Adding these three together we get a total of 7!2 7! . (1 pt) 2! 7! 2(7!) 10,080 . (2 pts) 2! Here's a more slick solution: When we are permuting ALL of the letters, the last letter is always fixed. Thus, the number of permutations of 7 letters of BALLOONS is the SAME 8! 8(7!) 2(7!) . as the number of permutations of all 8 of the letters, which is just 2!2! 4 Grading: 5 points for the explanation of the 1 to 1 correspondence, 5 points for applying the permutation formula properly. This way is a lot easier! 5) (PRF) Relations (a) (12 pts) Let V be the set of all voters casting a vote for a presidential candidate in a single election. Each voter votes for exactly one candidate. Define a relation, R: V V, that imposes an equivalence relation on the set of voters. Justify that R is an equivalence relation. (b) (3 pts) If there are three candidates (with no write-ins allowed) how many equivalence relations may be created? (Note: let |V| denote the cardinality of the set of voters, V.) Solution (a) R = “voted for the same candidate”, thus aRb iff voters a and b voted for the same candidate. (3 pts) There are two ways to justify: 1.) Identify that an equivalence relation is reflexive (2 pts), transitive (2 pts), and symmetric (2 pts). Provide some reasoning such as “a voted for the same candidate as self” (1 pt), “if a and b voted for a candidate and b and c voted for the same candidate then a and c voted for the same candidate” (1 pt), and “if a and b voted for the same candidate, then b and a voted for the same candidate” (1 pt). 2.) Identify that an equivalence relation partitions a set (2 pts), and that a partition must place each member of the set into exactly one partition (2 pts), and the union of all partitions must equal the original set (2 pts). Any argument justifying that all voters voted (ie are placed in exactly one subset) (1 pt), voting for exactly one candidate implies membership in exactly one subset of V (1 pt), and all voters are placed in a subset (the union of all subsets equals V) (1 pt) justifies that R is an equivalence relation. Solution (b) Since there are 3 candidates, each voter may be placed in one of three subsets of V. This is the same as “tagging” each member of V with one of three distinct values, and there are 3^|V| number of possible equivalence relations (partitions). Correct answer (1 pt) and justification for any answer (2 pts). 6) (15 pts) (PRF) Functions 3x , with a domain of x (,2) . Determine f x2 range of f 1 ( x) . Let f ( x) x 3 f 1 ( x) f 1 ( x) 2 1 ( x) and the domain and (1 pt) ( f 1 ( x) 2) x 3 f 1 ( x) (2 pts) xf 1 ( x) 2 x 3 f 1 ( x) (2 pts) xf 1 ( x) 3 f 1 ( x) 2 x (2 pts) 1 ( x)( x 3) 2 x (2 pts) 2x f 1 ( x) (2 pts) x3 f The range of f 1 ( x) is f 1 ( x) (,2) , since the range of an inverse function is always the domain of the original function. (1 pt) The input values of x which produce these output values are all values of x < 3. As x approaches negative infinity, f 1 ( x) approaches 2 and as x approaches 3 from the left, f 1 ( x) approaches negative infinity. Thus, the domain of this inverse function is x (,3) (1 pt) 7) (NTH) Number Theory (a) (5 pts) Use the Euclidean Algorithm to find gcd(898, 320). (b) (10 pts) Using the direct proof method, prove that (a b) n b n (mod a) , where a and b are arbitrary integers and n is an arbitrary positive integer. Hint: apply the Binomial Theorem. In doing so, show that all but one of the terms in the expansion have a factor of a. (a) 898 = 2x320+258 320 = 1x258+ 62 258 = 4x62 + 10 62 = 6x10 + 2 10 = 5x2 + 0 so gcd(320, 258) = 2. (1 pt for each step) n n (b) (a b) n a k b nk (3 pts) k 0 k n n b n a k b n k (3 pts) k 1 k n n b n a a k 1b n k (2 pts) k 1 k n (b 0)(mod a) , since a is a factor in the second term above (1 pt) b n (mod a) (1 pt) Note: You may still award full credit even if summation signs aren't used, but the steps are essentially followed.