# Example Correctness Proofs

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Example Correctness Proofs Kevin C. Zatloukal March 8, 2014 In these notes, we give three examples of proofs of correctness. These are intended to demonstrate the sort of proofs we would like to see in your problem set solutions. Each of the examples below considers a variation of the peak finding problem discussed in class. Recall that we defined a peak in an array (or matrix) to be an element that is at least as large as each of its neighbors. In an array A of length n, element A[i] is a peak if it is at least as large as A[i 1] (if i 0) and A[i + 1] (if i < n 1). In an m n matrix, element A[i, j] is a peak if it is at least as large as A[i 1, j] (if i 0), A[i + 1, j] (if i < m 1), A[i, j 1] (if j 0), and A[i, j + 1] (if j < n 1). All the elements of an array have two neighbors, except the endpoints. All elements of a matrix have four neighbors, except those on the boundary (which have three or two). For each example, we describe an algorithm and prove its correctness. Note that the descriptions of the algorithms are more terse than what you will want to provide in your own solutions. (Only the correctness proofs are intended to be complete examples.) Recall that a correctness proof require a proof of both termination and safety. The former means that the algorithm eventually terminates, while the latter means that, when it terminates, it gives a correct answer. Typically, at most one of these proofs is difficult. For a search-based algorithm (like the greedy algorithm for peak-finding), safety is easy because the algorithm actually checks that the element is a peak immediately before returning it. However, proving that the search terminates takes some work. On the other hand, for a divide-and-conquer algorithm (like the one described in class that starts by checking the middle element), termination is easy because the algorithm does a fixed amount of work before recursing on a strictly smaller problem (so termination follows by an easy induction argument). However, safety usually requires more work, as we will see below. Finally, it is worth noting that we do not need to prove termination at all if we have a bound on the running time of the algorithm (its asymptotic complexity). If we know that the algorithm terminates within f(n) time (our bound on the running time), then it certainly terminates. A bound on the running time is a stronger result than a termination proof. So if you re going to prove a bound on the running time, you don t need to separately prove termination. 1-Dimensional Array Algorithm In class, we saw an algorithm that operates as follows. We are asked to find a peak in the array A of length n. Let m = 1 2n. We first check whether A[m] is a peak by comparing it to A[m 1] and A[m + 1]. If A[m] is a peak, then return m. Otherwise, we either have A[m 1] > A[m] or A[m + 1] > A[m]. In the former case, we recurse on the subarray from 0 to m 1, and in the latter case, we recurse on the subarray from m + 1 to n 1 and return whatever element is returned by that call. 1

2 Correctness We need to show both termination and safety. First, we show safety. Theorem 1. The algorithm described above returns a peak in the array A. Proof. We prove this by induction on the number of recursive calls made, k. Base case (k = 0). The algorithm only makes 0 recursive calls in the case where A[m] is found to be a peak. The algorithm directly checks that A[m] > A[m 1] and A[m] > A[m + 1], so this is indeed a peak. Inductive case (k > 0). In this case, the algorithm makes a recursive call on a subarray. Suppose that this is the subarray from 0 to m 1. By assumption, the recursive call itself makes k 1 recursive calls, which is fewer than k calls, so by the inductive hypothesis, this call returns an element A[i] that is a peak on the subarray from 0 to m 1. If i < m 1, then being a peak in this subarray means A[i] > A[i 1] and A[i] > A[i + 1]. That means A[i] is a peak in the entire array as well. Otherwise, the recursive call returns A[m 1]. Being a peak in the subarray means only that A[m 1] > A[m 2]. Since we made the recursive call on 0 to m 1, however, we must have checked A[m 1] > A[m] before the recursive call, so we can see that A[m 1] is a peak in the entire array. The other case to consider is when the algorithm makes a recursive call on the subarray from m + 1 to n. In this case, the algorithm returns a peak by the same sort of argument as above. We can also prove termination by induction, but this time on the length of the array: if the algorithm does not terminate immediately, then it recurses on a strictly smaller array. We leave it as an exercise to write this up formally. 1-Dimensional Circular Array In this version of the problem, we consider the array to be circular. That is, if n is the length of the array, then A[n ] is considered to be adjacent not only to A[n 2] but also to A[0]. Likewise, A[0] is adjacent not only to A[1] but also to A[n 1]. We wish to find a peak, defined in this sense, in the array. Algorithm Idea As we saw above, the difficulty with solving this problem recursively is that an element at the end of a subarray can look like a peak but not be a peak of the entire array because the element just past the end of the subarray is actually larger. On the other hand, if we knew that both endpoints of the subarray were larger than the elements just past those ends, then any peak of the subarray would be a peak of the entire array. Unfortunately, we can t always guarantee that this condition holds. However, we can guarantee a slightly weaker condition: the larger of the two endpoints of the subarray is at least as large as both the elements just past the ends. (Larger than the element past that endpoint and also larger than the element past the other endpoint.) Call this Condition E. We will see that condition E is enough to ensure correctness. Algorithm We are given an array A and length n. If the array contains only a single element, then return that element as the peak. Otherwise, let m = 1 2 n. We start by computing v = max{a[0], A[n 1]} and w = max{a[m], A[m + 1]}. If v w, then recurse to subarray from 0 to m if A[0] = v and the subarray from m + 1 to n 1 if A[n 1] = v. Otherwise, we have w > v. In 2

3 that case, we recurse to the subarray from 0 to m if A[m] = w and the subarray from m + 1 to n 1 if A[m + 1] = w. Correctness As above, we first prove safety. Theorem 2. The above algorithm, when invoked on an array satisfying condition E, returns a peak in the entire array (not just the subarray). Proof. We again prove this by induction on the number of recursive calls made. If the algorithm makes no recursive calls, then that means we have an array with one element. In this case, there is only one endpoint (the one element). Condition E tells us that this element is larger than the elements just past the two ends, which are the two elements adjacent to it in the larger array. Hence, this element is a peak. As in the last proof, the recursive call itself makes fewer recursive calls, so we can apply the induction hypothesis provided that condition E is satisfied on that subarray. Assuming this is the case, the induction hypothesis tells us that the returned element is a peak in the entire array, not just the subarray. So it remains only to show that condition E holds on the subarray passed to the recursive call. We can simply enumerate the possible cases and check each case: v w and A[0] = v. In this case, the subarray is from 0 to m. A[0] is the larger of the two endpoints in this subarray, so we need to argue that it is larger than the elements just path both ends of the subarray. Since the our array satisfies condition E, we know that A[0] is larger than the element just past that end. The other end of the subarray is A[m]. The element just past that is A[m] and we know A[0] = v > w A[m]. Since A[0] is larger than the elements just past both endpoints, condition E holds. v w and A[n 1] = v. Condition E is satisfied by the subarray from m + 1 to n 1 by the same sort of argument as the previous case. v < w and A[m] A[m + 1]. Since A[m] = w > v A[0], we see that A[m] is the larger of the two endpoints of the subarray from 0 to m. The element just past the end on its own side is A[m + 1], which is less than A[m] by assumption. Since condition E is satisfied on our array, we know that the element just past A[0] is smaller than the larger of A[0] and A[n 1], which is v. And since A[m] = w > v, we see that A[m] is larger than this element as well. Thus, A[m] is larger than the elements past both endpoints, so condition E is satisfied. v < w and A[m + 1] > A[m]. Condition E is satisfied by the subarray from m + 1 to n 1 by the same sort of argument as the previous case. We use this theorem to prove safety. In order to do that, though, we must know that the array satisfies condition E. Our proof showed that, if the array initially satisfies E, then so will the subarray in the recursive call. But what about the array we start with? Think of the circular array, from 0 to n, as being a subarray of an infinitely long array that just repeats the elements of A in order. Suppose that A[0] is the larger endpoint, so A[0] A[n 1]. In the circular array, the elements just past these endpoints are A[ 1] = A[n 1] and A[n] = A[0]. Since A[0] A[0] and A[0] A[n 1], condition E is satisfied. By a similar argument, condition E is satisfied when A[n 1] > A[0]. 3

4 Since condition E is satisfied by the array passed to the first call, the above theorem tells us that the algorithm returns a peak. It remains to show termination. We can again prove this by induction on the length of the array. In order to use the inductive hypothesis, though, we need to know that we always invoke the algorithm recursively on an array that is strictly smaller than the one we are given. Convince yourself that this is always the case. (This is not just about the proof. If the algorithm called itself on the same array, it would have an infinite loop!) 2-Dimensional Array In this case, we have a regular array, but one that is 2-dimensional. We need to find a peak in the array, which means an element that is larger than its neighbors above, below, to the left, and to the right. Algorithm Idea We will use the same approach as in the previous case. However, in the 2-D case, we do not simply have two endpoints. (Instead, we have a large square of endpoints along the boundary.) Rather than computing the largest value each time, we will pass an additional argument that gives the value of some element along the boundary that is larger than all the elements just past the boundaries. Algorithm This algorithm takes as arguments an array A of size m n along with an element (i, j) whose value is an upper bound on all the values of the elements just past the boundary in all four directions. On the first call to the algorithm, there is no such element, but since there are no elements past the boundary initially, we can use any value, say, (i, j) := (1, 1). Once we have a value for v, the algorithm operates as follows. If the array contains only a single row or column, then return the maximum element in that row or column. Otherwise, let p = 1 2 m and q = 1 2n. We compute the maximum value along row p and column q. Call this w. If A[i, j] > w, then recurse on the quadrant that includes A[i, j] and do not include row p and column q (so these are the elements past the boundary), passing the same (i, j). Otherwise, w > A[i, j]. Let (i, j ) be the element with A[i, j ] = w. Next, look at the other two neighbors of (i, j ) (the ones not on row p or column q). If one of these is larger, then recurse on that quadrant and (do not include row p and column q) passing this element for (i, j). Otherwise, return A[i, j ] as the peak. Correctness Here is a shortened proof of safety. (You will want to include more detail than this in your problem set solutions.) Theorem 3. The algorithm above returns an element that is a peak in the entire array. Proof. We use induction as before. If the array contains only a row or column element, then we return the largest value in this row or column. But since there is just one column, this must include the value A[i, j] that is larger than all the elements past the boundary. The largest value is at least this larger, so it is larger than all of its neighbors, which are either in the single row or column of the array or are elements just past the boundary of the array. Otherwise, the algorithm finds the element in the middle row or column with largest value A[i, j ]. If A[i, j] > A[i, j ], then it recurses on a quadrant whose boundaries are either boundaries of our array or the row p or column q. We know that A[i, j] 4

5 is greater than all of this, so by induction, this returns a peak of the entire array. If A[i, j ] > A[i, j] and a neighbor of A[i, j ] is larger, then we recurse on a quadrant whose boundaries are all smaller than this neighbor since that neighbor is larger than everything in row p, column q, and the boundaries of our array (which are bounded by A[i, j] < A[i, j ], which is smaller than the neighbor). Again, condition F is satisfied, so the result is a peak by induction. In the final case, we find that A[i, j ] is larger than all its neighbors in the array. Any neighbors past the boundary of the array are smaller than A[i, j] < A[i, j ], so we see that this is also a peak in the entire array. Termination is shown in the same way as above. Again, note that we need to be sure that the subarray is always strictly smaller than the one passed in. 5

### Basic Proof Techniques

Basic Proof Techniques David Ferry dsf43@truman.edu September 13, 010 1 Four Fundamental Proof Techniques When one wishes to prove the statement P Q there are four fundamental approaches. This document

### 3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

### Divide And Conquer Algorithms

CSE341T/CSE549T 09/10/2014 Lecture 5 Divide And Conquer Algorithms Recall in last lecture, we looked at one way of parallelizing matrix multiplication. At the end of the lecture, we saw the reduce SUM

### Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing

### Near Optimal Solutions

Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

### Quicksort is a divide-and-conquer sorting algorithm in which division is dynamically carried out (as opposed to static division in Mergesort).

Chapter 7: Quicksort Quicksort is a divide-and-conquer sorting algorithm in which division is dynamically carried out (as opposed to static division in Mergesort). The three steps of Quicksort are as follows:

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### CMPS 102 Solutions to Homework 1

CMPS 0 Solutions to Homework Lindsay Brown, lbrown@soe.ucsc.edu September 9, 005 Problem..- p. 3 For inputs of size n insertion sort runs in 8n steps, while merge sort runs in 64n lg n steps. For which

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### Diagonalisation. Chapter 3. Introduction. Eigenvalues and eigenvectors. Reading. Definitions

Chapter 3 Diagonalisation Eigenvalues and eigenvectors, diagonalisation of a matrix, orthogonal diagonalisation fo symmetric matrices Reading As in the previous chapter, there is no specific essential

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### Math 55: Discrete Mathematics

Math 55: Discrete Mathematics UC Berkeley, Fall 2011 Homework # 5, due Wednesday, February 22 5.1.4 Let P (n) be the statement that 1 3 + 2 3 + + n 3 = (n(n + 1)/2) 2 for the positive integer n. a) What

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### The last three chapters introduced three major proof techniques: direct,

CHAPTER 7 Proving Non-Conditional Statements The last three chapters introduced three major proof techniques: direct, contrapositive and contradiction. These three techniques are used to prove statements

### We seek a factorization of a square matrix A into the product of two matrices which yields an

LU Decompositions We seek a factorization of a square matrix A into the product of two matrices which yields an efficient method for solving the system where A is the coefficient matrix, x is our variable

### Linear Dependence Tests

Linear Dependence Tests The book omits a few key tests for checking the linear dependence of vectors. These short notes discuss these tests, as well as the reasoning behind them. Our first test checks

### SECTION 10-2 Mathematical Induction

73 0 Sequences and Series 6. Approximate e 0. using the first five terms of the series. Compare this approximation with your calculator evaluation of e 0.. 6. Approximate e 0.5 using the first five terms

### Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 3 Cartesian Products and Relations The material in this chapter is the first real encounter with abstraction. Relations are very general thing they are a special type of subset. After introducing

### 4 Domain Relational Calculus

4 Domain Relational Calculus We now present two relational calculi that we will compare to RA. First, what is the difference between an algebra and a calculus? The usual story is that the algebra RA is

### 88 CHAPTER 2. VECTOR FUNCTIONS. . First, we need to compute T (s). a By definition, r (s) T (s) = 1 a sin s a. sin s a, cos s a

88 CHAPTER. VECTOR FUNCTIONS.4 Curvature.4.1 Definitions and Examples The notion of curvature measures how sharply a curve bends. We would expect the curvature to be 0 for a straight line, to be very small

### Section 6-2 Mathematical Induction

6- Mathematical Induction 457 In calculus, it can be shown that e x k0 x k k! x x x3!! 3!... xn n! where the larger n is, the better the approximation. Problems 6 and 6 refer to this series. Note that

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us

### Mathematical Induction

Mathematical Induction In logic, we often want to prove that every member of an infinite set has some feature. E.g., we would like to show: N 1 : is a number 1 : has the feature Φ ( x)(n 1 x! 1 x) How

### The Pointless Machine and Escape of the Clones

MATH 64091 Jenya Soprunova, KSU The Pointless Machine and Escape of the Clones The Pointless Machine that operates on ordered pairs of positive integers (a, b) has three modes: In Mode 1 the machine adds

### Mathematical Induction

Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

### 4.6 Null Space, Column Space, Row Space

NULL SPACE, COLUMN SPACE, ROW SPACE Null Space, Column Space, Row Space In applications of linear algebra, subspaces of R n typically arise in one of two situations: ) as the set of solutions of a linear

### CS 102: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4)

CS 10: SOLUTIONS TO DIVIDE AND CONQUER ALGORITHMS (ASSGN 4) Problem 1. a. Consider the modified binary search algorithm so that it splits the input not into two sets of almost-equal sizes, but into three

### 8.1 Makespan Scheduling

600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: Min-Makespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance

### Lecture 22: November 10

CS271 Randomness & Computation Fall 2011 Lecture 22: November 10 Lecturer: Alistair Sinclair Based on scribe notes by Rafael Frongillo Disclaimer: These notes have not been subjected to the usual scrutiny

### Math 313 Lecture #10 2.2: The Inverse of a Matrix

Math 1 Lecture #10 2.2: The Inverse of a Matrix Matrix algebra provides tools for creating many useful formulas just like real number algebra does. For example, a real number a is invertible if there is

### The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,

### Chapter 11 Number Theory

Chapter 11 Number Theory Number theory is one of the oldest branches of mathematics. For many years people who studied number theory delighted in its pure nature because there were few practical applications

### Divide-and-Conquer Algorithms Part Four

Divide-and-Conquer Algorithms Part Four Announcements Problem Set 2 due right now. Can submit by Monday at 2:15PM using one late period. Problem Set 3 out, due July 22. Play around with divide-and-conquer

### Sequential Data Structures

Sequential Data Structures In this lecture we introduce the basic data structures for storing sequences of objects. These data structures are based on arrays and linked lists, which you met in first year

### Computational Geometry. Lecture 1: Introduction and Convex Hulls

Lecture 1: Introduction and convex hulls 1 Geometry: points, lines,... Plane (two-dimensional), R 2 Space (three-dimensional), R 3 Space (higher-dimensional), R d A point in the plane, 3-dimensional space,

### Matrix Algebra. Some Basic Matrix Laws. Before reading the text or the following notes glance at the following list of basic matrix algebra laws.

Matrix Algebra A. Doerr Before reading the text or the following notes glance at the following list of basic matrix algebra laws. Some Basic Matrix Laws Assume the orders of the matrices are such that

### 1. LINEAR EQUATIONS. A linear equation in n unknowns x 1, x 2,, x n is an equation of the form

1. LINEAR EQUATIONS A linear equation in n unknowns x 1, x 2,, x n is an equation of the form a 1 x 1 + a 2 x 2 + + a n x n = b, where a 1, a 2,..., a n, b are given real numbers. For example, with x and

### Solution to Homework 2

Solution to Homework 2 Olena Bormashenko September 23, 2011 Section 1.4: 1(a)(b)(i)(k), 4, 5, 14; Section 1.5: 1(a)(b)(c)(d)(e)(n), 2(a)(c), 13, 16, 17, 18, 27 Section 1.4 1. Compute the following, if

### Solving Linear Systems, Continued and The Inverse of a Matrix

, Continued and The of a Matrix Calculus III Summer 2013, Session II Monday, July 15, 2013 Agenda 1. The rank of a matrix 2. The inverse of a square matrix Gaussian Gaussian solves a linear system by reducing

### CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

### Row Echelon Form and Reduced Row Echelon Form

These notes closely follow the presentation of the material given in David C Lay s textbook Linear Algebra and its Applications (3rd edition) These notes are intended primarily for in-class presentation

### 1 if 1 x 0 1 if 0 x 1

Chapter 3 Continuity In this chapter we begin by defining the fundamental notion of continuity for real valued functions of a single real variable. When trying to decide whether a given function is or

### Handout #1: Mathematical Reasoning

Math 101 Rumbos Spring 2010 1 Handout #1: Mathematical Reasoning 1 Propositional Logic A proposition is a mathematical statement that it is either true or false; that is, a statement whose certainty or

### Real Roots of Univariate Polynomials with Real Coefficients

Real Roots of Univariate Polynomials with Real Coefficients mostly written by Christina Hewitt March 22, 2012 1 Introduction Polynomial equations are used throughout mathematics. When solving polynomials

### 8 Divisibility and prime numbers

8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

### Data Structures. Chapter 8

Chapter 8 Data Structures Computer has to process lots and lots of data. To systematically process those data efficiently, those data are organized as a whole, appropriate for the application, called a

### The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints

### Chapter 6. Cuboids. and. vol(conv(p ))

Chapter 6 Cuboids We have already seen that we can efficiently find the bounding box Q(P ) and an arbitrarily good approximation to the smallest enclosing ball B(P ) of a set P R d. Unfortunately, both

### x if x 0, x if x < 0.

Chapter 3 Sequences In this chapter, we discuss sequences. We say what it means for a sequence to converge, and define the limit of a convergent sequence. We begin with some preliminary results about the

### Solutions to Math 51 First Exam January 29, 2015

Solutions to Math 5 First Exam January 29, 25. ( points) (a) Complete the following sentence: A set of vectors {v,..., v k } is defined to be linearly dependent if (2 points) there exist c,... c k R, not

### HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Math 7 Fall 205 HOMEWORK 5 SOLUTIONS Problem. 2008 B2 Let F 0 x = ln x. For n 0 and x > 0, let F n+ x = 0 F ntdt. Evaluate n!f n lim n ln n. By directly computing F n x for small n s, we obtain the following

### 6.207/14.15: Networks Lecture 15: Repeated Games and Cooperation

6.207/14.15: Networks Lecture 15: Repeated Games and Cooperation Daron Acemoglu and Asu Ozdaglar MIT November 2, 2009 1 Introduction Outline The problem of cooperation Finitely-repeated prisoner s dilemma

### 6.2 Permutations continued

6.2 Permutations continued Theorem A permutation on a finite set A is either a cycle or can be expressed as a product (composition of disjoint cycles. Proof is by (strong induction on the number, r, of

### MATH 289 PROBLEM SET 4: NUMBER THEORY

MATH 289 PROBLEM SET 4: NUMBER THEORY 1. The greatest common divisor If d and n are integers, then we say that d divides n if and only if there exists an integer q such that n = qd. Notice that if d divides

### The Inverse of a Square Matrix

These notes closely follow the presentation of the material given in David C Lay s textbook Linear Algebra and its Applications (3rd edition) These notes are intended primarily for in-class presentation

### Lecture 6. Inverse of Matrix

Lecture 6 Inverse of Matrix Recall that any linear system can be written as a matrix equation In one dimension case, ie, A is 1 1, then can be easily solved as A x b Ax b x b A 1 A b A 1 b provided that

### Linear Codes. In the V[n,q] setting, the terms word and vector are interchangeable.

Linear Codes Linear Codes In the V[n,q] setting, an important class of codes are the linear codes, these codes are the ones whose code words form a sub-vector space of V[n,q]. If the subspace of V[n,q]

### Au = = = 3u. Aw = = = 2w. so the action of A on u and w is very easy to picture: it simply amounts to a stretching by 3 and 2, respectively.

Chapter 7 Eigenvalues and Eigenvectors In this last chapter of our exploration of Linear Algebra we will revisit eigenvalues and eigenvectors of matrices, concepts that were already introduced in Geometry

### The Determinant: a Means to Calculate Volume

The Determinant: a Means to Calculate Volume Bo Peng August 20, 2007 Abstract This paper gives a definition of the determinant and lists many of its well-known properties Volumes of parallelepipeds are

### Homework Exam 1, Geometric Algorithms, 2016

Homework Exam 1, Geometric Algorithms, 2016 1. (3 points) Let P be a convex polyhedron in 3-dimensional space. The boundary of P is represented as a DCEL, storing the incidence relationships between the

### Unit 18 Determinants

Unit 18 Determinants Every square matrix has a number associated with it, called its determinant. In this section, we determine how to calculate this number, and also look at some of the properties of

### Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

### 3 Does the Simplex Algorithm Work?

Does the Simplex Algorithm Work? In this section we carefully examine the simplex algorithm introduced in the previous chapter. Our goal is to either prove that it works, or to determine those circumstances

### Lecture 6 Online and streaming algorithms for clustering

CSE 291: Unsupervised learning Spring 2008 Lecture 6 Online and streaming algorithms for clustering 6.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line

### Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs

CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like

### Lecture 4 Online and streaming algorithms for clustering

CSE 291: Geometric algorithms Spring 2013 Lecture 4 Online and streaming algorithms for clustering 4.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line

### Lecture Notes on Linear Search

Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is

### Section 3 Sequences and Limits, Continued.

Section 3 Sequences and Limits, Continued. Lemma 3.6 Let {a n } n N be a convergent sequence for which a n 0 for all n N and it α 0. Then there exists N N such that for all n N. α a n 3 α In particular

### Analysis of Algorithms, I

Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications

### 8 Primes and Modular Arithmetic

8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.

### The four [10,5,4] binary codes

1 Preliminaries The four [10,,] binary codes There are four distinct [10; ; ] binary codes. We shall prove this in a moderately elementary way, using the MacWilliams identities as the main tool. (For the

### MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

### Connectivity and cuts

Math 104, Graph Theory February 19, 2013 Measure of connectivity How connected are each of these graphs? > increasing connectivity > I G 1 is a tree, so it is a connected graph w/minimum # of edges. Every

### 4. MATRICES Matrices

4. MATRICES 170 4. Matrices 4.1. Definitions. Definition 4.1.1. A matrix is a rectangular array of numbers. A matrix with m rows and n columns is said to have dimension m n and may be represented as follows:

### GROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G.

Definition 1: GROUPS An operation on a set G is a function : G G G. Definition 2: A group is a set G which is equipped with an operation and a special element e G, called the identity, such that (i) the

### Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divide-and-conquer algorithms

### Full and Complete Binary Trees

Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### THE DIMENSION OF A VECTOR SPACE

THE DIMENSION OF A VECTOR SPACE KEITH CONRAD This handout is a supplementary discussion leading up to the definition of dimension and some of its basic properties. Let V be a vector space over a field

### Quiz 1 Solutions. (a) T F The height of any binary search tree with n nodes is O(log n). Explain:

Introduction to Algorithms March 9, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Quiz 1 Solutions Problem 1. Quiz 1 Solutions True

### Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

### 160 CHAPTER 4. VECTOR SPACES

160 CHAPTER 4. VECTOR SPACES 4. Rank and Nullity In this section, we look at relationships between the row space, column space, null space of a matrix and its transpose. We will derive fundamental results

### Midterm Practice Problems

6.042/8.062J Mathematics for Computer Science October 2, 200 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem. [0 points] In problem set you showed that the nand operator

### WRITING PROOFS. Christopher Heil Georgia Institute of Technology

WRITING PROOFS Christopher Heil Georgia Institute of Technology A theorem is just a statement of fact A proof of the theorem is a logical explanation of why the theorem is true Many theorems have this

### Introduction to Graph Theory

Introduction to Graph Theory Allen Dickson October 2006 1 The Königsberg Bridge Problem The city of Königsberg was located on the Pregel river in Prussia. The river divided the city into four separate

### Pythagorean Triples. Chapter 2. a 2 + b 2 = c 2

Chapter Pythagorean Triples The Pythagorean Theorem, that beloved formula of all high school geometry students, says that the sum of the squares of the sides of a right triangle equals the square of the

### CHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs

CHAPTER 3 Methods of Proofs 1. Logical Arguments and Formal Proofs 1.1. Basic Terminology. An axiom is a statement that is given to be true. A rule of inference is a logical rule that is used to deduce

### Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

### Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note 11

CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao,David Tse Note Conditional Probability A pharmaceutical company is marketing a new test for a certain medical condition. According

### Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm

### Session 6 Number Theory

Key Terms in This Session Session 6 Number Theory Previously Introduced counting numbers factor factor tree prime number New in This Session composite number greatest common factor least common multiple

### AN ANALYSIS OF A WAR-LIKE CARD GAME. Introduction

AN ANALYSIS OF A WAR-LIKE CARD GAME BORIS ALEXEEV AND JACOB TSIMERMAN Abstract. In his book Mathematical Mind-Benders, Peter Winkler poses the following open problem, originally due to the first author:

### Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

### Graph Theory Problems and Solutions

raph Theory Problems and Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 005 Problems. Prove that the sum of the degrees of the vertices of any finite graph is

### Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which

### Lecture 3: Linear Programming Relaxations and Rounding

Lecture 3: Linear Programming Relaxations and Rounding 1 Approximation Algorithms and Linear Relaxations For the time being, suppose we have a minimization problem. Many times, the problem at hand can