Discrete Math problems Problem 21, page 311 How many strings of three decimal digits? a) do not contain the same digit three times? b) begin with an odd digit? c) have exactly three digits that are 9s? solution a) The total number of strings of three decimal digits is 103. Of them, 10 contain the same digit three times – they are 000, 111, 222, ..., 999. Hence, the answer is 103 – 10 = 990. b) There are 5 odd digits among 10 possible digits. So, half of all strings begin with an odd digit: 103 / 2 = 500. c) The answer is 1, the only such string is 999. Problem 31, page 311 How many one-to-one functions are there from a set with five elements to sets with the following number of elements? a) 4 b) 5 c) 6 d) 7 solution a) None at all. One-to-one function is possible only if the number of elements are the same in each set. b) 5! = 120, the number of permutations of 5 elements. c) None at all. d) None at all. Problem 2, page 319 Show that if there are 30 students in a class, then at least two have last names that begin with the same letter. solution Because there are only 26 different letters! Problem 21, page 325 How many permutations of the letters ABCDEFG contain a) the string BCD? b) the string CFGA? c) the strings BA and GF? d) the strings ABC and DE? e) the strings ABC and CDE? f) the strings CBA and BED? solution a) Consider a set of strings M = {A, E, F, G, BCD}. Note that the set of permutations of letters ABCDEFG which contain the string BCD is equivalent to the set of permutations of the elements of M. Since M contains 5 elements, the answer is 5! = 120. b) Consider a set M = {B, D, E, CFGA}. As above, the set of permutations of letters ABCDEFG which contain the string CFGA is equivalent to the set of permutations of the elements of M. The answer is 4! = 24. c) Here take M = {C, D, E, BA, GF}. The reasoning is same as above. M contains 5 elements, and the answer is 5! = 120. d) Take M = {ABC, DE, F, G}. With the same reasoning, the answer is 4! = 24. e) The strings ABC and CDE may be both present in the permutation only if it contains the whole ABCDE string (the letter C may appear only once!). Take M = {ABCDE, F, G}. By the same old reasoning, the answer is 3! = 6. f) No such permutation possible! B may appear only once. The answer is 0. Problem 39, page 343 How many ways are there to travel in xyz space from the origin (0,0,0) to the point (4,3,5) by taking steps on unit in the positive x direction, one unit in the positive y direction, or one unit in the positive z direction? (Moving in the negative x, y, or z direction is prohibited, so that no backtracking is allowed). solution notation remark: C(n,k) is a number of simple combinations of k elements from n, C(n,k) = n! / ( k!(n-k)! ) We have to make 4 steps in x direction, 3 steps in y direction and 5 steps in z direction, a total of 12 steps. There are C(12,4) ways to choose which steps will be in x direction. Once they are chosen, there are C(8,3) ways to choose which of the other steps will be in y direction. The 5 left steps are automatically assigned to z direction. So, the answer is C(12,4) * C(8,3) = 27,720. Problem 9, page 456 How many students are enrolled in a course either in calculus, discrete mathematics, data structures, or programming languages at a school if there are 507, 292, 312, and 344 students in these courses, respectively; 14 in both calculus and data structures; 213 in both calculus and programming languages; 211 in both discrete mathematics and data structures; 43 in both discrete mathematics and programming languages; and no student may take calculus and discrete mathematics, or data structures and programming languages concurrently? solutions notations: C – the set of students enrolled in calculus, D – in discrete maths, S – in data structures, P – in programming. M = C+D+S+P is the universal set. CD = CD is set intersection C+D = CD is set union C – S is a set difference #C is the number of elements in C We have: #C = 507, #D = 292, #S = 312, #P = 344; #CS = 14, #CP = 213, #DS = 211, #DP = 43, #CD = 0, #SP = 0. We have to find #M = #(C+D+S+P). Here’s the Vienn diagram for this problem: S S–C-D CS DS C D DP CP P–C-D P #(S – C – D) = #S - #CS - #DS = 312 – 14 – 211 = 87 #(P – C – D) = #P - #CP - #DP = 344 – 213 – 43 = 88 #M = #(C+D+S+P) = #C + #D + #(S – C – D) + #(P – C – D) = 507 + 292 + 87 + 88 = 974 So, the answer is 974.