CISC-203* Test #2 October 20, 2015 Student Number (Required) ______________________ SOLUTIONS Name (Optional) ________________________________ This is a closed book test. You may not refer to any resources. This is a 50 minute test. Please write your answers in ink. Pencil answers will be marked, but will not be reconsidered after the test papers have been returned. The test will be marked out of 50. Question 1 Question 2 Question 3 Question 4 /10 /10 /12 /18 TOTAL /50 Happy Birthday to John Dewey (1859 – 1952), educator and philosopher: “We only think when we are confronted with problems.” General marking philosophy: a student who gives enough of an answer to show they understood what they were supposed to do, even if they couldn't do it (or made lots of errors while doing it) should get at least 50% on that question. Full marks should be given if a solution is sound and not missing anything important. Feel free to give marks like 9.5/10 to a solution that is correct but contains a minor error. A student should only get 0/10 on a question if they made no attempt to answer it at all. Question 1 (10 marks) An equivalence relation on a set A must be - reflexive - transitive - symmetric Let A be a set of cities connected by two-way roads, in which every city is connected to at least one other city. We can drive from city x to city y if there is any sequence of roads joining them, even if it involves using some road(s) twice. Let R be the relation defined as R = {(x,y)| x ∈ A, y ∈ A, and we can drive from city x to city y} Show that R is an equivalence relation. Reflexive: since each city x is joined to at least one other city y, we can drive from x to y to x – so (x,x) ∈ R 3 marks Transitive: (x,y) ∈ R and (y,z) ∈ R implies (x,z) ∈ R because we can drive from x to y, and then drive from y to z 4 marks Symmetric: (x,y) ∈ R implies (y,x) ∈ R because the roads are two-way – whatever sequence of roads gets us from x to y will get us from y to x in the opposite direction. 3 marks As always, if the student's answer shows that they understood the three properties they should get at least 5/10, even if they were unable to answer the question. Question 2 (10 marks) (a) [5 marks] Let A and B be sets with |A| = 10 and |B| = 8. Let f : A → B be a total function. Is it possible for f -1 to be a function? Explain your answer. No, it cannot be a function. Since |A| > |B| there must be at least 2 elements of A that map onto the same element of B. In f -1 this will result in two ordered pairs starting with the same element of B. If the student's answer shows that they understood the meaning of f -1 and the meaning of “function”, they should get at least 5/10 even if they cannot answer or get the answer wrong. (b) [5 marks] Let f : B → C and g : A → B be total functions. Prove that if f ◦ g is 1-to-1, then g is also 1-to-1 Proof: Suppose g is not 1-to-1. That means that there are two different elements of A, call them a1 and a2, such that g(a1) = g(a2). Let x = g(a1) ... ie x = g(a2) also Since f is a total function, we know f(x) is defined. Let y = f(x) Then f ◦ g(a1) = f(g(a1)) = f(x) = y and f ◦ g(a2) = f(g(a2)) = f(x) = y Thus f ◦ g is not 1-to-1 Therefore g is 1-to-1 CONTRADICTION Marking: if the student's answer shows they understood function composition and the meaning of 1-to-1, they should get at least 5/10. They are not required to use proof by contradiction. If the student's proof is incorrect or incomplete, please give part marks. Question 3 (12 marks) Let S = {0,2,4} Define addition of a and b as a+b (mod 6) Define multiplication of a and b as a*b (mod 6) (a) [2 marks] Show that in this system there is an additive identity. (b) [4 marks] Show there is a multiplicative identity. (c) [2 marks] Show that every element has an additive inverse. (d) [4 marks] Show that every non-zero element has a multiplicative inverse. (One way to show all of these is to write out the addition and multiplication tables for this system, then use those to identify the identity values and the inverses.) Answer here: + 0 2 4 * 0 2 4 0 0 2 4 0 0 0 0 2 2 4 0 2 0 4 2 4 4 0 2 4 0 2 4 The additive identity is 0 The multiplicative identity is 4 The additive inverse of 0 is 0, and 2 and 4 are each other's additive inverse The multiplicative inverse of 2 is 2, and of 4 is 4 Students may also answer without drawing the tables, but if so they need to give some justification for their answers (for example, “4 is the multiplicative identity because 4*0 = 0, 4*2 = 2, and 4*4 = 4”) If the student's answer shows that they understood the concepts of the identities and inverses, they should get at least 9/18. If their reasoning is good but they get an incorrect answer due to an error in arithmetic, they should get 15/18 or 16/18 Question 4 (18 marks) This question involves EXCLUSIVE-OR. Remember that the EXCLUSIVE-OR of two binary values is given by XOR(0,0) = 0, XOR(0,1) = 1, XOR(1,0) = 1, XOR(1,1) = 0 Let V be the set {(0),(1),(2),(3),(4),(5),(6),(7)} and let F = Z2 Each vector in V corresponds in the natural way to a 3-bit binary representation: (0) : 000 (1) : 001 (2) : 010 (3) : 011 (4) : 100 (5) : 101 (6) : 110 (7) : 111 Define vector addition as (a) + (b) = (c) where (c)'s representation is the EXCLUSIVE-OR of the representations of (a) and (b) For example, to compute (5) + (3) (5) : 101 and (3) : 011. EXCLUSIVE-OR(101, 011) = 110 110 is the representation of (6) Thus (5) + (3) = (6) (a) [4 marks] What is the additive identity for this vector space? Why? The additive identity is (0), because taking the exclusive-or of 000 with any binary string will give the same binary string. Marking part (a): if they show they understand what an additive identity is, but they can't get an answer, they should still get at least 2/4 (b) [10 marks] Show that (x) is its own additive inverse for all (x) ∈ V When we exclusive-or any binary string with itself, all the 1s “cancel out” and we are left with just 0s. Therefore (x) + (x) = (0) for all(x) If they show they understood what “additive inverse” means in a vector space, they should get at least 5/10. If they get the wrong answer due to not understanding “exclusive-or” but apart from that their answer is good, they should get about 8/10 (c) [4 marks] How would you define scalar-vector multiplication for this vector space? (Hint: remember the vector space we built out of subsets of a set.) I would define 0*(a) = (0) and 1*(a) = (a) It is not necessary (for the purposes of answering this question) to show that this satisfies the requirements of a vector space. As long as they show they understood what “scalar-vector multiplication” means and remember that the scalars in this vector space are just 0 and 1, they should get full marks.