A Random Walk through CS70

Similar documents
1 / 43. Today. Finish Euclid. Bijection/CRT/Isomorphism. Fermat s Little Theorem. Review for Midterm.

Connecting Statements. Today. First there was logic jumping forward.. ..and then proofs and then induction...

Today. Finish Euclid. Bijection/CRT/Isomorphism. Review for Midterm.

Discrete Mathematics and Probability Theory Summer 2016 Dinh, Psomas, and Ye HW 2

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Midterm 1

CS70 - Lecture 6. Graphs: Coloring; Special Graphs. 1. Review of L5 2. Planar Five Color Theorem 3. Special Graphs:

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Fall

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 7

Today. Types of graphs. Complete Graphs. Trees. Hypercubes.

To illustrate what is intended the following are three write ups by students. Diagonalization

MATH 139 W12 Review 1 Checklist 1. Exam Checklist. 1. Introduction to Predicates and Quantified Statements (chapters ).

CS 3512, Spring Instructor: Doug Dunham. Textbook: James L. Hein, Discrete Structures, Logic, and Computability, 3rd Ed. Jones and Barlett, 2010

Lecture 5: Graphs. Graphs! Euler Definitions: model. Fact! Euler Again!! Planar graphs. Euler Again!!!!

Definition For vertices u, v V (G), the distance from u to v, denoted d(u, v), in G is the length of a shortest u, v-path. 1

Discrete Mathematics for CS Spring 2008 David Wagner Note 13. An Introduction to Graphs

Introduction III. Graphs. Motivations I. Introduction IV

r=1 The Binomial Theorem. 4 MA095/98G Revision

Reductions and Satisfiability

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

INTRODUCTION TO GRAPH THEORY. 1. Definitions

Basic Combinatorics. Math 40210, Section 01 Fall Homework 4 Solutions

Adjacent: Two distinct vertices u, v are adjacent if there is an edge with ends u, v. In this case we let uv denote such an edge.

γ(ɛ) (a, b) (a, d) (d, a) (a, b) (c, d) (d, d) (e, e) (e, a) (e, e) (a) Draw a picture of G.

Theorem 3.1 (Berge) A matching M in G is maximum if and only if there is no M- augmenting path.

Lecture 20 : Trees DRAFT

Notebook Assignments

14 More Graphs: Euler Tours and Hamilton Cycles

Notes slides from before lecture. CSE 21, Winter 2017, Section A00. Lecture 9 Notes. Class URL:

Graph theory. Po-Shen Loh. June We begin by collecting some basic facts which can be proved via bare-hands techniques.

Material from Recitation 1

MC 302 GRAPH THEORY 10/1/13 Solutions to HW #2 50 points + 6 XC points

Discrete Wiskunde II. Lecture 6: Planar Graphs

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

Lecture 5: Graphs. Rajat Mittal. IIT Kanpur

MITOCW watch?v=zm5mw5nkzjg

DISCRETE MATHEMATICS

Graph Theory II. Po-Shen Loh. June edges each. Solution: Spread the n vertices around a circle. Take parallel classes.

MATH 363 Final Wednesday, April 28. Final exam. You may use lemmas and theorems that were proven in class and on assignments unless stated otherwise.

Lecture 6: Graph Properties

DO NOT RE-DISTRIBUTE THIS SOLUTION FILE

About the Author. Dependency Chart. Chapter 1: Logic and Sets 1. Chapter 2: Relations and Functions, Boolean Algebra, and Circuit Design

Assignment 4 Solutions of graph problems

Introduction to Graph Theory

Discrete Mathematics Course Review 3

Discrete Mathematics and Probability Theory Fall 2015 Rao Midterm 1

implementing the breadth-first search algorithm implementing the depth-first search algorithm

Elements of Graph Theory

CSE 417: Algorithms and Computational Complexity. 3.1 Basic Definitions and Applications. Goals. Chapter 3. Winter 2012 Graphs and Graph Algorithms

The Konigsberg Bridge Problem

MATHEMATICAL STRUCTURES FOR COMPUTER SCIENCE

GRAPH THEORY: AN INTRODUCTION

Math 776 Graph Theory Lecture Note 1 Basic concepts

COMP260 Spring 2014 Notes: February 4th

Matchings, Ramsey Theory, And Other Graph Fun

Graphs and Algorithms 2015

Math 170- Graph Theory Notes

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19

2010 SMT Power Round

Planar graphs. Math Prof. Kindred - Lecture 16 Page 1

Problem set 2. Problem 1. Problem 2. Problem 3. CS261, Winter Instructor: Ashish Goel.

Chapter 3. Set Theory. 3.1 What is a Set?

Combinatorial Gems. Po-Shen Loh. June 2009

Instant Insanity Instructor s Guide Make-it and Take-it Kit for AMTNYS 2006

Lecture 4: Trees and Art Galleries

11.9 Connectivity Connected Components. mcs 2015/5/18 1:43 page 419 #427

Midterm 2 Solutions. CS70 Discrete Mathematics and Probability Theory, Spring 2009

Exercise set 2 Solutions

Treewidth and graph minors

Questions? You are given the complete graph of Facebook. What questions would you ask? (What questions could we hope to answer?)

Section 8.2 Graph Terminology. Undirected Graphs. Definition: Two vertices u, v in V are adjacent or neighbors if there is an edge e between u and v.

Copyright 2000, Kevin Wayne 1

Last week: Breadth-First Search

U.C. Berkeley CS170 : Algorithms, Fall 2013 Midterm 1 Professor: Satish Rao October 10, Midterm 1 Solutions

Infinity and Uncountability. Countable Countably infinite. Enumeration

Solutions to relevant spring 2000 exam problems

Logic: The Big Picture. Axiomatizing Arithmetic. Tautologies and Valid Arguments. Graphs and Trees

Grade 7/8 Math Circles Graph Theory - Solutions October 13/14, 2015

CS521 \ Notes for the Final Exam

Majority and Friendship Paradoxes

Chapter 3: Paths and Cycles

Discrete mathematics , Fall Instructor: prof. János Pach

Assignment # 4 Selected Solutions

STUDENT NUMBER: MATH Final Exam. Lakehead University. April 13, Dr. Adam Van Tuyl

Professor: Padraic Bartlett. Lecture 9: Trees and Art Galleries. Week 10 UCSB 2015

CMSC 380. Graph Terminology and Representation

CPS 102: Discrete Mathematics. Quiz 3 Date: Wednesday November 30, Instructor: Bruce Maggs NAME: Prob # Score. Total 60

Discrete mathematics II. - Graphs

Basic Graph Theory with Applications to Economics

Proof Techniques Alphabets, Strings, and Languages. Foundations of Computer Science Theory

CPSC 320: Intermediate Algorithm Design and Analysis. Tutorial: Week 3

Lecture 2: NP-Completeness

North Bank. West Island. East Island. South Bank

Induction Review. Graphs. EECS 310: Discrete Math Lecture 5 Graph Theory, Matching. Common Graphs. a set of edges or collection of two-elt subsets

Problem One: A Quick Algebra Review

2. CONNECTIVITY Connectivity

Graphs (MTAT , 6 EAP) Lectures: Mon 14-16, hall 404 Exercises: Wed 14-16, hall 402

Cardinality of Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Cardinality of Sets Fall / 15

Transcription:

A Random Walk through CS70 CS70 Summer 2016 - Lecture 8B David Dinh 09 August 2016 UC Berkeley 1

Today (and tomorrow, and Wednesday) Review: what have we done in class? Future classes: where do you go next? Applications: how is the stuff you learned in 70 useful in the real world? Research frontiers: what are people in academia working on (related to 70) right now? Gigs: interesting stuff with material for fun and practice! Announcement: No scantron HKN surveys now (or ever again!). Everything s online now. You should have received an email about this sometime in the previous week or two. 2

Propositional Logic We started with propositions... 3

Propositional Logic We started with propositions...either true or false (forget about Godel for now). 3

Propositional Logic We started with propositions...either true or false (forget about Godel for now). Quantifiers: forall, exists. 3

Propositional Logic We started with propositions...either true or false (forget about Godel for now). Quantifiers: forall, exists. Statements: 9 = 1. David had two pieces of bread for breakfast.. q R : q q. 3

Propositional Logic We started with propositions...either true or false (forget about Godel for now). Quantifiers: forall, exists. Statements: 9 = 1. David had two pieces of bread for breakfast.. q R : q q. Not statements: x = 5. 42. x R : xy = 0. 3

Propositional Logic We started with propositions...either true or false (forget about Godel for now). Quantifiers: forall, exists. Statements: 9 = 1. David had two pieces of bread for breakfast.. q R : q q. Not statements: x = 5. 42. x R : xy = 0. Sanity check: Why is q R : q q a statement but x R : xy = 0 not a statement? 3

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) P (Q = R) 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) P (Q = R) P (Q R) 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) P (Q = R) P (Q R) (P Q) R 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) P (Q = R) P (Q R) (P Q) R (P Q) R 4

Combining Statements Boolean operators: and ( ), or ( ), not ( or a line over your expression, e.g. x), conditional ( = ), biconditional ( ). Prove things are equivalent by simplifying one (or both) sides, or with truth tables. Disprove things with counterexamples. Example (SU14 MT1): True or false? P = (Q = R) (P Q) = R. Intuitive method: guess whether or not this seems right or not. If P true? Then Q true, then R true. If P not true, then both sides reduce to Q = R so they re equivalent. Symbolic manipulation approach: P = (Q = R) P (Q = R) P (Q R) (P Q) R (P Q) R (P Q) = R 4

Applications: Circuits Boolean logic encompasses a lot of computation... 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. Want to squeeze more processing power onto my chip using less gates. Can I take a Boolean circuit and simplify it? 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. Want to squeeze more processing power onto my chip using less gates. Can I take a Boolean circuit and simplify it? Estimates? K-maps (also 61C). 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. Want to squeeze more processing power onto my chip using less gates. Can I take a Boolean circuit and simplify it? Estimates? K-maps (also 61C). Best way to do it? CIRCUIT-MIN problem. Really hard problem ( Σ P 2 complete - take CS172 to find out what that means.) 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. Want to squeeze more processing power onto my chip using less gates. Can I take a Boolean circuit and simplify it? Estimates? K-maps (also 61C). Best way to do it? CIRCUIT-MIN problem. Really hard problem ( Σ P 2 complete - take CS172 to find out what that means.) How big do circuits need to be in order to compute some function that you re interested in? 5

Applications: Circuits Boolean logic encompasses a lot of computation... Circuits! Boolean circuits are in your computers. And gates, or gates, NAND gates, etc. Take boolean inputs and give some output. CS61C. Want to squeeze more processing power onto my chip using less gates. Can I take a Boolean circuit and simplify it? Estimates? K-maps (also 61C). Best way to do it? CIRCUIT-MIN problem. Really hard problem ( Σ P 2 complete - take CS172 to find out what that means.) How big do circuits need to be in order to compute some function that you re interested in? Circuit lower bounds. Hard problem. Lots of research going on about this. Absolute lower bounds that don t depend on unproven assumptions are pretty primitive (think lower bounds for computing whether you have an even number of 1s as input). 5

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! Satisfiability in the general case actually models almost any computation we care about. 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! Satisfiability in the general case actually models almost any computation we care about. Hard to solve in the general case though. CS170, CS172 for info on why this is hard. 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! Satisfiability in the general case actually models almost any computation we care about. Hard to solve in the general case though. CS170, CS172 for info on why this is hard. Sometimes we can estimate. Or we can satisfy some portion of the formula but not all. 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! Satisfiability in the general case actually models almost any computation we care about. Hard to solve in the general case though. CS170, CS172 for info on why this is hard. Sometimes we can estimate. Or we can satisfy some portion of the formula but not all. CS174. 6

Applications: Satisfiability Motivating example: x,y,z : (x y z) (x y z)? Yes, let x be true, y be true, and z be anything. Generally: given some Boolean formula... Is there some assignment of variables that makes it true? Do all assignments of variables make it true? Satisfiability and tautology problems. Also well studied! Satisfiability in the general case actually models almost any computation we care about. Hard to solve in the general case though. CS170, CS172 for info on why this is hard. Sometimes we can estimate. Or we can satisfy some portion of the formula but not all. CS174. What s the probability that some formula has a satisfying assignment? Counting/probabilistic arguments. Interesting results. Phase transitions. 6

Proofs: Techniques Direct proof. Just go and prove it! 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. Casewise. Split into cases. Make sure one of those cases always applies! 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. Casewise. Split into cases. Make sure one of those cases always applies! Combinatorial Proofs. Count something two ways. Those two quantities must be the same. 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. Casewise. Split into cases. Make sure one of those cases always applies! Combinatorial Proofs. Count something two ways. Those two quantities must be the same. Probabilistic Method (not on exam). If you do something randomly, and you have some chance of encountering something... that something must exist! 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. Casewise. Split into cases. Make sure one of those cases always applies! Combinatorial Proofs. Count something two ways. Those two quantities must be the same. Probabilistic Method (not on exam). If you do something randomly, and you have some chance of encountering something... that something must exist! Induction. Start from base case and expand to entire (countable) set with an inductive step. 7

Proofs: Techniques Direct proof. Just go and prove it! Contraposition. To prove p = q, prove that q = p. Contradiction. Suppose that what you re trying to prove is wrong. Prove that the universe implodes. Casewise. Split into cases. Make sure one of those cases always applies! Combinatorial Proofs. Count something two ways. Those two quantities must be the same. Probabilistic Method (not on exam). If you do something randomly, and you have some chance of encountering something... that something must exist! Induction. Start from base case and expand to entire (countable) set with an inductive step. These are all techniques you can compose! 7

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? Combinatorial proof. 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? Combinatorial proof. At the sandwich shop. They have n sandwiches. I want to buy k, and eat one right now. How many ways? 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? Combinatorial proof. At the sandwich shop. They have n sandwiches. I want to buy k, and eat one right now. How many ways? Answer 1: pick k sandwiches to buy: ( n k) ways. Pick one of them to eat: k ways. Total: k ( n k) ways. 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? Combinatorial proof. At the sandwich shop. They have n sandwiches. I want to buy k, and eat one right now. How many ways? Answer 1: pick k sandwiches to buy: ( n k) ways. Pick one of them to eat: k ways. Total: k ( n k) ways. Answer 2: pick sandwich to eat right now first: n ways. Now pick k 1 sandwiches out of the remaining n 1 at the shop to take home: ( n 1 ) ( k 1 ways. Total: n n 1 k 1) ways. 8

Example: A Combinatorial Proof Claim: for 0 k n, k ( n) ( k = n n 1 k 1). How to prove the claim? Combinatorial proof. At the sandwich shop. They have n sandwiches. I want to buy k, and eat one right now. How many ways? Answer 1: pick k sandwiches to buy: ( n k) ways. Pick one of them to eat: k ways. Total: k ( n k) ways. Answer 2: pick sandwich to eat right now first: n ways. Now pick k 1 sandwiches out of the remaining n 1 at the shop to take home: ( n 1 ) ( k 1 ways. Total: n n 1 k 1) ways. Two quantities have to be the same. So we have proved the claim. 8

Example: FLT Fermat s little theorem: For all p prime, p (a p a). 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. Notice that since p is prime, p ( p k) for k (0,p). Why? 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. Notice that since p is prime, p ( p k) for k (0,p). Why? From previous page: k ( p) ( k = p p 1 k 1). We know p and k have no common factors since p is prime. So p ( p k). 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. Notice that since p is prime, p ( p k) for k (0,p). Why? From previous page: k ( p) ( k = p p 1 k 1). We know p and k have no common factors since p is prime. So p ( p k). Also a p a (mod p) by inductive hypothesis. So (a + 1) p (a + 1) = 1 + a p p 1( ) p + a k (a + 1) k å k=1 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. Notice that since p is prime, p ( p k) for k (0,p). Why? From previous page: k ( p) ( k = p p 1 k 1). We know p and k have no common factors since p is prime. So p ( p k). Also a p a (mod p) by inductive hypothesis. So (a + 1) p (a + 1) = 1 + a p p 1( ) p + a k (a + 1) k å k=1 1 + a + 0 (a + 1) (mod p) 9

Example: FLT Fermat s little theorem: For all p prime, p (a p a). Proof: by induction on a. Base case: obviously p must divide 0 = (0 p 0) = (1 p 1). Suppose for induction that p (a p a). It suffices to show that p ((a + 1) p (a + 1)). Expand the first term (binomial theorem): (a + 1) p = å p ( p ) k=0 k a k = 1 + a p +å p 1 ( p k=1 k) a k. Notice that since p is prime, p ( p k) for k (0,p). Why? From previous page: k ( p) ( k = p p 1 k 1). We know p and k have no common factors since p is prime. So p ( p k). Also a p a (mod p) by inductive hypothesis. So (a + 1) p (a + 1) = 1 + a p p 1( ) p + a k (a + 1) k as desired. å k=1 1 + a + 0 (a + 1) (mod p) 0 (mod p) 9

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices. 10

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices.unordered or ordered pairs? Depends on whether the graph is directed. 10

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices.unordered or ordered pairs? Depends on whether the graph is directed. Degree of a vertex: number of edges touching the vertex. 10

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices.unordered or ordered pairs? Depends on whether the graph is directed. Degree of a vertex: number of edges touching the vertex. Paths in graphs. Can you traverse edges from vertex v to vertex u? Then there is a path from v to u. 10

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices.unordered or ordered pairs? Depends on whether the graph is directed. Degree of a vertex: number of edges touching the vertex. Paths in graphs. Can you traverse edges from vertex v to vertex u? Then there is a path from v to u. Connectivity. An undirected graph is connected if you can reach every vertex from every other vertex (always exists a path between any two vertices). Directed graph is strongly connected if you can reach every vertex from every other vertex by following edges in the correct direction. 10

Graphs G = (V,E). Collection of vertices (or nodes) and edges = pairs of vertices.unordered or ordered pairs? Depends on whether the graph is directed. Degree of a vertex: number of edges touching the vertex. Paths in graphs. Can you traverse edges from vertex v to vertex u? Then there is a path from v to u. Connectivity. An undirected graph is connected if you can reach every vertex from every other vertex (always exists a path between any two vertices). Directed graph is strongly connected if you can reach every vertex from every other vertex by following edges in the correct direction. (remember that a Markov chain represented by a strongly connected graph is irreducible). 10

Aside: Interesting Applications of Graphs Web hyperlinks and social networks. Meshes in simulations and scientific computing. 1 Maps and grids. Games. Finding paths in graphs is really useful. How does Google maps find a route to your destination? Finding paths in graphs! CS170, CS188. 1 Images from Aydin Buluc s CS267 slides, https://people.eecs.berkeley.edu/~demmel/cs267_spr16/lectures/cs267_march17_buluc_2016_4pp.pdf 11

Walks and Tours If all degrees are even: Eulerian tour - can walk around the graph so we touch every edge exactly once and return to where we started. 12

Walks and Tours If all degrees are even: Eulerian tour - can walk around the graph so we touch every edge exactly once and return to where we started. If either all degrees or even, or there are exactly two vertices with odd degree: Eulerian walk - same as above except we do not necessarily return to the same point. 12

Walks and Tours If all degrees are even: Eulerian tour - can walk around the graph so we touch every edge exactly once and return to where we started. If either all degrees or even, or there are exactly two vertices with odd degree: Eulerian walk - same as above except we do not necessarily return to the same point. What about if we say that we want to touch every vertex? Interesting question... and hard. CS170. 12

Complete graphs. Complete graphs. 13

Complete graphs. Complete graphs. 13

Complete graphs. Complete graphs. 13

Complete graphs. Complete graphs. K n. n vertices. How many edges? ( n 2). 13

Complete graphs. Complete graphs. K n. n vertices. How many edges? ( n 2). 13

Bipartite Graphs Bipartite graphs. Vertices can be partitioned into two sets such that there are no edges between edges in the same set. 14

Bipartite Graphs Bipartite graphs. Vertices can be partitioned into two sets such that there are no edges between edges in the same set. Can represent matchings. Remember stable matchings problem from MT1? 14

Bipartite Graphs Bipartite graphs. Vertices can be partitioned into two sets such that there are no edges between edges in the same set. Can represent matchings. Remember stable matchings problem from MT1? No odd length cycles. 14

Bipartite Graphs Bipartite graphs. Vertices can be partitioned into two sets such that there are no edges between edges in the same set. Can represent matchings. Remember stable matchings problem from MT1? No odd length cycles. Random walk on a bipartite graph is periodic. 14

Trees How do you define a tree? Connected acyclic graph. 15

Trees How do you define a tree? Connected acyclic graph. Connected graph with V 1 edges. 15

Trees How do you define a tree? Connected acyclic graph. Connected graph with V 1 edges. Connected graph that can be disconnected by removing any edge. 15

Trees How do you define a tree? Connected acyclic graph. Connected graph with V 1 edges. Connected graph that can be disconnected by removing any edge. Acyclic graph where any edge addition creates a cycle. 15

Trees How do you define a tree? Connected acyclic graph. Connected graph with V 1 edges. Connected graph that can be disconnected by removing any edge. Acyclic graph where any edge addition creates a cycle. Which definition is correct? 15

Trees How do you define a tree? Connected acyclic graph. Connected graph with V 1 edges. Connected graph that can be disconnected by removing any edge. Acyclic graph where any edge addition creates a cycle. Which definition is correct? All of them are equivalent. Good practice exercise: prove it! 15

Trees are really useful! Data structures! Binary search trees, heaps, red-black trees, B-trees, etc. Great for storing data.cs61b. 16

Trees are really useful! Data structures! Binary search trees, heaps, red-black trees, B-trees, etc. Great for storing data.cs61b. Spanning trees. Given a graph, take a subset of edges that makes a tree touching all the vertices. We used this to prove the 4 V E bound on the cover time of a graph. 16

Trees are really useful! Data structures! Binary search trees, heaps, red-black trees, B-trees, etc. Great for storing data.cs61b. Spanning trees. Given a graph, take a subset of edges that makes a tree touching all the vertices. We used this to prove the 4 V E bound on the cover time of a graph. Also really useful in a lot of applications, including fast solvers for systems of linear equations. 16

Trees are really useful! Data structures! Binary search trees, heaps, red-black trees, B-trees, etc. Great for storing data.cs61b. Spanning trees. Given a graph, take a subset of edges that makes a tree touching all the vertices. We used this to prove the 4 V E bound on the cover time of a graph. Also really useful in a lot of applications, including fast solvers for systems of linear equations. Spawn trees. Represent function calls, etc. 16

Trees are really useful! Data structures! Binary search trees, heaps, red-black trees, B-trees, etc. Great for storing data.cs61b. Spanning trees. Given a graph, take a subset of edges that makes a tree touching all the vertices. We used this to prove the 4 V E bound on the cover time of a graph. Also really useful in a lot of applications, including fast solvers for systems of linear equations. Spawn trees. Represent function calls, etc. Decision trees. Every vertex represents a decision you can make. CS188 16

Planar Graphs Can you draw the graph on paper so that no edges cross? If so, it s a planar graph. 17

Planar Graphs Can you draw the graph on paper so that no edges cross? If so, it s a planar graph. Euler s formula: v + f = e + 2. (how did we prove this? Induction on e. Remove cycle by removing edge.) 17

Planar Graphs Can you draw the graph on paper so that no edges cross? If so, it s a planar graph. Euler s formula: v + f = e + 2. (how did we prove this? Induction on e. Remove cycle by removing edge.) Four color theorem: any planar graph can be colored with four colors so that no edge is monochromatic (same color on both endpoints). You can color a map with four colors. Proof? 400 pages long. Too long for this course... or the exam. We proved a six color theorem for by induction on v. 17

Planar Graphs Can you draw the graph on paper so that no edges cross? If so, it s a planar graph. Euler s formula: v + f = e + 2. (how did we prove this? Induction on e. Remove cycle by removing edge.) Four color theorem: any planar graph can be colored with four colors so that no edge is monochromatic (same color on both endpoints). You can color a map with four colors. Proof? 400 pages long. Too long for this course... or the exam. We proved a six color theorem for by induction on v. Practice problems: try doing these proofs yourself (without looking at the old slides). 17

On coloring... Can you color a graph with three colors? Hard problem. Really hard! See why in CS170. 18

On coloring... Can you color a graph with three colors? Hard problem. Really hard! See why in CS170. People do try to approximate good colorings (for general graphs, not just planar) though. It s useful. 18

On coloring... Can you color a graph with three colors? Hard problem. Really hard! See why in CS170. People do try to approximate good colorings (for general graphs, not just planar) though. It s useful. For instance: if a program I m trying to compile that looks like this: a <- b + c; c <- a + b; z <- b - a; How many registers (memory) do I need to run this program? 18

On coloring... Can you color a graph with three colors? Hard problem. Really hard! See why in CS170. People do try to approximate good colorings (for general graphs, not just planar) though. It s useful. For instance: if a program I m trying to compile that looks like this: a <- b + c; c <- a + b; z <- b - a; How many registers (memory) do I need to run this program? Draw a graph and try to approximate the optimal coloring! Each color is a register. Register optimization! Touched on in CS164. 18

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. Number of edges? n2 n 1 = O( V log V ). Recursively: Start with a point. Dimension 0 hypercube. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. Number of edges? n2 n 1 = O( V log V ). Recursively: Start with a point. Dimension 0 hypercube.get a dimension 1 hypercube by taking two points and connecting them. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. Number of edges? n2 n 1 = O( V log V ). Recursively: Start with a point. Dimension 0 hypercube.get a dimension 1 hypercube by taking two points and connecting them. Get dimension 2 hypercube by taking two dimension 1 hypercubes and connecting corresponding vertices. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. Number of edges? n2 n 1 = O( V log V ). Recursively: Start with a point. Dimension 0 hypercube.get a dimension 1 hypercube by taking two points and connecting them. Get dimension 2 hypercube by taking two dimension 1 hypercubes and connecting corresponding vertices. Get dimension n + 1 hypercube by taking two dimension n hypercubes and connecting corresponding edges. 19

Hypercubes Hypercubes. G = {V,E}. V = {0,1} n. E = {(u,v) u and v differ by exactly one bit position}. Number of vertices? 2 n. Number of edges? n2 n 1 = O( V log V ). Recursively: Start with a point. Dimension 0 hypercube.get a dimension 1 hypercube by taking two points and connecting them. Get dimension 2 hypercube by taking two dimension 1 hypercubes and connecting corresponding vertices. Get dimension n + 1 hypercube by taking two dimension n hypercubes and connecting corresponding edges. 19

Hypercubes: Properties and Applications Shortest path from u to v? How many bits do they differ in? hamming distance. Each edge traversal is a bit flip. 2 https://blog.ethereum.org/2014/10/21/scalability-part-2-hypercubes/ 20

Hypercubes: Properties and Applications Shortest path from u to v? How many bits do they differ in? hamming distance. Each edge traversal is a bit flip. Dense cuts. If you want to cut off k vertices, you need to cut k edges. 2 https://blog.ethereum.org/2014/10/21/scalability-part-2-hypercubes/ 20

Hypercubes: Properties and Applications Shortest path from u to v? How many bits do they differ in? hamming distance. Each edge traversal is a bit flip. Dense cuts. If you want to cut off k vertices, you need to cut k edges.proof was by induction on the dimension. Also a good practice problem to go over this proof again. 2 https://blog.ethereum.org/2014/10/21/scalability-part-2-hypercubes/ 20

Hypercubes: Properties and Applications Shortest path from u to v? How many bits do they differ in? hamming distance. Each edge traversal is a bit flip. Dense cuts. If you want to cut off k vertices, you need to cut k edges.proof was by induction on the dimension. Also a good practice problem to go over this proof again. Ease of routing and difficulty to cut make hypercubes really useful for distributed systems. Hypercube topology to be very common in supercomputers: Intel ipsc, ncube. Now being used for routing messages in the Ethereum network. 2 2 https://blog.ethereum.org/2014/10/21/scalability-part-2-hypercubes/ 20

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. 21

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. Expected number of edges? ( n 2) p. We used this for probabilistic method proofs. 21

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. Expected number of edges? ( n 2) p. We used this for probabilistic method proofs. Random walks on undirected graphs. Take a graph and turn it into a Markov chain. Vertices are states. Transition to any neighboring state with uniform probability. 21

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. Expected number of edges? ( n 2) p. We used this for probabilistic method proofs. Random walks on undirected graphs. Take a graph and turn it into a Markov chain. Vertices are states. Transition to any neighboring state with uniform probability. Irreducible if graph is connected. Aperiodic if graph isn t bipartite. 21

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. Expected number of edges? ( n 2) p. We used this for probabilistic method proofs. Random walks on undirected graphs. Take a graph and turn it into a Markov chain. Vertices are states. Transition to any neighboring state with uniform probability. Irreducible if graph is connected. Aperiodic if graph isn t bipartite. Stationary distribution? deg(v)/2 E. Cover time? bounded by 4 V E. 21

Randomness and Graphs Random graphs. G n,p. n vertices. Each edge exists with probability p. Expected number of edges? ( n 2) p. We used this for probabilistic method proofs. Random walks on undirected graphs. Take a graph and turn it into a Markov chain. Vertices are states. Transition to any neighboring state with uniform probability. Irreducible if graph is connected. Aperiodic if graph isn t bipartite. Stationary distribution? deg(v)/2 E. Cover time? bounded by 4 V E. More review on this tomorrow. 21

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). 22

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). Each day: Each man proposes to the highest woman on his list who hasn t rejected him yet. Each woman rejects all but the best, whom she keeps on a string. 22

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). Each day: Each man proposes to the highest woman on his list who hasn t rejected him yet. Each woman rejects all but the best, whom she keeps on a string. Improvement lemma: If a woman has a man on a string: any future man who she has on a string is going to be at least as good. 22

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). Each day: Each man proposes to the highest woman on his list who hasn t rejected him yet. Each woman rejects all but the best, whom she keeps on a string. Improvement lemma: If a woman has a man on a string: any future man who she has on a string is going to be at least as good. TMA produces male optimal stable matching! Male optimal = best pairing for men among all possible matchings. Theorem: male optimal = female pessimal. 22

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). Each day: Each man proposes to the highest woman on his list who hasn t rejected him yet. Each woman rejects all but the best, whom she keeps on a string. Improvement lemma: If a woman has a man on a string: any future man who she has on a string is going to be at least as good. TMA produces male optimal stable matching! Male optimal = best pairing for men among all possible matchings. Theorem: male optimal = female pessimal. What about stable roommates? Nope. No stable pairing necessarily exists. 22

Stable Marriage and Matchings Want to match men and women in a stable manner. No rogue couples (people who would both rather be with each other than with their current partners). Each day: Each man proposes to the highest woman on his list who hasn t rejected him yet. Each woman rejects all but the best, whom she keeps on a string. Improvement lemma: If a woman has a man on a string: any future man who she has on a string is going to be at least as good. TMA produces male optimal stable matching! Male optimal = best pairing for men among all possible matchings. Theorem: male optimal = female pessimal. What about stable roommates? Nope. No stable pairing necessarily exists. Used in hospital residency matching systems. Matching in general is a well studied problem. Used in programs like kidney exchanges. 22

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 Selecting k TAs out of n to run a review session? (n k)! 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. Making a homework by selecting k problems from a set of n? 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. Making a homework by selecting k problems from a set of n? Order matters, without replacement. 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. Making a homework by selecting k problems from a set of n? Order matters, without replacement. Answering n multiple-choice questions, each with k options? 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. Making a homework by selecting k problems from a set of n? Order matters, without replacement. Answering n multiple-choice questions, each with k options? Order matters, with replacement. 23

Counting With replacement Without replacement Order matters n k n! ) ( Order doesn t matter n k) ( n+k 1 n 1 (n k)! Selecting k TAs out of n to run a review session? Order doesn t matter, without replacement. Polling k random people on the street in a city of population n? Order doesn t matter, with replacement. Making a homework by selecting k problems from a set of n? Order matters, without replacement. Answering n multiple-choice questions, each with k options? Order matters, with replacement. If you like counting, take Math 172. 23

Inclusion-Exclusion Number of things in A 1 A 2... A n? 24

Inclusion-Exclusion Number of things in A 1 A 2... A n? Add the cardinalities of all the sets... 24

Inclusion-Exclusion Number of things in A 1 A 2... A n? Add the cardinalities of all the sets...... and then subtract size of the unions of every pair of sets... 24

Inclusion-Exclusion Number of things in A 1 A 2... A n? Add the cardinalities of all the sets...... and then subtract size of the unions of every pair of sets...... and then add the size of the unions of every triplet of sets... 24

Inclusion-Exclusion Number of things in A 1 A 2... A n? Add the cardinalities of all the sets...... and then subtract size of the unions of every pair of sets...... and then add the size of the unions of every triplet of sets... And so on! 24

Uncountability What s countable and what s not? 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable Finite sets of countable sets. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable Finite sets of countable sets. countable 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable Finite sets of countable sets. countable Pairs of real numbers. 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable Finite sets of countable sets. countable Pairs of real numbers. uncountable 25

Uncountability What s countable and what s not? Countability: mappable to the natural numbers. Not everything is countable. Proof of uncountability: bijection with an uncountable set. Diagonalization. Proof of countability: bijection with a known countable set. Enumeration. Finite bitstrings. countable Programs that print CS70. countable Programs that loop infinitely. countable Finite sets of countable sets. countable Pairs of real numbers. uncountable Graphs. 25