CS103 Handout 25 Spring 2017 May 5, 2017 Problem Set 5

Similar documents
Checkpoint Questions Due Monday, October 7 at 2:15 PM Remaining Questions Due Friday, October 11 at 2:15 PM

Best of luck on the exam!

Practice Midterm Exam 5

CS103 Handout 22 Fall 2017 October 16, 2017 Practice Midterm Exam 2

Game 0: One Pile, Last Chip Loses

GAMES AND STRATEGY BEGINNERS 12/03/2017

Senior Math Circles February 10, 2010 Game Theory II

MITOCW Lec 25 MIT 6.042J Mathematics for Computer Science, Fall 2010

CS 32 Puzzles, Games & Algorithms Fall 2013

UMBC 671 Midterm Exam 19 October 2009

Game Theory and Algorithms Lecture 19: Nim & Impartial Combinatorial Games

Binary trees. Application: AVL trees and the golden ratio. The golden ratio. φ 1=1/φ 1. φ =1+

MITOCW R19. Dynamic Programming: Crazy Eights, Shortest Path

Math 152: Applicable Mathematics and Computing

Lecture 18 - Counting

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

POKER (AN INTRODUCTION TO COUNTING)

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

Notes for Recitation 3

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER II EXAMINATION MH1301 DISCRETE MATHEMATICS. Time Allowed: 2 hours

Definition 1 (Game). For us, a game will be any series of alternating moves between two players where one player must win.

DVA325 Formal Languages, Automata and Models of Computation (FABER)

Facilitator Guide. Unit 2

MITOCW R22. Dynamic Programming: Dance Dance Revolution

MITOCW 6. AVL Trees, AVL Sort

Final exam. Question Points Score. Total: 150

MITOCW ocw lec11

18.204: CHIP FIRING GAMES

Plan. Related courses. A Take-Away Game. Mathematical Games , (21-801) - Mathematical Games Look for it in Spring 11

Stat 155: solutions to midterm exam

Chapter 5. Drawing a cube. 5.1 One and two-point perspective. Math 4520, Spring 2015

MITOCW watch?v=fp7usgx_cvm

MITOCW mit_jpal_ses06_en_300k_512kb-mp4

MITOCW R3. Document Distance, Insertion and Merge Sort

CS 491 CAP Intro to Combinatorial Games. Jingbo Shang University of Illinois at Urbana-Champaign Nov 4, 2016

Rotational Puzzles on Graphs

Tangent: Boromean Rings. The Beer Can Game. Plan. A Take-Away Game. Mathematical Games I. Introduction to Impartial Combinatorial Games

Conversion Masters in IT (MIT) AI as Representation and Search. (Representation and Search Strategies) Lecture 002. Sandro Spina

PowerPoint Pro: Grouping and Aligning Objects

Grade 6 Math Circles Combinatorial Games November 3/4, 2015

MITOCW 23. Computational Complexity

MITOCW 7. Counting Sort, Radix Sort, Lower Bounds for Sorting

MITOCW ocw f07-lec25_300k

Introduction to Counting and Probability

PARTICIPANT Guide. Unit 2

PUTNAM PROBLEMS FINITE MATHEMATICS, COMBINATORICS

Midterm 2 6:00-8:00pm, 16 April

Three of these grids share a property that the other three do not. Can you find such a property? + mod

Introduction to Spring 2009 Artificial Intelligence Final Exam

Stanford University CS261: Optimization Handout 9 Luca Trevisan February 1, 2011

Math236 Discrete Maths with Applications

Olympiad Combinatorics. Pranav A. Sriram

CS 787: Advanced Algorithms Homework 1

Background. Game Theory and Nim. The Game of Nim. Game is Finite 1/27/2011

Week 1. 1 What Is Combinatorics?

Lesson 01 Notes. Machine Learning. Difference between Classification and Regression

MITOCW watch?v=krzi60lkpek

Algorithmique appliquée Projet UNO

MATH 200 FINAL EXAM PEYAM RYAN TABRIZIAN

SHA532 Transcripts. Transcript: Forecasting Accuracy. Transcript: Meet The Booking Curve

12. 6 jokes are minimal.

and problem sheet 7

MITOCW watch?v=6fyk-3vt4fe

Southeastern European Regional Programming Contest Bucharest, Romania Vinnytsya, Ukraine October 21, Problem A Concerts

Grade 7/8 Math Circles Game Theory October 27/28, 2015

MITOCW 11. Integer Arithmetic, Karatsuba Multiplication

Math Circle: Logic Puzzles

Math 152: Applicable Mathematics and Computing

Sept. 26, 2012

CS1802 Week 6: Sets Operations, Product Sum Rule Pigeon Hole Principle (Ch )

MITOCW 15. Single-Source Shortest Paths Problem

Eleventh Annual Ohio Wesleyan University Programming Contest April 1, 2017 Rules: 1. There are six questions to be completed in four hours. 2.

Teacher / Parent Guide for the use of Tantrix tiles with children of all ages

Section Marks Agents / 8. Search / 10. Games / 13. Logic / 15. Total / 46

1. Functions and set sizes 2. Infinite set sizes. ! Let X,Y be finite sets, f:x!y a function. ! Theorem: If f is injective then X Y.

Norman Do. Department of Mathematics and Statistics, The University of Melbourne, VIC

1 Modified Othello. Assignment 2. Total marks: 100. Out: February 10 Due: March 5 at 14:30

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

4th Bay Area Mathematical Olympiad

Obliged Sums of Games

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

MATHEMATICS 152, FALL 2004 METHODS OF DISCRETE MATHEMATICS Outline #10 (Sets and Probability)

Grade 7 & 8 Math Circles. Mathematical Games

MAT3707. Tutorial letter 202/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/202/1/2017

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

MITOCW R11. Principles of Algorithm Design

Bulgarian Solitaire in Three Dimensions

Math Fundamentals for Statistics (Math 52) Unit 2:Number Line and Ordering. By Scott Fallstrom and Brent Pickett The How and Whys Guys.

The next several lectures will be concerned with probability theory. We will aim to make sense of statements such as the following:

SUMMER MATHS QUIZ SOLUTIONS PART 2

EXPLAINING THE SHAPE OF RSK

QUICKSTART COURSE - MODULE 1 PART 2

MITOCW R7. Comparison Sort, Counting and Radix Sort

Pattern Avoidance in Unimodal and V-unimodal Permutations

A variation on the game SET

Math 147 Lecture Notes: Lecture 21

Chapter 4 Number Theory

By Scott Fallstrom and Brent Pickett The How and Whys Guys

Transcription:

CS103 Handout 25 Spring 2017 May 5, 2017 Problem Set 5 This problem set the last one purely on discrete mathematics is designed as a cumulative review of the topics we ve covered so far and a proving ground to try out your newfound skills with mathematical induction. The problems here span all sorts of topics parallel processing, the nature of infinity, tiling problems, and tournament structures and we hope that it serves as a fitting coda to our whirlwind tour of discrete math! We recommend that you read the Handout #24, Guide to Induction, before starting this problem set. It contains a lot of useful advice about how to approach problems inductively, how to structure inductive proofs, and how to not fall into common inductive traps. As a note on this problem set normally, you're welcome to use any proof technique you'd like to prove results in this course. On this problem set, we've specifically requested on some problems that you prove a result inductively. For those problems, you should prove those results using induction or complete induction, even if there is another way to prove the result. (If you'd like to use induction in conjunction with other techniques like proof by contradiction or proof by contrapositive, that's perfectly fine.) As always, please feel free to drop by office hours, visit Piazza, or send us emails if you have any questions. We'd be happy to help out. Good luck, and have fun! Due Friday, May 12 at the start of class. There is no checkpoint problem.

Problem One: Chains and Antichains 2 / 7 Let A be an arbitrary set and < A be some strict order over A. A chain in < A is a series x₁,, x ₖ of elements drawn from A such that x₁ < A x₂ < A < A xₖ. Intuitively, a chain is a series of values in ascending order according to the strict order < A. The length of a chain is the number of elements in that chain. i. Consider the relation over the set ({a, b, c}), where A B means that A B but A B. What is the length of the longest chain in this strict order? Give an example of a chain with that length. No justification is necessary. (Hint: Draw the Hasse diagram and see if you can find a visual intuition for the definition of a chain.) Now, let's cover a new definition. An antichain is a set X A such that no two elements in X can be compared by the < A relation. In other words, a set X A is an antichain if a X. b X. (a A b b A a) The size of an antichain X is the number of elements in X. ii. Consider the relation over the set ({a, b, c}). What is the size of the largest antichain in this strict order? Give an example of an antichain with that size. No justification is necessary. (Hint: Draw the Hasse diagram and see if you can find a visual intuition for the definition of an antichain.) Given an arbitrary strictly ordered set, you can't say anything a priori about the size of the largest chain or antichain in that strict order. However, you can say that at least one of them must be relatively large relative to the strictly ordered set. Let < A be an arbitrary strict order over an arbitrary set A containing exactly n 2 elements for some natural number n 1. We're going to ask you to prove the following result: either A contains a chain of length n or an antichain of size n (or both). Following the advice from Handout 14, we ll prove this by instead proving that if A does not contain a chain of length n or greater, then A must contain an antichain of size n or greater. iii. For each element a A, we'll say that the height of a is the length of the longest chain whose final element is a. Prove that if A does not contain a chain of length n or greater, then there must be at least n elements of A at the same height. (Something to think about: what s the smallest possible height of an element of A?) iv. Your result from part (iii) establishes that if A does not contain a chain of length n or greater, there must be a collection of n elements of A at the same height as one another. Prove that if A does not contain a chain of length n or greater, then it contains an antichain of size n or greater. Intuitively speaking, if < A is a strict order over A that represents some prerequisite structure on a group of tasks, a chain represents a series of tasks that have to be performed one after the other, and an antichain represents a group of tasks that can all be performed in parallel (do you see why?) In the context of parallel computing, the result you've proved states that if a group of tasks doesn't contain long dependency chains, that group must have a good degree of parallelism.

Problem Two: Recurrence Relations A recurrence relation is a recursive definition of the terms in a sequence. Typically, a recurrence relation specifies the value of the first few terms in a sequence, then defines the remaining terms from the previous terms. For example, the Fibonacci sequence can be defined by the following recurrence relation: F 0 = 0 F 1 = 1 F n+2 = F n + F n The first terms of this sequence are F 0 = 0, F 1 = 1, F 2 = 1, F 3 = 2, F 4 = 3, F 5 = 5, F 6 = 8, etc. Some recurrence relations define well-known sequences. For example, consider the following recurrence relation: a 0 = 1 a n = 2a n The first few terms of this sequence are 1, 2, 4, 8, 16, 32,, which happen to be powers of two. It turns out that this isn't a coincidence this recurrence relation perfectly describes the powers of two. i. Prove by induction that for any n N, we have a n = 2 n. 3 / 7 Minor changes to the recursive step in a recurrence relation can lead to enormous changes in what numbers are generated. Consider the following two recurrence relations, which are similar to the a n sequence defined above but with slight changes to the recursive step: b 0 = 1 b n = 2b n 1 c 0 = 1 c n = 2c n + 1 ii. Find non-recursive definitions for b n and c n, then prove by induction that your definitions are correct. Finding non-recursive definitions for recurrences (often called solving the recurrence) is useful in the design and analysis of algorithms. Commonly, when trying to analyze the runtime of an algorithm, you will arrive at a recurrence relation describing the runtime on an input of size n in terms of the runtime on inputs of smaller sizes. Solving the recurrence then lets you precisely determine the runtime. To learn more, take CS161, Math 108, or consider reading through Concrete Mathematics by Graham, Knuth, and Patashnik.

Problem Three: Cartesian Products and Cardinalities The cardinality of the Cartesian product of two sets depends purely on the cardinalities of those sets, not on what the elements of those sets actually are. This question will ask you to prove this. 4 / 7 Let A, B, C, and D be sets where A = C and B = D. Our goal is to prove A B = C D. Since we know A = C, there has to be some bijection g : A C. Since we know B = D, there has to be some bijection h : B D. Now, consider the function f : A B C D defined as follows: f(a, b) = (g(a), h(b)) That is, the output of f when applied to the pair (a, b) is an ordered pair whose first element is g(a) and whose second element is h(b). i. Using the function f defined above, prove that if A, B, C, and D are sets where A = C and B = D, then we have A B = C D. Specifically, prove that f is a bijection between A B and C D. We can define the Cartesian power of a set as follows. For any set A and any positive natural number n, we define A n inductively: A 1 = A A n = A A n (for n 1) ii. Using your result from (i) and the above definition, prove by induction that N k = N for all nonzero k N. This result means that for any nonzero finite k, there are the same number of k-tuples of natural numbers as natural numbers. (Hint: You might want to use a result from lecture.) (Here's some justification for the problem you just did. You don't need to read this if you don't want to, but we think you might find it interesting. ) We've defined cardinality on a relative basis, defining A = B, A B, A B, and A < B in terms of functions between those sets. We specifically didn't talk about cardinalities as actual quantities, since it's tricky to do so. That said, it is possible to treat set cardinalities as actual objects. Intuitively speaking, the cardinality of a set is a measure of how large that set is. For finite sets, the cardinality of that set will be a natural number, and for infinite sets the cardinality of that set will be an infinite cardinality, a generalization of the natural numbers that measure the sizes of infinite sets. For example, ℵ₀, which we introduced in our first lecture as the cardinality of N, is an infinite cardinality. Given cardinalities κ₁ and κ₂, we define the product of those two cardinalities, κ₁ κ₂, to be A B, where A and B are any sets where A = κ₁ and B = κ₂. For example, 4 3 is by definition the cardinality A B for any set A of cardinality 4 and any set B of cardinality 3. Similarly, by definition the value of ℵ₀ ℵ₀ is the cardinality A B for any sets A and B of cardinality ℵ₀. To make sure that this definition is legal, we have to make sure that the cardinality of the Cartesian product depends purely on the cardinalities of the two sets, not their contents. For example, this definition wouldn't give us a way to compute 4 3 if the cardinality of the Cartesian product of a set of four apples and three oranges was different than the cardinality of the Cartesian product of a set of four unicorns and three ponies. We need to show that for any sets A, B, C, and D, that if A = C and B = D, then A B = C D. That way, when determining the value of κ₁ κ₂, it doesn't matter which sets of cardinality κ₁ and κ₂ we pick; any choice works. Your proof from (i) filled in this step. Your result from part (ii) shows that ℵ₀ n = ℵ₀ for any positive natural number n. Isn't infinity weird?

5 / 7 Problem Four: Tiling with Triominoes Recall from Problem Set One that a right triomino is an L-shaped tile that looks like this: Suppose that you are also given a square grid of size 2 n 2 n and want to tile it with right triominoes by covering the grid with triominoes such that all triominoes are completely on the grid and no triominoes overlap. Here's an attempt to cover an 8 8 grid with triominoes, which fails because not all squares in the grid are covered: Amazingly, it turns out that it is always possible to tile any 2 n 2 n grid that's missing exactly one square with right triominoes. It doesn't matter what n is or which square is removed; there is always a solution to the problem. For example, here are all the ways to tile a 4 4 grid that has a square missing: Prove by induction that any 2 n 2 n grid with any one square removed can be tiled by right triominoes.

Problem Five: The Circle Game Here's a game you can play. Suppose that you have a circle with 2n arbitrarily-chosen points on its circumference. n of these points are labeled, and the remaining n are labeled. One sample circle with eight points, of which four are labeled and four are labeled, is shown to the right. Here's the rules of the game. First, choose one of the 2n points as your starting point. Then, start moving clockwise around the circle. As you go, you'll pass through some number of points and some number of points. You lose the game if at any point on your journey you pass through more points than points. You win the game if you get all the way back around to your starting point without losing. For example, if you started at point A, the game would go like this: Start at A:. Pass through B: +2. Pass through C:. Pass through D: 0. Pass through E:. (You lose.) If you started at point G, the game would go like this: Start at G: (You lose.) However, if you started at point F, the game would go like this: Start at F:. Pass through G: 0. Pass through H:. Pass through A: +2. Pass through B: +3. Pass through C: +2. Pass through D:. Pass through E: +0. Return to F. (You win!) Interestingly, it turns out that no matter which n points are labeled and which n points are labeled, there is always at least one point you can start at to win the game. Prove, by induction, that the above fact is true for any n 1. H G F A E B D C 6 / 7

Problem Six: Nim Nim is a family of games played by two players. The game begins with several piles of stones, each of which has zero or more stones in it, that are shared between the two players. Players alternate taking turns removing any nonzero number of stones from any single pile of their choice. If at the start of a player's turn all the piles are empty, then that player loses the game. Prove, by induction, that if the game is played with just two piles of stones, each of which begins with exactly the same number of stones, then the second player can always win the game if she plays correctly. Before trying to write up your answer to this question, we recommend playing this game with a partner until you can find a winning strategy. 7 / 7 Problem Seven: Tournament Graphs A E B D C In Problem Set Two, you explored tournaments, contests among n 0 players where each player plays exactly one game against each other player and no game ends in a tie. From a graph-theoretic perspective, we can treat tournaments as graphs. Each player is a node, and there's exactly one edge between each pair of nodes. The edge is directed such that the edge goes from the winner of the game to the loser of the game. For example, in the graph to the left, player D beat players A and E, but lost to players B and C. These sorts of graphs are called tournament graphs. Let's introduce a new definition. If T is a tournament graph, a subtournament of T is a tournament graph T' formed by picking a subset of the players in T and considering just the games those players played against each other. (Note that, just like any set is a subset of itself, any tournament is a subtournament of itself). Now, let's introduce one final definition. A tournament graph T is called transitive if it contains no cycles. Prove by induction that for any natural number n, if T is a tournament graph with exactly 2 n nodes, then T contains a transitive subtournament T* with at least n + 1 nodes. As a hint, you might want to use the bowtie decomposition. Given any nonempty tournament T, if you choose a player p from T, you can split the remaining players in T into two subtournaments T₀ and T₁ consisting of just the players who beat p and just the players who lost to p, respectively. Extra Credit Problem: My Old CS103 Midterm (1 Point Extra Credit) I learned proofwriting and discrete math when I took CS103 here way back in Winter 2007. I still remember the midterm exam for that class it probably the single hardest exam I've ever taken. Here's a question that was actually asked on the midterm that quarter. And don't worry... I would never ask something like this on a CS103 midterm! Imagine you have a collection of n planes in three-dimensional space. The planes are chosen so that any two planes will intersect each other at a line, any three planes will intersect at a single point, but no combination of four planes will intersect at the same point. These planes will split three-dimensional space into a collection of different regions. How many of those regions will there be, as a function of n? Prove it by induction.