You are on page 1of 4

CMPC1F02 Computing Fundamentals I Exercise Sheet 1 Answers

1. Write out in terms of an explicit list the following sets: (a) A = {x : x is a prime number, 10 x 30} (b) B is the set of days in the week that begin with an S. (c) C = {x : x = 2y for some y N, 1 x < 14} (d) D = {x : x Z, |x| 2} Answers: (a) A = {11, 13, 17, 19, 23, 29} (b) B = {Saturday, Sunday} (c) C = {2, 4, 6, 8, 10, 12} (d) D = {2, 1, 0, 1, 2} 2. Find the cardinalities of the following sets: (a) A = {x : x is a prime number, 10 x 23} (b) B = {x : x N, x < 10} (c) C = {x : x Z, 1 x2 10} (d) D = {x : x Z, |x| 3} Answers: (a) |A| = 5 because A = {11, 13, 17, 19, 23} (b) |B| = 0 because there are no natural numbers less than zero. (c) |C| = 6 because C = {1, 2, 3, 1, 2, 3} (d) |D| = 7 because D = {1, 2, 3, 0, 1, 2, 3} 3. Let A = {x : x N and 1 < x < 50}, B = {x : x R and 1 < x < 50}, and C = {x : x Z and |x| 25} . Which of the following statements are true? For those that are not true, why not? (a) B A (b) 17 A (c) 3 A (d) 40 C (e) {0, 1, 2} A (d) |C| = 26 1

Answers: (a) False. There are innitely more real numbers than natural numbers. (b) True. 17 is a natural number within the range. (c) False. The square root of 3 is not a natural number. (d) False. -40 is an integer but is outside the specied range. (e) True, provided 0 is considered a natural number, else false. (f) False. |C| = 51. 4. Let U = {x : x Z, 5 x 6}. Suppose A = {4, 1, 3, 1, 4, 6}, B = {2, 3, 6}, and C = {2, 4, 1, 6}. (a) What are A C, A B C, (A B) C, and (AC) B ? (b) Represent each of the four sets given in part (a) as a Venn diagram. Answers:

A C = {4, 1, 3, 1, 4, 6, 2}

A B C = {6}

(A B) C = {4, 1, 1, 4, 6, 2}

(AC) B = {1, 2, 3, 4, 6}

5. In a rst year class of computing science school comprising of 50 students, 30 study C++, 25 study Perl, and 10 study both. How many students study neither C++ nor Perl? 2

Figure 1: A total or 18 people like Dance Music. Answer: Note that 10 study both, which is the intersection of Perl and C++, so (30 - 10) just study C++, and (25 - 10) just study Perl, leaving 5 studying neither. Therefore: 50 - (30 -10) - (25 -10) - 10 = 5. 6. In a group of 24 people who like rock, punk, or dance music, 14 like rock, 17 like punk, 11 like rock and punk, 9 like rock and dance, 13 like punk and dance, and 8 like all three types of music. How many like dance music? Answer: Using the Venn Diagram shown in Figure 1, and starting with the intersection of all three sets is 8, by elimination the total number of people who like dance music is 18. And from the principles of inclusion and exclusion: |A B C| = |A| + |B| + |C| |A B| |A C| |B C| + |A B C| 7. Use the laws of set theory to simplify the following: (a) (A B) (A B) (b) A B (A B C) Answer: (a) (A B) (A B) = A (b) A B (A B C) = (A B) C

8. Suppose that X = {a, b} and Y = {c, d, e}. Write out in terms of an explicit list the following sets: (a) P (X) (b) X Y (c) P (X X) Answer: (a) P (X) = {, {a, b}, {a}, {b}}. (b) X Y = {(a, c), (a, d), (a, e), (b, c), (b, d), (b, e)}.

(c) P (X X) = {, {(a, a), (a, b), (b, a), (b, b)}, {(a, a)}, {(a, b)}, {(b, a)}, {(b, b)}, {(a, a), (a, b)}, {(a, a), (b, a)}, {(a, a), (b, b)}, {(a, b), (b, a)}, {(a, b), (b, b)}, {(b, a), (b, b)}, {(a, b), (b, a), (b, b)}, {(a, a), (b, a), (b, b)}, {(a, a), (a, b), (b, b)}, {(a, a), (a, b), (b, a)}}.

You might also like