Discrete Math for CS CMPSC 360 LECTURE 44 Last time: Countable/uncountable sets Diagonalization argument Existence of problems that can’t be solved by computers. The Halting problem. Today: Review. Some topics of the exam problems. Wrap up. CMPSC 360 11/29/2018
Clicker question (frequency BC) Let X be the number of heads in 𝑛 independent coin tosses of a fair coin. What are the expectation and the variance of X? 0.5𝑛 and 0.25𝑛, respectively. (A) has correct expectation, but wrong variance. (A) has wrong expectation, but correct variance. Both expectation and variance are wrong in (A). 11/29/2018
Clicker question (frequency BC) The Triangle Fraternity is organizing a party. They invited 𝑛 guests (𝑛≥2). To keep track of which guests know which other guests, they've drawn a directed graph 𝐺 with 𝑛 nodes (one per guest), with an edge from guest 𝑥 to guest 𝑦 whenever 𝑥 knows 𝑦. A guest 𝑥 is a celebrity if every other guest knows 𝑥, but 𝑥 does not know any other guest. For this picture: A is a celebrity. B is a celebrity. C is a celebrity. D is a celebrity. There are no celebrities. A B C D 11/29/2018
Clicker question (frequency BC) The Triangle Fraternity is organizing a party. They invited 𝑛 guests (𝑛≥2). To keep track of which guests know which other guests, they've drawn a directed graph 𝐺 with 𝑛 nodes (one per guest), with an edge from guest 𝑥 to guest 𝑦 whenever 𝑥 knows 𝑦. A guest 𝑥 is a celebrity if every other guest knows 𝑥, but 𝑥 does not know any other guest. For this picture: A is a celebrity. B is a celebrity. C is a celebrity. D is a celebrity. There are no celebrities. A B C D 11/29/2018
Clicker question (frequency BC) A guest 𝑥 is a celebrity if every other guest knows 𝑥, but 𝑥 does not know any other guest. If a party has a celebrity, can it have a Eulerian cycle (the one that visits every edge exactly once)? Can it have a Hamiltonian cycle (the one that visits each node exactly once)? It can have both. Eulerian, but not Hamiltonian. Hamiltonian, but not Eulerian. It can have neither. A B C D 11/29/2018
Clicker question (frequency BC) A guest 𝑥 is a celebrity if every other guest knows 𝑥, but 𝑥 does not know any other guest. How many celebrities can a party have? 0 or 1. 0 or 1 or 2. 0 or 1 or 2 or 3. Any integer from 0 to 𝑛. None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Examples: The probability that 𝑥 knows 𝑦 and 𝑦 also knows 𝑥 is 𝑝 2 . The probability that 𝑤 knows 𝑥 and 𝑦 but doesn’t know 𝑧 is 𝑝 2 1−𝑝 . 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. What is the probability space? Uniform over all directed graphs on 𝑛 nodes. Uniform over all undirected graphs on 𝑛 nodes. A pair knows each other with probability 𝑝 and does not know each other with probability 1−𝑝. 1/ 𝑛 2 The set of all directed graphs, where each graph with 𝑘 edges for 𝑘=0,1,…,𝑛(𝑛−1) has probability 𝑝 𝑘 1−𝑝 𝑛 𝑛−1 −𝑘 . 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. What is the probability that all guests know each other? 𝑝 𝑛 𝑝 𝑛(𝑛−1) 𝑝 𝑛 2 1/ 𝑛 2 𝑝 𝑛(𝑛−1)/2 . 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let X be the number of pairs of guests that know each other. What is the value of X for the depicted outcome? 1 2 𝑝 2 None of the above. A B C D 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let X be the number of pairs of guests that know each other. What is the expectation of X? 𝑝𝑛. 𝑝 2 𝑛. 𝑝 2 𝑛(𝑛−1)/2. 𝑝 2 𝑛 𝑛−1 . None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let X be the number of pairs of guests that know each other. What is the variance of X? 𝑝 2 𝑛 2 −𝑝 4 𝑛 2 2 𝑝 2 𝑛. 𝑝 2 𝑛 2 𝑝 2 (1− 𝑝 2 ) 𝑛 2 None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let’s pick a particular guest 𝑣. What is the probability that 𝑣 is a celebrity? 𝑝 𝑛 (1−𝑝) 𝑛 𝑝 𝑛−1 𝑝 𝑛 𝑝 𝑛−1 (1−𝑝) 𝑛−1 None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let 𝑞 be the probability that 𝑣 is a celebrity (from the previous slide). What is the expected number of celebrities? 𝑝𝑛. 𝑞𝑛. 𝑝 𝑛 2 . 𝑞 𝑛 2 . None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let 𝑞 be the probability that 𝑣 is a celebrity (from the previous slide). Let’s pick another guest 𝑢. What is the probability that 𝑢 knows 𝑣, given that 𝑢 is not a celebrity? 1−𝑝. 𝑝/𝑞. 𝑝/(1−𝑞). 𝑞/(1−𝑝). None of the above. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let 𝑞 be the probability that 𝑣 is a celebrity (from the previous slide). What is the probability that one of 𝑢 and 𝑣 is a celebrity? 𝑞. 2𝑞. 𝑞− 𝑞 2 . 2𝑞− 𝑞 2 . None of the above. Hint: They can’t be celebrities together. 11/29/2018
Clicker question (frequency BC) Suppose G is generated randomly as follows. 𝑥 knows 𝑦 with probability 𝑝 for every two guests 𝑥 and 𝑦. All such events are independent. Let 𝑞 be the probability that 𝑣 is a celebrity (from the previous slide). What is the probability that there are no celebrities? 1−𝑛𝑞. 1−𝑞 𝑛 . 1− 𝑞 𝑛 . 𝑞 𝑛 . None of the above. Hint: They can’t be celebrities together. 11/29/2018
Wrap Up Some of the topics we covered: logic, proofs, modular arithmetic, polynomials, graphs, counting, probability, countability, computability. Applications we covered: RSA, error-correcting codes, secret sharing, hashing, load balancing, limits of computation. Skills we worked on: rigorous thinking about computer science problems; problem solving. 11/29/2018
What is next? CMPSC 465: Data Structures and Algorithms CMPSC 464: Theory of Computation More advanced classes: cryptography, randomized algorithms, sublinear algorithms, privacy, machine learning, quantum computing, programming languages,… Keep in touch! 11/29/2018