2015-2016 Fall Semester First Midterm Examination 1) 6 students will sit at a round table. Anıl, Sümeyye and Tahsin are in section 1 and Bora, İpek and Efnan are in section 2. They will sit such that nobody is next to someone in his/her own section. In how many different ways can they do that? 2) We have 5 Red, 5 White and 5 Blue chips. We will arrange them in a line, but we want all reds to be on the left of all blues. For example, RRWWRWRRWBBBWBB is acceptable, RRWBWRWRRWBBWBB is not. How many arrangements are there? 3) Let A = {1, 3, 5,...} denote the set of all positive odd integers and B = {2, 4, 6,...} the set of all positive even integers. Are the following statements true or false? Explain! For all m A there exists n B such that m < n. There exists m A such that m < n for all n B. There exists n B such that m < n for all m A. For all m A there exists n B such that n = 4m. 4) Prove that 4 17 n 13 n for all n 1. 5) How many zeroes are there at the end of 128!? Explain. Bonus) Suppose that everyone who is young and healthy is happy. Are the following claims about three different people correct? Explain. a) A is not happy. Therefore A is not young and A is not healthy. b) B is happy. Therefore B is young. c) C is not happy and C is young. Therefore C is not healthy.
Answers 1) 2! 3! = 12 2) Place 5 Reds and 5 Blue s. Then, fill the 11 spaces with Whites randomly. This is like distributing 5 identical objects to 11 distinct boxes. ( ) 11 + 5 1 = 15! 5 5! 10! = 3003 3) TRUE. (Given any odd number, we can find a larger even number) TRUE. (1 is smaller than any positive even number) FALSE. (There is no even number larger than all odd numbers) TRUE. (Four times an odd number is an even number) 4) Let s use mathematical induction. The statement is correct for n = 1. Suppose it is correct for n = k, in other words 4 17 k 13 k Now consider n = k + 1 17 k+1 13 k+1 = 17 17 k 13 13 k = 4 17 k + 13 17 k 13 13 k 4 4 17 k and 4 13 (17 k 13 k ) Therefore 4 4 17 k + 13 17 k 13 13 k In other words 4 17 k+1 13 k+1 Bonus) 5) For a zero, we need 10 = 5 2 as a factor. There are more 2 s than 5 s, in any factorial, so we have to count 5 s. Don t forget that 25 and multiples contain two, 125 contain three 5 s. 128 + 5 128 + 25 128 = 31 125 a) FALSE. A is not young OR A is not healthy. b) FALSE. B may be old. c) TRUE. We can see this by taking the contrapositive of the given statement. Not happy not young OR not healthy.
2015-2016 Fall Semester Second Midterm Examination 1) Consider the students in our University. Define a relation between them as follows: If their birthdays (just the day and month) is 5 days or less apart, they are related. For example, suppose you were born on December 3. Then you will be related to people born between November 28 and December 8 (inclusive). You will NOT be related to someone born on January 10, or December 9. a) Is this relation Reflexive? b) Is this relation Symmetric? c) Is this relation Anti - Symmetric? d) Is this relation Transitive? e) Is this relation an Equivalence relation? 2) A very large number of students take an examination. Their grades are integers in the range [0, 100]. We randomly select 2015 groups of students. Each group consists of 5 students. Show that we can always find 5 groups with exactly the same average grade. 3) Determine the number of onto functions from A = {1, 2, 3, 4, 5, 6} to B = {a, b, c, d}. 4) We will form 3 teams from 10 distinct workers. In how many different ways can we do this? (Each team contains at least one worker)
5) A group of 7 people find a buried treasure consisting of 40 identical pieces of gold. They will share the gold among themselves according to following constraints: Berke gets even number. Ece gets a multiple of 3. Gizem gets a multiple of 4. Merve gets 0,1 or 2. Sergen gets 0 or 2. Utku gets 0 or 1. Yılmaz gets 0 or 1. In how many different ways can they do this? Bonus) 6 people on an air plane have identical suitcases. On exit, they take one randomly. Aslı and Kardelen make a bet on how many of them will get their own suitcases. Aslı thinks that, nobody will get his/her own suitcase. Kardelen thinks that, exactly one person will get his/her own suitcase. Who is more likely to win?
Answers 1) a) YES, everybody is born on the same date with himself/herself. b) YES, if x is related to y, obviously, y is related to x. c) NO (for the same reason) d) NO, if x is related to y and y is related to z, x is not necessarily related to z. For example, their birthdays may be on 5th, 8th and 11th of the month. e) NO, not transitive. 2) Note that the object of interest is the group, not the student. The possible values for group average are: {0, 0.2, 0.4, 0.6,..., 99.6, 99.8, 100.0} There are 501 different possibilities. It is easier to see this if we look at the sum of group s grades, where the possibilities are: {0, 1, 2,..., 499, 500} This makes 501 holes and 2015 pigeons. Therefore there are 2015 = 4.02 = 5 501 groups with the same average by pigeonhole principle. 3) 4 6 ( ) 4 3 6 + 1 ( ) 4 2 6 2 ( ) 4 1 6 = 1560 3
4) Using Stirling numbers on the table: S(10, 3) = S(9, 2) + 3S(9, 3) = 255 + 3 3025 = 9330 OR, we may obtain the same result by inclusion-exclusion: 3 10 3 2 10 + 3 1 10 3! = 9330 5) The series representing these constraints are: 1 1 x 2 1 1 x 3 After cancellations, we obtain: 1 (1 x) = ( ) n + 2 x n 3 n n=0 The coefficient of x 40 is: ( ) 42 = 861 40 1 1 x 4 1 x3 1 x (1 + x2 ) (1 + x) (1 + x) Bonus) The number of different cases where Aslı wins is the derangements of 6: ( ) ( ) ( ) ( ) ( ) ( ) 6 6 6 6 6 6 6! 5! + 4! 3! + 2! 1! + 0! = 265 1 2 3 4 5 6 The number of different cases where Kardelen wins is 6 times the derangements of 5: [ ( ) ( ) ( ) ( ) ( ) ] 5 5 5 5 5 6 5! 4! + 3! 2! + 1! 0! = 6 44 = 264 1 2 3 4 5 So Aslı is more likely to win. (By a very small margin) Probabilities are: 265 6! = 0.3681 for Aslı and 264 6! = 0.3667 for Kardelen. Note that both numbers are approximately equal to e 1 = 0.3679
2015-2016 Fall Semester Final Examination 1) Find two integers p, q such that 64p + 59q = 1. 2) a) Find a function f : Z Z such that f is one-to-one but not onto. b) Find a function g : Z Z such that g is onto but not one-to-one. 3) Elements in a set A may or may not have the properties P, Q, R, S. (For example, A may be a set of integers and P denote divisible by 4 etc.) Are the following logical inferences correct? In other words, does the conclusion follow from assumptions? Explain your reasons. a) If an element has property P, then it has properties Q and R. The element x has property Q. Therefore x also has property R. b) If an element has properties P and Q, then it has property S. The element y has property S. Therefore y also has properties P and Q. c) If an element has properties P, Q and R, then it has property S. The element z has properties P, Q and S. Therefore z also has property R. d) If an element has properties P and R, then it has properties Q and S. The element w has property Q but it does not have the property S. Therefore w does not have the property P or w does not have the property R. 4) We will form a 7-letter sequence using the letters A, B, C. Each letter must appear an odd number of times or zero times. How many possible sequences are there?
5) Find the asymptotic complexity of the following algorithm: INPUT: Integer n //A is an n n matrix For i = 1 to n For j = 1 to n A(i, j) = 1/(i + j) EndFor EndFor For i = 1 to n If i is even A(i, i) = 1 Else A(i, i) = 1 EndIf EndFor Return A Bonus) There are 8 chairs in a classroom. 6 students attend a lecture. After the break, the same 6 students come to the same class and choose chairs randomly. How many arrangements are there where exactly 2 students sit on their previous chairs?
Answers 1) Using Euclid s algorithm 64 1 59 = 5 59 11 5 = 4 5 1 4 = 1 4 4 1 = 0 Therefore gcd(64, 59) = 1. Reverse this process to obtain: 1 = 5 1 4 = 1 59 + 12 5 = 12 64 13 59 So p = 12 and q = 13. 2) Many different solutions are possible. An example is: a) f(n) = 2n { b) g(n) = n/2 if n is even (n + 1)/2 if n is odd 3) a. FALSE. We have no information on R. Example: A: Positive integers, P : multiple of 6, Q: multiple of 2, R: multiple of 3. Obviously, if an integer is multiple of 6, it is multiple of 2 and multiple of 3. But if an integer is multiple of 2, it is not necessarily multiple of 3. b. FALSE. Converse of a true statement is not necessarily true. Example: A: Positive integers, P : multiple of 9, Q: multiple of 4, S: multiple of 6. Obviously, if an integer is multiple of 9 AND 4 then it is a multiple of 6. But if an integer is multiple of 6, it is not necessarily multiple of 9. c. FALSE. We have no information on R. Example: A: Positive integers, P : multiple of 5, Q: multiple of 3, R: multiple of 4, S: multiple of 30. Obviously, if an integer is multiple of 5, 3 AND 4 then it is a multiple of 30. But if an integer is multiple of 5, 3 and 30, it is not necessarily multiple of 4. d. TRUE. (P R) P R
4) Order is important we have to use exponential generating functions. (1 + x + x 3 + x 5 ) 3 = (1 + ex e x 2 ) 3 = 4 + 9ex 9e x + 6e 2x + 6e 2x + e 3x e 3x 8 In the Taylor series expansion of this function, the coefficient of the term x7 7! is: 1 ( 9 + 9 + 6 2 7 6 2 7 + 3 7 + 3 7) = 9 + 37 8 4 5) Θ(n 2 ) + Θ(n) = Θ(n 2 ) ( ) 6 Bonus) Choose two students in = 15 different ways. The rest is an inclusion-exclusion problem. 2 We have 4 items and 6 containers. Each container can contain at most 1 item. Item 1 can NOT be placed in container 1 etc. ( ) ( ) ( ) ( ) 4 4 4 4 6 5 4 3 5 4 3 + 4 3 3 + = 181 1 2 3 4 So the answer is: 15 181 = 2715
Name-Surname: 12.10.2015 CLASSWORK 1 We will distribute 40 identical balls to 10 different children such that each child gets at least 2 and at most 20 balls. In how many different ways can we do this? First, give 2 balls to each of the 10 children. Distribute the remaining 20 balls to 10 children randomly. This can be done in ( ) 20 + 10 1 = 20 ( ) 29 20 different ways. Among these distributions, there are 10 cases where one child gets all 20 (total number of 22) balls and 10 9 = 90 cases where one child gets 19 (total number of 21) balls. So we have to subtract these. ( ) 29 10 90 = 10 014 905 20
Name-Surname: 14.10.2015 CLASSWORK 1 Find the number of integer solutions of the system of inequalities x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 25 15 x 1 + x 2 + x 3 + x 4 + x 5 + x 6 + x 7 0 x i Distributing 25 or fewer items to 7 boxes is equivalent to distributing exactly 25 items to 8 boxes: ( ) 25 + 8 1 = 25 ( ) 32 25 We want to distribute 15 or more, so we have to subtract the number of distributions where the total is 14 or fewer. Distributing 14 or fewer items to 7 boxes is equivalent to distributing exactly 14 items to 8 boxes: ( ) 14 + 8 1 = 14 ( ) 21 14 ( ) 32 25 ( ) 21 = 3 249 576 14
Name-Surname: 19.10.2015 CLASSWORK 2 Are the following pairs of compound statements logically equivalent or not? Explain. a) x (P (x) Q(x)) and ( x P (x)) ( x Q(x)) b) x (P (x) Q(x)) and ( x P (x)) ( x Q(x)) a) YES they are logically equivalent. The first statement says that both P (x) and Q(x) are correct for all elements in the set. The second statement says exactly the same thing. b) NO they are not logically equivalent. The first statement says there is an element x for which both P (x) and Q(x) are true. The second statement says there are two elements, x 1, x 2 such that P (x 1 ) is true and Q(x 2 ) is true. We do not know if x 1 and x 2 are the same or not. For example, suppose three students are sitting at a table. a. At least one of them has passed both PHYS and MATH courses. b. At least one of them has passed PHYS course and at least one of them has passed MATH course. It is clear that these two statements are not equivalent. 1) may be FALSE while 2) is TRUE.
Name-Surname: 21.10.2015 CLASSWORK 2 Are the following pairs of compound statements logically equivalent or not? Explain. a) x (P (x) Q(x)) and ( x P (x)) ( x Q(x)) b) x (P (x) Q(x)) and ( x P (x)) ( x Q(x)) a) NO they are not logically equivalent. The first statement says P (x) or Q(x) is true for all elements in the set. The second statement says P (x) is true for all elements or Q(x) is true for all elements. For example, suppose three students are sitting at a table. a. All of them have passed at least one of the two courses: PHYS or MATH. b. All of them have passed PHYS course or all of them have passed MATH course. It is clear that these two statements are not equivalent. 1) may be TRUE while 2) is FALSE. b) YES they are logically equivalent. The first statement says that P (x) or Q(x) is correct for some element in the set. The second statement says exactly the same thing.
Name-Surname: 09.11.2015 CLASSWORK 3 Find two integers p and q such that 23p + 33q = 1 Using Euclid s algorithm 33 1 23 = 10 23 2 10 = 3 10 3 3 = 1 3 3 1 = 0 Therefore gcd(33, 23) = 1 which means they are relatively prime. Reverse this process to obtain: 1 = 10 3 3 = 10 3 (23 2 10) = 3 23 + 7 10 = 3 23 + 7 (33 1 23) = 7 33 10 23 So p = 10 and q = 7.
Name-Surname: 11.11.2015 CLASSWORK 3 Find two integers p and q such that 42p + 51q = 3 Using Euclid s algorithm 51 1 42 = 9 42 4 9 = 6 9 1 6 = 3 6 2 3 = 0 Therefore gcd(51, 42) = 3. Reverse this process to obtain: 3 = 9 1 6 = 9 1 (42 4 9) = 1 42 + 5 9 = 1 42 + 5 (51 1 42) = 5 51 6 42 So p = 6 and q = 5.
Name-Surname: 16.11.2015 CLASSWORK 4 Let S be the set of real numbers [ 1, 1]. Consider the relation R on S defined by: (x, y) R if x 2 + y 2 = 1 a) Is this relation Reflexive? b) Is this relation Symmetric? c) Is this relation Antisymmetric? d) Is this relation Transitive? Explain your answers. a) 1 2 + 1 2 1 this relation is NOT Reflexive. b) If x 2 + y 2 = 1 then y 2 + x 2 = 1 this relation is Symmetric. c) (1, 0) R and (0, 1) R this relation is NOT Antisymmetric. d) (1, 0) R and (0, 1) R but (1, 1) / R this relation is NOT Transitive.
Name-Surname: 18.11.2015 CLASSWORK 4 Let S be the set of integers {2, 3, 4, 6, 8, 12, 16, 24, 48, 72, 96}. Consider the relation R on S defined by: (m, n) R if m n a) Is this relation Reflexive? b) Is this relation Symmetric? c) Is this relation Antisymmetric? d) Is this relation Transitive? Explain your answers. a) m m this relation is Reflexive. b) 2 4 but 4 2 this relation is NOT Symmetric. c) If m n and n m at the same time, then m = n this relation is Antisymmetric. d) If k m and m n then obviously k n this relation is Transitive.
Name-Surname: 23.11.2015 CLASSWORK 5 We choose n different 3-digit numbers randomly. We claim with certainty that there are at least two among them such that their difference is a 3 digit number with identical digits. (Such as 111,222, etc) What can you say about n? Consider all these n numbers modulo 111. Clearly, there are 111 categories: {0, 1, 2,..., 110}. Therefore if n 112 there are at least two numbers in the same category. These two numbers are different, so their difference cannot be 0. Therefore it must be a positive multiple of 111.
Name-Surname: 25.11.2015 CLASSWORK 5 We randomly place 13 squares of side length 1 inside a circle of radius 2. Show that at least two of the squares intersect. A circle of radius 2 has area 4π = 12.56 < 13. These thirteen unit squares have a total area of 13. Therefore at least two squares must intersect.
Name-Surname: 30.11.2015 CLASSWORK 6 An online dating service will match the women A,B,C with the men U,V,W,X,Y,Z. Women s constraints are: A does not want X. B does not want Y. C does not want Z. Men have no constraints. How many matchings are possible? We will use inclusion-exclusion to count the distributions as follows: All matched randomly One woman is matched to someone she does not want, the others are matched randomly + Two women are matched to someone they do not want, the other is matched randomly Three women are matched to someone they do not want. 6 5 4 3 5 4 + 3 4 1 = 71
Name-Surname: 02.12.2015 CLASSWORK 6 An online dating service will match the women A,B,C with the men U,V,W,X,Y,Z. Women s constraints are: A does not want X. B does not want X and Y. C does not want X,Y and Z. Men have no constraints. How many matchings are possible? First Solution: : We will use inclusion-exclusion to count the distributions as follows: All matched randomly One woman is matched to someone she does not want, the others are matched randomly + Two women are matched to someone they do not want, the other is matched randomly Three women are matched to someone they do not want. 6 5 4 5 4 2 5 4 3 5 4 + 4 + 2 4 + 4 4 1 = 27 Second Solution: : A better idea is to eliminate X in the beginning: 5 4 3 4 3 2 4 3 + 3 = 27 Third Solution: : An even better idea is this: First match C. She has 3 choices. (U,V,W) Then match B. She has 3 choices. (4-1) Then match A. She has 3 choices. (5-2) Therefore there are 3 3 3 = 27 different matchings.
Name-Surname: 14.12.2015 CLASSWORK 7 How many integer solution are there for the equation x 1 + x 2 + x 3 + x 4 = 21 satisfying the following conditions? 0 x 1 3 x 2 8 0 x 3 4 7 x 4 The series product representing possible solutions is: (1 + x + x 2 + )(x 3 + x 4 + + x 8 )(1 + x + x 2 + x 3 + x 4 )(x 7 + x 8 + ) = 1 1 x x 3 (1 x 6 ) 1 x (1 x 5 ) 1 x x 7 1 x = x10 (1 x 5 x 6 + x 11 ) (1 x) 4 ) ( ) n + 3 = (x 10 x 15 x 16 + x 21 x n n n=0 Coefficient of the term x 21 in this series expansion is: ( ) 14 11 ( ) 9 6 ( ) 8 + 5 ( ) 3 = 225 0
Name-Surname: 16.12.2015 CLASSWORK 7 How many integer solution are there for the equation x 1 + x 2 + x 3 + x 4 = 19 satisfying the following conditions? 0 x 1 2 x 2 9 1 x 3 6 3 x 4 The series product representing possible solutions is: (1 + x + x 2 + )(x 2 + x 3 + + x 9 )(x + x 2 + + x 6 )(x 3 + x 4 + ) = 1 1 x x 2 (1 x 8 ) 1 x x(1 x 6 ) 1 x x 3 1 x = x6 (1 x 6 x 8 + x 14 ) (1 x) 4 = ) ( ) n + 3 (x 6 x 12 x 14 + x 20 x n n n=0 Coefficient of the term x 19 in this series expansion is: ( ) 16 13 ( ) 10 7 ( ) 8 = 384 5
Name-Surname: 21.12.2015 CLASSWORK 8 We will form 16 letter sequences using the letters {x, y, z} with the following conditions: There will be at least 4 x s, Number of y s will be even. How many sequences are possible? We have to use exponential series to represent possible solutions, because order is important: ( ) ) ) x 4 (1 4! + x5 5! + + (1 x2 2! + x4 4! + + x + x2 2! + x3 3! + = [ e x (1 + x + x2 2! + x3 3! )] ( e x + e x 2 ) e x ) ( = (1 e3x 2 + ex 2 + x + x2 2! + x3 e 2x 3! 2 + 1 ) 2 Coefficient of the term x16 16! in the series expansion is: ( ) 1 3 16 + 1 2 16 16 2 15 16 15 2 14 16 15 14 2 13 = 17 951 649 2 2! 3!
Name-Surname: 23.12.2015 CLASSWORK 8 We will form 16 letter sequences using the letters {x, y, z} with the following conditions: There will be at least 2 x s, Number of y s will be odd. How many sequences are possible? We have to use exponential series to represent possible solutions, because order is important: ( ) ) ) x 2 (x 2! + x3 3! + + (1 x3 3! + x5 5! + + x + x2 2! + x3 3! + ( ) e = (e x x e x 1 x) e x 2 = e3x 2 ex 2 1 + x ( e 2x 1 ) 2 Coefficient of the term x16 16! in the series expansion is: 1 ( 3 16 1 2 16 16 2 15) = 21 228 448 2
Name-Surname: 21.12.2015 CLASSWORK 9 A very large number of students take an examination. Their grades are integers in the range [100, 700]. We randomly select 2048 groups of students. Each group consists of 3 students. Show that we can always find 2 groups with exactly the same average grade. The possible values for group sum are: {300, 301, 302,..., 2100} There are 1801 possible values for group averages. This makes 1801 holes and 2048 pigeons. Therefore there are 2048 = 1.14 = 2 1801 groups with the same average by pigeonhole principle.
Name-Surname: 21.12.2015 CLASSWORK 9 A very large number of students take an examination. Their grades are integers in the range [250, 750]. We randomly select 1999 groups of students. Each group consists of 3 students. Show that we can always find 2 groups with exactly the same average grade. The possible values for group sum are: {750, 751, 752,..., 2250} There are 1501 possible values for group averages. This makes 1501 holes and 1999 pigeons. Therefore there are 1999 = 1.33 = 2 1501 groups with the same average by pigeonhole principle. Author: Dr. Emre Sermutlu June 23, 2016