The Pigeonhole Principle & Functions

Similar documents
The Pigeonhole Principle & Functions

Outline for Today. Modeling transformations between sets. Injections, surjections, and bijections.

Order Relations and Functions

Recap from Last Time

Outline for Today. Revisiting our first lecture with our new techniques! How do we know when two sets have the same size?

CS103 Handout 08 Spring 2012 April 20, 2012 Problem Set 3

Functions, High-School Edition

Mathematical Logic Part Three

Mathematical Logic Part Three

CS103 Handout 12 Winter February 4, 2013 Practice Midterm Exam

Mathematical Logic Part Three

Announcements Monday, September 18

CS103 Handout 09 Fall 2012 October 19, 2012 Problem Set 4

Outline for Today. Binary Relations. Equivalence Relations. Partial Orders. Quick Midterm Review

NP-Completeness Part II

Checkpoint Questions Due Monday, October 1 at 2:15 PM Remaining Questions Due Friday, October 5 at 2:15 PM

Mathematical Induction Part Two

Welcome to CS103! Three Handouts Today: Course Overview Introduction to Set Theory The Limits of Computation

Discrete Structures Proofwriting Checklist

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

CS103 Handout 21 Winter 2016 February 3, 2016 Practice Midterm Exam

Relations and Functions

Preparing for the CS 173 (A) Fall 2018 Midterm 1

The Inductive Proof Template

Finite Automata Part One

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Mathematical Induction

Section 7.2: One-to-One, Onto and Inverse Functions

Announcements. CS243: Discrete Structures. Sequences, Summations, and Cardinality of Infinite Sets. More on Midterm. Midterm.

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

Practice Second Midterm Exam I

Complexity Theory Part I

One-to-one functions and onto functions

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

Mathematical Logic Part Three

Math 4603: Advanced Calculus I, Summer 2016 University of Minnesota Notes on Cardinality of Sets

Announcements. Problem Set 1 out. Checkpoint due Monday, September 30. Remaining problems due Friday, October 4.

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Welcome to CS103! Two Handouts Today: Course Overview Introduction to Set Theory The Limits of Computation

Announcements Monday, November 13

Methods of Mathematics

Selected problems from past exams

MITOCW MITRES18_006F10_26_0602_300k-mp4

4.1 Real-valued functions of a real variable

Disjoint-Set Forests

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Lecture 3: Sizes of Infinity

Mathematical Logic Part One

Practice Second Midterm Exam III

Workshop 1- Building on the Axioms. The First Proofs

MITOCW ocw f99-lec09_300k

Lecture 1. Econ 2001: Introduction to Mathematical Methods (a.k.a. Math Camp) 2015 August 10

CS103 Handout 22 Fall 2012 November 30, 2012 Problem Set 9

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

INFINITY: CARDINAL NUMBERS

Outline for Today. What is an Implication? Negations and their Applications. Proof by Contrapositive. Proof by Contradiction

Finite Automata Part One

Nonregular Languages

NP-Completeness Part II

ABOUT THE CLASS AND NOTES ON SET THEORY

Mathematical Logic Part Two

Today: Scalars and vectors Coordinate systems, Components Vector Algebra

Discrete Mathematics. Kenneth A. Ribet. January 31, 2013

Math 42, Discrete Mathematics

CIS Spring 2018 (instructor Val Tannen)

1 / 9. Due Friday, May 11 th at 2:30PM. There is no checkpoint problem. CS103 Handout 30 Spring 2018 May 4, 2018 Problem Set 5

Announcements Monday, November 13

Contribution of Problems

Congratulations you're done with CS103 problem sets! Please evaluate this course on Axess!

NP-Completeness Part One

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

MATH 341, Section 001 FALL 2014 Introduction to the Language and Practice of Mathematics

MITOCW watch?v=ko0vmalkgj8

CSCE 222 Discrete Structures for Computing. Review for the Final. Hyunyoung Lee

CS103 Handout 47 Spring 2018 Practice CS103 Final Exam V

Math 31 Lesson Plan. Day 5: Intro to Groups. Elizabeth Gillaspy. September 28, 2011

Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1)

SETS AND FUNCTIONS JOSHUA BALLEW

1. Decide for each of the following expressions: Is it a function? If so, f is a function. (i) Domain: R. Codomain: R. Range: R. (iii) Yes surjective.

Midterm 2. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

Functions Part Three

Last 6 lectures are easier

CHAPTER 7 FUNCTIONS. Alessandro Artale UniBZ - artale/

2. Introduction to commutative rings (continued)

Section 4.4 Functions. CS 130 Discrete Structures

PROFESSOR: WELCOME BACK TO THE LAST LECTURE OF THE SEMESTER. PLANNING TO DO TODAY WAS FINISH THE BOOK. FINISH SECTION 6.5

CPSC 121: Models of Computation

MITOCW R11. Double Pendulum System

About This Document. MTH299 - Examples Weeks 1-6; updated on January 5, 2018

CMSC 250 Spring 2016: Final Exam Review Questions Key

CITS2211 Discrete Structures (2017) Cardinality and Countability

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

MITOCW watch?v=vjzv6wjttnc

Mathematics 220 Workshop Cardinality. Some harder problems on cardinality.

Finite and Infinite Sets

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm).

MITOCW watch?v=pqkyqu11eta

Proof: If (a, a, b) is a Pythagorean triple, 2a 2 = b 2 b / a = 2, which is impossible.

Mathematical Logic Part One

Transcription:

The Pigeonhole Principle & Functions

Outline for Today Special Quantifiers The Pigeonhole Principle Proving results are true just by counting. Functions Quantifying over sets. Modeling transformations between sets. Cardinality (ITA) Revisiting our first lecture with our new techniques!

One Last Bit of Logic

Special Quantifiers Mathematicians are extremely lazy and don't like writing symbols they don't have to. Over time, several variations on the and quantifiers have been developed. We'd like to introduce you to one of them that we'll be using going forward.

Quantifying Over Sets The notation x S. ψ means for every element x of set S, ψ is true. This is not technically a part of first-order logic; it is a shorthand for x. (x S ψ) The notation x S. ψ means for some element x of set S, ψ is true. It's shorthand for x. (x S ψ)

Quantifying Over Sets The syntax x S. φ x S. φ is allowed for quantifying over sets. In CS103, you can use the set quantifiers, but please do not generalize it to more complex statements. For example, please don't do things like this: x with P(x). Q(x) y such that P(y) Q(y). R(y).

Changing Gears: The Pigeonhole Principle

The pigeonhole principle is the following: If m objects are placed into n bins, where m > n, then some bin contains at least two objects. (We sketched a proof in Lecture #02)

Why This Matters The pigeonhole principle can be used to show results must be true because they are too big to fail. Given a large enough number of objects with a bounded number of properties, eventually at least two of them will share a property. Can be used to prove some surprising results.

Using the Pigeonhole Principle To use the pigeonhole principle: Find the m objects to distribute. Find the n < m buckets into which to distribute them. Conclude by the pigeonhole principle that there must be two objects in some bucket. The details of how to proceed from there are specific to the particular proof you're doing.

A Surprising Application Theorem: Suppose that every point in the real plane is colored either red or blue. Then for any distance d > 0, there are two points exactly distance d from one another that are the same color. Proof: Consider any equilateral triangle whose side Thought: There two here, lengths are d. Put thisare triangle anywhere inwe the Thought: There are two colors colors here, so so ifif we start picking we'll them plane. By the because startpigeonhole picking points, points,principle, we'll be be dropping dropping themthere into of (red blue). are three vertices, of buckets the vertices into one onetwo of two two buckets (red or ormust blue).have the same color. These vertices are at distance d from How many How many points points do we we need need to to pick pick to to each other, as required. do guarantee guarantee that that we we get get two two of of the the same same color? color?

A Surprising Application Theorem: Suppose that every point in the real plane is colored either red or blue. Then for any distance d > 0, there are two points exactly distance d from one another that are the same color. Proof: Consider any equilateral triangle whose side lengths are d. Put this triangle anywhere in the plane. By the pigeonhole principle, because there are three vertices, two of the vertices must have the d are dat distance d from same color. These vertices each other, as required. d

A Surprising Application Theorem: Suppose that every point in the real plane is colored either red or blue. Then for any distance d > 0, there are two points exactly distance d from one another that are the same color. Proof: Consider any equilateral triangle whose side lengths are d. Put this triangle anywhere in the plane. Because the triangle has three vertices and each point in the plane is only one of two different colors, by the pigeonhole principle at least two of the vertices must have the same color. These vertices are at distance d from each other, as required.

The Hadwiger-Nelson Problem No matter how you color the points of the plane, there will always be two points at distance 1 that are the same color. Relation to graph coloring: Every point in the real plane is a node. There's an edge between two points that are at distance exactly one. Question: What is the chromatic number of this graph? (That is, how many colors do you need to ensure no points at distance one are the same color?) This is the Hadwiger-Nelson problem. It's known that the number is between 4 and 7, but no one knows for sure!

Theorem: For any nonzero natural number n, there is a nonzero multiple of n whose digits are all 0s and 1s.

Theorem: For any nonzero natural number n, there is a nonzero multiple of n whose digits are all 0s and 1s. 1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111 There are 10 objects here.

Theorem: For any nonzero natural number n, there is a nonzero multiple of n whose digits are all 0s and 1s. 111111111 1111111111 1111111111-1111111111 1111111110 1 11 111 1111 11111 111111 1111111 11111111 0 1 2 3 4 5 6 7 8

Proof Idea Generate the numbers 1, 11, 111, until n+1 numbers have been generated. There are n possible remainders modulo n, so two of these numbers have the same remainder. Their difference is a multiple of n. Their difference consists of 1s and 0s.

Theorem: Every positive natural number n has a nonzero multiple whose digits are all 0s and 1s. Proof: Let n be an arbitrary positive natural number. Consider any n+1 distinct natural numbers whose digits are all 1's. Then, look at the remainders of those numbers modulo n. Since there are n+1 numbers and only n possible remainders modulo n, by the pigeonhole principle at least two of these numbers must leave the same remainder modulo n. Call these numbers p and q, and assume without loss of generality that p > q. We claim that the number p q is the nonzero multiple of n that we're looking for. Since p > q, we know that p q is nonzero. Additionally, given the way that p and q are structured, the 1s in the digits of q will cancel out some tail of the 1s in the digits of p, so p q consists of a string of 1s followed by a string of 0s. If we can show that p q is a multiple of n, then we're done. We know that p and q have the same remainder modulo n; let's call that remainder r. This means that there are integers s and t such that p = sn + r and q = tn + r. Then p q = (sn + r) (tn + r) = (s t)n. So p q is a multiple of n. Therefore, p q is a nonzero multiple of n with only 1s and 0s as its digits, as required.

Notes on Pigeonholes Typically, the pigeonhole principle is used as a key step in a larger proof. Proofs using the pigeonhole principle are often insight-based; you need to have the right observation to see when to use the pigeonhole principle. These previous two proofs are by no means obvious. Don't panic if you didn't come up with them on your own!

Time-Out for Announcements!

Solution Sets Solutions to the checkpoint problem and the discussion problems from this week are available outside. There are a lot of very lonely solution sets sitting in a dark filing cabinet, wondering if some day, someone will be their friends. Please pick them up!

Problem Set Grading Problem Set Two should be graded and returned by the end of class (allow about an hour for us to finalize and release everything). Problem Set Three checkpoints also graded, will be returned at around the same time.

Midterm Logistics The first midterm is on Thursday, October 23 from 6PM 9PM. We'll announce testing locations on Friday. Alternate exams: if you've requested an alternate exam time, Maesen should have replied to you. If you haven't heard from her and need to take the exam at an alternate time, let us know ASAP. Covers material up through and including first-order logic (content from PS1 PS3). The exam is closed-book and closed-computer. You can bring one double-sided, 8.5 11 page of notes with you when you take the exam.

Review Materials We've posted some practice problems up on the course website that you can use to review for the midterm. We'll release solutions and a new set of practice problems on Friday. We'll also poll you for input on what you'd like more practice with so that we can put together even more practice problems.

Practice Exam We have reserved Annenberg Auditorium on next Monday, October 20 from 7PM 10PM for a practice midterm exam. Want to try working through a practice midterm under realistic exam conditions? Stop on by! The TAs will be available to answer questions afterwards. Purely optional, but highly recommended if you want to get a sense for what the test will be like. SCPD students we'll send out the practice exam through the normal distribution channels so that you can take it on your own time.

Advice about Working in Teams

Your Questions

How important have you found GPA to be in success after college? I feel like my worry about keeping my GPA up has kept me from enjoying some classes that I'm in or even from taking some hard, but interesting, classes in the first place.

I'm having a lot of trouble on PSet 3 and now I'm really frightened about the midterm. If I can't do PSet 3 by myself, how can I expect to do well on the midterm, when I don't have anyone? For the harder questions on problem sets, I read the question, think about it, but usually don't come up with a solution until I'm lying in bed, or on a long bike ride, or in the shower, etc. Am I going to be hosed on the exam?

We've talked a lot about 'translating' English statements into first order logic. Could we practice translating from logic back into English, so that once we manipulate a logical statement we can find meaning in it again?

So I'm about to declare CS. Any tips on how I should choose a CS advisor? Who would you recommend?

Back to CS103!

Functions

A function is a means of associating each object in one set with an object in some other set.

Dikdik Nubian Ibex Sloth

Black and White

Terminology A function f is a mapping from one set A to another set B such that every element of A is associated with a single element of B. For each a A, there is some b B with f(a) = b. If f(a) = b₀ and f(a) = b₁, then b₀ = b₁. If f is a function from A to B, we say that f is a mapping from A to B. We call A the domain of f. We call B the codomain of f. We denote that f is a function from A to B by writing f : A B.

Defining Functions Typically, we specify a function by describing a rule that maps every element of the domain to some element of the codomain. Examples: f(n) = n + 1, where f : ℤ ℤ f(x) = sin x, where f : ℝ ℝ f(x) = x, where f : ℝ ℤ Notice that we're giving both a rule and the domain/codomain.

Defining Functions Typically, we specify a function by describing a rule that maps every element This function of the domain to some element of the This isis the the ceiling ceiling function the the smallest smallest integer integer greater greater codomain. Examples: than than or or equal equal to to x. x. For For example, example, 1 1 == 1,1, 1.37 1.37 == 2, 2, f(n) = n + 1, where f : ℤ ℤ and and π π == 4. 4. f(x) = sin x, where f : ℝ ℝ f(x) = x, where f : ℝ ℤ Notice that we're giving both a rule and the domain/codomain.

Is this a function from A to B? Stanford Cardinal Berkeley Blue Michigan Gold Arkansas White A B

Is this a function from A to B? California Dover New York Sacramento Delaware Albany Washington DC A B

Is this a function from A to B? Wish Funshine A B Love-a-Lot Tenderheart Friend

Piecewise Functions Functions may be specified piecewise, with different rules applying to different elements. As an example, consider this function f : ℕ ℤ defined as follows: { n/2 if n is even f (n)= (n+1)/2 otherwise When defining a function piecewise, it's up to you to confirm that it defines a legal function!

Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune

Injective Functions A function f : A B is called injective (or one-to-one) if each element of the codomain has at most one element of the domain that maps to it. A function with this property is called an injection. Formally, f : A B is an injection if this statement is true: a₁ A. a₂ A. (f(a₁) = f(a₂) a₁ = a₂) ( If the outputs are the same, the inputs are the same ) Equivalently: a₁ A. a₂ A. (a₁ a₂ f(a₁) f(a₂)) ( If the inputs are different, the outputs are different )

Front Door Balcony Window Bedroom Window

Surjective Functions A function f : A B is called surjective (or onto) if each element of the codomain has at least one element of the domain that maps to it. A function with this property is called a surjection. Formally, f : A B is a surjection if this statement is true: b B. a A. f(a) = b ( For every possible output, there's at least one possible input that produces it )

Injections and Surjections An injective function associates at most one element of the domain with each element of the codomain. A surjective function associates at least one element of the domain with each element of the codomain. What about functions that associate exactly one element of the domain with each element of the codomain?

Katniss Everdeen Merida Hermione Granger

Bijections A function that associates each element of the codomain with a unique element of the domain is called bijective. Such a function is a bijection. Formally, a bijection is a function that is both injective and surjective. Bijections are sometimes called one-toone correspondences. Not to be confused with one-to-one functions.

Cardinality Revisited

Cardinality Recall (from our first lecture!) that the cardinality of a set is the number of elements it contains. If S is a set, we denote its cardinality by S. For finite sets, cardinalities are natural numbers: {1, 2, 3} = 3 {100, 200} = 2 For infinite sets, we introduced infinite cardinals to denote the size of sets: ℕ = ℵ₀

Defining Cardinality It is difficult to give a rigorous definition of what cardinalities actually are. What is 4? What is ℵ₀? Idea: Define cardinality as a relation between two sets rather than as an absolute quantity. We'll define what these relations between sets mean without actually defining what a cardinality actually is: S = T S T S T Cardinality exists between sets! S < T

Comparing Cardinalities The relationships between set cardinalities are defined in terms of functions between those sets. S = T is defined using bijections. S = T if there exists a bijection f : S T,,,,,,

Properties of Cardinality Equality of cardinality is an equivalence relation. For any sets R, S, and T, the following are true: S = S. If S = T, then T = S. If R = S and S = T, then R = T. Read the course notes for proofs of these results!

Infinity is Weird...

Home on the Range 0 1 2 0 f : [0, 1] [0, 2] f(x) = 2x [0, 1] = [0, 2]

Home on the Range 0 1 k 0 f : [0, 1] [0, k] f(x) = kx [0, 1] = [0, k]

Put a Ring On It +π /2 -π /2 0 f : (-π/2, π/2) ℝ f(x) = tan x (-π/2, π/2) = ℝ

Next Time Equal Cardinalities Unequal Cardinalities Showing that two sets do have the same size. Showing that two sets don't have the same size. Diagonalization Formalizing the diagonal argument from our first lecture.