6.042/18.] Mathematics for Computer Science February 3, 2005 Srini devadas and Eric Lehman Lecture notes Proof Why do you believe that 3+3=6? Is it because your second-grade teacher, Miss Dalrymple, told you so? She might have been lying, you know Or are you trusting life experience? If you have three coconuts and someone gives you three more coconuts, then you have--ahal--six coconuts. But if that is the true basis for your belief, then why do you also believe that 3,000,000,000+3,000,000,000=6,000,000,000 Surely youve never actually counted six billion of anything Maybe 3+3=6 is just"intuitively obvious", and we shouldnt talk about it anymore Hey, here is a game! I secretly put one or more dollar bills into an envelope and then put twice as many dollar bills into a second envelo n n I seal both envelopes, mix them up, and present them to you. You can pick one and look inside to see how much money it contains. Then you can either take the money in that envelope or take the unknown amount of money in the other envelope. Those are the rules. For example, suppose we play this game and you find $8 in the envelope you initially selected $8 ? What is your most profitable course? Keep the $8? Or take the unknown amount in he other envelope? Are both options equally good? This situation is hardly more com licated than having three coconuts and being given three more. Yet now the correct conclusion is far from"intuitively obvious". Seemingly plausible arguments about this problem degenerate to absurdities and contradictions So you may want to dismiss 3+3=6 and hurry along, but eventually we do have to confront the underlying question: how can we know anything in mathematics? When intuition falters as a guide to truth, how can we distinguish valid mathematics from crack pot ravings? These are show-stopper questions. Without clear answers, all the number crunching and variable juggling in mathematics is just so much nonsense
6.042/18.062J Mathematics for Computer Science February 3, 2005 Srini Devadas and Eric Lehman Lecture Notes Proofs Why do you believe that 3 + 3 = 6? Is it because your secondgrade teacher, Miss Dalrymple, told you so? She might have been lying, you know. Or are you trusting life experience? If you have three coconuts and someone gives you three more coconuts, then you have— aha!— six coconuts. But if that is the true basis for your belief, then why do you also believe that 3, 000, 000, 000 + 3, 000, 000, 000 = 6, 000, 000, 000? Surely you’ve never actually counted six billion of anything! Maybe 3 + 3 = 6 is just “intuitively obvious”, and we shouldn’t talk about it anymore. Hey, here is a game! I secretly put one or more dollar bills into an envelope and then put twice as many dollar bills into a second envelope: $n $2n I seal both envelopes, mix them up, and present them to you. You can pick one and look inside to see how much money it contains. Then you can either take the money in that envelope or take the unknown amount of money in the other envelope. Those are the rules. For example, suppose we play this game and you find $8 in the envelope you initially selected. $8 ? What is your most profitable course? Keep the $8? Or take the unknown amount in the other envelope? Are both options equally good? This situation is hardly more complicated than having three coconuts and being given three more. Yet now the correct conclusion is far from “intuitively obvious”. Seemingly plausible arguments about this problem degenerate to absurdities and contradictions. So you may want to dismiss 3 + 3 = 6 and hurry along, but eventually we do have to confront the underlying question: how can we know anything in mathematics? When intuition falters as a guide to truth, how can we distinguish valid mathematics from crackpot ravings? These are showstopper questions. Without clear answers, all the number crunching and variable juggling in mathematics is just so much nonsense
The Two-Envelopes game Here are some "solutions You picked an envelope at random, so you were just as likely to pick the one with more dollars as the one with fewer. Therefore if you see $8 then the other envelope is equally likely to contain either $4 or $ 16. On average, the other envelope contains(4+16)/2= 10 dollars, which is more than the $8 you see. So you should clearly switch to the unopened envelope However, a similar argument applies no matter what amount you see initially So you should always switch, regardless of the amount in the first envelope Thus, the best strategy is to pick one envelope and then, without even bothering to look inside, take the amount of money in the other. But that's absurd You were just as likely to pick the envelope with more dollars as with fewer So, on average, the amount of money in the envelope you picked is the same as the amount in the unopened envelope. So staying or switching makes no difference But what if you saw $1? In that case, you could be certain that the other enve- lope contained $2. So your strategy would make a difference Look at the problem from my perspective. Clearly, I should not put $1 in either envelope; that would give you a big advantage. If you opened the envelope with $l, then you would know to switch. But then if you see $2 in an envelope, you know that the other envelope must contain $4 since we just ruled out $1. So you also have a big advantage in this situation. My only choice is to never put $2 in an envelope either. And I cant use $3; if you saw that, you'd know the other envelope held $6. And if you see $4, you know the other envelope must contain $8. Apparently, I can t run the game at all! Were revisit this problem later in the term when we study probability
2 Proofs The TwoEnvelopes Game Here are some “solutions”: • You picked an envelope at random, so you were just as likely to pick the one with more dollars as the one with fewer. Therefore, if you see $8, then the other envelope is equally likely to contain either $4 or $16. On average, the other envelope contains (4 + 16)/2 = 10 dollars, which is more than the $8 you see. So you should clearly switch to the unopened envelope. However, a similar argument applies no matter what amount you see initially. So you should always switch, regardless of the amount in the first envelope. Thus, the best strategy is to pick one envelope and then, without even bothering to look inside, take the amount of money in the other. But that’s absurd! • You were just as likely to pick the envelope with more dollars as with fewer. So, on average, the amount of money in the envelope you picked is the same as the amount in the unopened envelope. So staying or switching makes no difference. But what if you saw $1? In that case, you could be certain that the other envelope contained $2. So your strategy would make a difference! • Look at the problem from my perspective. Clearly, I should not put $1 in either envelope; that would give you a big advantage. If you opened the envelope with $1, then you would know to switch. But then if you see $2 in an envelope, you know that the other envelope must contain $4 since we just ruled out $1. So you also have a big advantage in this situation. My only choice is to never put $2 in an envelope either. And I can’t use $3; if you saw that, you’d know the other envelope held $6. And if you see $4, you know the other envelope must contain $8. Apparently, I can’t run the game at all! We’re revisit this problem later in the term when we study probability
Proofs 1 The axiomatic Method The standard procedure for establishing truth in mathematics was invented by Euclid,a mathematician working in Alexadria, Egypt around 300 BC. His idea was to begin with five assumptions about geometry, which seemed undeniable based on direct experience (For example, There is a straight line segment between every pair of points. )Proposi tions like these that are simply accepted as true are called axioms Starting from these axioms, Euclid established the truth of many additional proposi tions by providing proofs". A proof is a sequence of logical deductions from axioms and previously-proved statements that concludes with the proposition in question. You probably wrote many proofs in high school geometry class, and you'll see a lot more in this course There are several common terms for a proposition that has been proved. The different terms hint at the role of the proposition within a larger body of work Important propositions are called theorems A lemma is a preliminary proposition useful for proving later propositions A corollary is an afterthought, a proposition that follows in just a few logical steps from a theorem The definitions are not precise. In fact, sometimes a good lemma turns out to be far more important than the theorem it was originally used to prove Euclids axiom-and-proof approach, now called the axiomatic method, is the founda- tion for mathematics today. Amazingly, essentially all mathematics can be derived from just a handful of axioms called ZFC together with a few logical principles. This does not completely settle the question of truth in mathematics, but it greatly focuses the issue You can still deny a mathematical theorem, but only if you reject one of the elementary ZFC axioms or find a logical error in the proof 1.1 Our Axioms For our purposes, the ZFC axioms are too primitive- by one reckoning, proving that 2+2=4 requires more than 20,000 steps! So instead of starting with ZFC, were going to take a huge set of axioms as our foundation: we'll accept all familiar facts from high school math This will give us a quick launch, but you will find this imprecise specification of the axioms troubling at times. For example, in the midst of a proof, you may find yourself wondering, " Must I prove this little fact or can I take it as an axiom? Feel free to ask for guidance, but really there is no absolute answer. Just be upfront about what you're assuming, and don' t try to evade homework and exam problems by declaring everything an axiom
Proofs 3 1 The Axiomatic Method The standard procedure for establishing truth in mathematics was invented by Euclid, a mathematician working in Alexadria, Egypt around 300 BC. His idea was to begin with five assumptions about geometry, which seemed undeniable based on direct experience. (For example, “There is a straight line segment between every pair of points.) Propositions like these that are simply accepted as true are called axioms. Starting from these axioms, Euclid established the truth of many additional propositions by providing “proofs”. A proof is a sequence of logical deductions from axioms and previouslyproved statements that concludes with the proposition in question. You probably wrote many proofs in high school geometry class, and you’ll see a lot more in this course. There are several common terms for a proposition that has been proved. The different terms hint at the role of the proposition within a larger body of work. • Important propositions are called theorems. • A lemma is a preliminary proposition useful for proving later propositions. • A corollary is an afterthought, a proposition that follows in just a few logical steps from a theorem. The definitions are not precise. In fact, sometimes a good lemma turns out to be far more important than the theorem it was originally used to prove. Euclid’s axiomandproof approach, now called the axiomatic method, is the foundation for mathematics today. Amazingly, essentially all mathematics can be derived from just a handful of axioms called ZFC together with a few logical principles. This does not completely settle the question of truth in mathematics, but it greatly focuses the issue. You can still deny a mathematical theorem, but only if you reject one of the elementary ZFC axioms or find a logical error in the proof. 1.1 Our Axioms For our purposes, the ZFC axioms are too primitive— by one reckoning, proving that 2 + 2 = 4 requires more than 20,000 steps! So instead of starting with ZFC, we’re going to take a huge set of axioms as our foundation: we’ll accept all familiar facts from high school math! This will give us a quick launch, but you will find this imprecise specification of the axioms troubling at times . For example, in the midst of a proof, you may find yourself wondering, “Must I prove this little fact or can I take it as an axiom?” Feel free to ask for guidance, but really there is no absolute answer. Just be upfront about what you’re assuming, and don’t try to evade homework and exam problems by declaring everything an axiom!
The ZFC Axioms omitted. The variables denote distinct sets. Essentially all of mathematics can These are the axioms of Zermelo-Fraenkel set theory with some technicaliti derived from these axioms together with a few principles of logic Extensionality. Sets are equal if they contain the same elements 2(2∈x兮z∈y)→x=y Union. The union of a collection of sets is also a set yvz(u(z∈∧∈x)→z∈y) Infinity. There is an infinite set; specifically, a set contained in the union of its ele- ments y(r(x∈y)∧z(z∈y→3u(z∈∧∈y) Power Set. All subsets of a set form another set y(v(∈z→t∈x)→z∈y) Replacement. The image of a function is a set vyz(0(,2)→2=y)→32(z∈y分3(∈x∧叭(m,z) Regularity. Every nonempty set contains a set disjoint from itself y(y∈x)→(y∈xAVz(z∈y→nz∈x) Choice. We can pick one element from each set in a collection yav(∈A∈x)→3u((∈uA∈t)∧(u∈tAt∈y)分u=v) Were not going to be working with the ZFC axioms in this course. We just thought you might like to see them
4 Proofs The ZFC Axioms These are the axioms of ZermeloFraenkel set theory with some technicalities omitted. The variables denote distinct sets. Essentially all of mathematics can be derived from these axioms together with a few principles of logic. Extensionality. Sets are equal if they contain the same elements: ∀z(z ∈ x ⇔ z ∈ y) ⇒ x = y Union. The union of a collection of sets is also a set: ∃y∀z(∃w(z ∈ w ∧ w ∈ x) ⇒ z ∈ y) Infinity. There is an infinite set; specifically, a set contained in the union of its elements. ∃y(∃x(x ∈ y) ∧ ∀z(z ∈ y ⇒ ∃w(z ∈ w ∧ w ∈ y))) Power Set. All subsets of a set form another set. ∃y∀z(∀w(w ∈ z ⇒ w ∈ x) ⇒ z ∈ y) Replacement. The image of a function is a set. ∀w∃y∀z(φ(w, z) ⇒ z = y) ⇒ ∃y∀z(z ∈ y ⇔ ∃w(w ∈ x ∧ φ(w, z))) Regularity. Every nonempty set contains a set disjoint from itself. ∃y(y ∈ x) ⇒ ∃y(y ∈ x ∧ ∀z(z ∈ y ⇒ ¬z ∈ x)) Choice. We can pick one element from each set in a collection. ∃y∀z∀w((z ∈ w ∧ w ∈ x) ⇒ ∃v∃u(∃t((u ∈ w ∧ w ∈ t) ∧ (u ∈ t ∧ t ∈ y)) ⇔ u = v)) We’re not going to be working with the ZFC axioms in this course. We just thought you might like to see them
Proofs 1.2 Proofs in practice n principle, a proof can be any sequence of logical deductions from axioms and previously- proved statements that concludes with the proposition in question. This freedom in con- structing a proof can seem overwhelming at first. How do you even start a proof? Here's the good news: many proofs follow one of a handful of standard templates Proofs all differ in the details, of course, but these templates at least provide you with an outline to fill in. Well go through several of these standard patterns, pointing out the basic idea and common pitfalls and giving some examples. Many of these templates fit ogether; one may give you a top-level outline while others help you at the next level of detail. And well show you other, more sophisticated proof techniques later on The recipes below are very specific at times, telling you exactly which words to write down on your piece of paper. You're certainly free to say things your own way instead were just giving you something you could say so that you're never at a complete loss 2 Proving an implication An enormous number of mathematical claims have the form "If P, then Q"or, equiva lently, "P implies Q". Here are some examples ·( Quadratic Formula)fax2+bx+c=0anda≠O, then x=(-b± 4ac)/2a . Goldbach's Conjecture)If n is an even integer greater than 2, then n is a sum of two rimes ·If00. There are a couple standard methods for proving an implication 2.1 Method #1 In order to prove that P implies Q 1. Write,"Assume p 2. Show that Q logically follows
� Proofs 5 1.2 Proofs in Practice In principle, a proof can be any sequence of logical deductions from axioms and previouslyproved statements that concludes with the proposition in question. This freedom in constructing a proof can seem overwhelming at first. How do you even start a proof? Here’s the good news: many proofs follow one of a handful of standard templates. Proofs all differ in the details, of course, but these templates at least provide you with an outline to fill in. We’ll go through several of these standard patterns, pointing out the basic idea and common pitfalls and giving some examples. Many of these templates fit together; one may give you a toplevel outline while others help you at the next level of detail. And we’ll show you other, more sophisticated proof techniques later on. The recipes below are very specific at times, telling you exactly which words to write down on your piece of paper. You’re certainly free to say things your own way instead; we’re just giving you something you could say so that you’re never at a complete loss. 2 Proving an Implication An enormous number of mathematical claims have the form “If P, then Q” or, equivalently, “P implies Q”. Here are some examples: • (Quadratic Formula) If ax2 + bx + c = 0 and a = 0, then x = (−b ± √b2 − 4ac)/2a. • (Goldbach’s Conjecture) If n is an even integer greater than 2, then n is a sum of two primes. • If 0 ≤ x ≤ 2, then −x3 + 4x + 1 > 0. There are a couple standard methods for proving an implication. 2.1 Method #1 In order to prove that P implies Q: 1. Write, “Assume P.” 2. Show that Q logically follows
Example Theorem1.Jf0≤x≤2,then-x3+4x+1>0. Before we write a proof of this theorem, we have to do some scratchwork to figure out why it is true The inequality certainly holds for a =0; then the left side is equal to 1 and 1>0.As grows, the 4r term(which is positive) initially seems to have greater magnitude than (which is negative). For example, when a= l, we have 4r=4, but- 3=-1 only. In fact, it looks like doesn t begin to dominate until r>2. So it seems the -+4c part should be nonnegative for all z between 0 and 2, which would imply that -r+4.r+1 So far, so good. But we still have to replace all those"seems like"phrases with solid, logical arguments. We can get a better handle on the critical- r +4.r part by factoring it, which is not too hard 4x2=x(2-x)(2+x) Aha! For r between 0 and 2, all of the terms on the right side are nonnegative. And a product of nonnegative terms is also nonnegative. Let's organize this blizzard of obser vations into a clean proof Proof. Assume0 0 Multiplying out on the left side proves that x3+4x+1>0 as claimed There are a couple points here that apply to all proofs You'll often need to do some scratchwork while you're trying to figure out the lsso y ical steps of aproof. Your scratchwork can be as disorganized as you like-full dead-ends, strange diagrams, obscene words, whatever. But keep your scratchwork separate from your final proof, which should be clear and concise Proofs typically begin with the word"Proof"and end with some sort of doohickey like d or"qe d". The only purpose for these conventions is to clarify where proof begin and end
6 Proofs Example Theorem 1. If 0 ≤ x ≤ 2, then −x3 + 4x + 1 > 0. Before we write a proof of this theorem, we have to do some scratchwork to figure out why it is true. The inequality certainly holds for x = 0; then the left side is equal to 1 and 1 > 0. As x 3 grows, the 4x term (which is positive) initially seems to have greater magnitude than −x 3 (which is negative). For example, when x = 1, we have 4x = 4, but −x = −1 only. In fact, it looks like −x3 doesn’t begin to dominate until x > 2. So it seems the −x3 + 4x part should be nonnegative for all x between 0 and 2, which would imply that −x3 + 4x + 1 is positive. So far, so good. But we still have to replace all those “seems like” phrases with solid, logical arguments. We can get a better handle on the critical −x3 + 4x part by factoring it, which is not too hard: 2 −x 3 + 4x = x(2 − x)(2 + x) Aha! For x between 0 and 2, all of the terms on the right side are nonnegative. And a product of nonnegative terms is also nonnegative. Let’s organize this blizzard of observations into a clean proof. Proof. Assume 0 ≤ x ≤ 2. Then x, 2 − x, and 2 + x are all nonnegative. Therefore, the product of these terms is also nonnegative. Adding 1 to this product gives a positive number, so: x(2 − x)(2 + x) + 1 > 0 Multiplying out on the left side proves that −x 3 + 4x + 1 > 0 as claimed. There are a couple points here that apply to all proofs: • You’ll often need to do some scratchwork while you’re trying to figure out the logical steps of aproof. Your scratchwork can be as disorganized as you like— full of deadends, strange diagrams, obscene words, whatever. But keep your scratchwork separate from your final proof, which should be clear and concise. • Proofs typically begin with the word “Proof” and end with some sort of doohickey like � or “q.e.d”. The only purpose for these conventions is to clarify where proofs begin and end
Proofs 2.2 Method #2-Prove the Contrapositive Remember that an implication("P implies Q") is logically equivalent to its contrapos itive("not Q implies not P); proving one is as good as proving the other. And often proving the contrapositive is easier than proving the original statement. If so, then you can proceed as follows 1. Write, We prove the contrapositive: and then state the contrapositive 2. Proceed as in Method #1 Example Theorem 2. If r is irrational, then Vr is also irrational Recall that rational numbers are equal to a ratio of integers and irrational numbers are not. So we must show that if r is not a ratio of integers, then vr is also not a ratio of integers. That's pretty convoluted! We can eliminate both"not"s and make the proof straightforward by considering the contrapositive instead Proof. We prove the contrapositive: if Vr is rational, then r is rational Assume that Vr is rational. Then there exists integers a and b such that Squaring both sides give Since a2 and b2 are integers, r is also rational 3 A Bogus Technique: Reasoning Backward Somewhere out in America there must be dozens of high school teachers whispering into innocent ears that"reasoning backward"in proofs is fine.oh, yes, jusssst fine. Probably they sacrifice little furry animals on moonless nights, too. In any case, they re wrong Let's use the utterly incorrect, but depressingly popular technique of reasoning back ward to"prove"a famous inequalit Theorem 3(Arithmetic-Geometric Mean Inequality) For all nonnegative real numbers a
Proofs 7 2.2 Method #2 Prove the Contrapositive Remember that an implication (“P implies Q”) is logically equivalent to its contrapositive (“not Q implies not P”); proving one is as good as proving the other. And often proving the contrapositive is easier than proving the original statement. If so, then you can proceed as follows: 1. Write, “We prove the contrapositive:” and then state the contrapositive. 2. Proceed as in Method #1. Example Theorem 2. If r is irrational, then √r is also irrational. Recall that rational numbers are equal to a ratio of integers and irrational numbers are not. So we must show that if r is not a ratio of integers, then √r is also not a ratio of integers. That’s pretty convoluted! We can eliminate both “not”’s and make the proof straightforward by considering the contrapositive instead. Proof. We prove the contrapositive: if √r is rational, then r is rational. Assume that √r is rational. Then there exists integers a and b such that: √ a r = b Squaring both sides gives: 2 a r = b2 Since a2 and b2 are integers, r is also rational. 3 A Bogus Technique: Reasoning Backward Somewhere out in America there must be dozens of high school teachers whispering into innocent ears that “reasoning backward” in proofs is fine... oh, yes, jusssst fine. Probably they sacrifice little furry animals on moonless nights, too. In any case, they’re wrong. Let’s use the utterly incorrect, but depressingly popular technique of reasoning backward to “prove” a famous inequality. Theorem 3 (ArithmeticGeometric Mean Inequality). For all nonnegative real numbers a and b: a + b √ ab 2 ≥
Proof a+b>2ab a2+2ab+62>4ab a2-2ab+b2>0 The last statement is true because the square of a real number(such as a-b)is never negative. This proves the claim In this argument, we started with what we wanted to prove and then reasoned until we reached a statement that is surely true. The little question marks, I guess, are supposed to indicate that were not quite certain that the inequalities are valid until we get down te the last step. At that point, we know everything checks out, apparently 3.1 Why reasoning backward Is bad In reasoning backward, we began with the proposition in question-call it P-and rea- soned to a true conclusion. Thus, what we actually proved is P→true But this implication is trivially true, regardless of whether P is true or false! Therefore, by rea soning backward we can"prove"not only true statements but also every false statement! Heres an exampl Claim.0=1 Proof 0=1 2 So resist the urge to reason backward. If this keeps happening to you anyway, pound your writing hand with a heavy textbook to make it stop Shout"WRONG! WRONG! with each blow
8 Proofs Proof. a + b 2 a + b a 2 + 2ab + b2 ? ≥ √ ab ? √ ≥ 2 ab ? ≥ 4ab ? a ≥ 0 2 − 2ab + b2 (a − b) 2 ≥ 0 The last statement is true because the square of a real number (such as a − b) is never negative. This proves the claim. × In this argument, we started with what we wanted to prove and then reasoned until we reached a statement that is surely true. The little question marks, I guess, are supposed to indicate that we’re not quite certain that the inequalities are valid until we get down to the last step. At that point, we know everything checks out, apparently. 3.1 Why Reasoning Backward Is Bad In reasoning backward, we began with the proposition in question— call it P— and reasoned to a true conclusion. Thus, what we actually proved is: P ⇒ true But this implication is trivially true, regardless of whether P is true or false! Therefore, by reasoning backward we can “prove” not only true statements, but also every false statement! Here’s an example: Claim. 0 = 1 Proof. 0 0 · 0 ? = 1 ? = 1 · 0 0 = 0 × So resist the urge to reason backward. If this keeps happening to you anyway, pound your writing hand with a heavy textbook to make it stop. Shout “WRONG! WRONG!” with each blow
Proofs 3.2 Reasoning Backward as Scratchwork Sometimes you might want to try reasoning backward- but not in a proof. In particular, when you're trying to find a proof, you'll often do some scratchwork as you explore dif- ferent approaches and ideas. In this context, reasoning backward is reasonable. You might then be able to reverse the order of the steps and get a valid proof 4 Proving an " If and only if Many mathematical theorems assert that two statements are logically equivalent; that is, one holds if and only if the other does. Here are some examples An integer is a multiple of 3 if and only if the sum of its digits is a multiple of 3 Two triangles have the same side lengths if and only if all angles are the same a positive integer p≥2 is prime if and only if1+(p-1)·(P-2)…3:2·1isa multiple of p 4.1 Method #1: Prove Each Statement Implies the Other The statement"P if and only if Q " is equivalent to the two statements"P implies Q"and Q implies P". So you can prove an"if and only if" by proving two implications 1. Write, We prove P implies Q and vice-versa 2. Write,First, we show P implies Q. do this by one of the methods in Section 2 3. Write, Now, we show Q implies P. Again, do this by one of the methods in Example Two sets are defined to be equal if they contain the same elements; that is, X=Y means a E X if and only if z E r. This is actually the first of the ZFC axioms. )So set equivalence proofs often have an"if and only if"structure Theorem 4 (DeMorgan's Law for Sets). Let A, B, and C be sets. Then A∩(BUC)=(A∩B)U(A∩C
Proofs 9 3.2 Reasoning Backward as Scratchwork Sometimes you might want to try reasoning backward— but not in a proof. In particular, when you’re trying to find a proof, you’ll often do some scratchwork as you explore different approaches and ideas. In this context, reasoning backward is reasonable. You might then be able to reverse the order of the steps and get a valid proof. 4 Proving an “If and Only If” Many mathematical theorems assert that two statements are logically equivalent; that is, one holds if and only if the other does. Here are some examples: • An integer is a multiple of 3 if and only if the sum of its digits is a multiple of 3. • Two triangles have the same side lengths if and only if all angles are the same. • A positive integer p ≥ 2 is prime if and only if 1 + (p − 1) · (p − 2)· · · 3 · 2 · 1 is a multiple of p. 4.1 Method #1: Prove Each Statement Implies the Other The statement “P if and only if Q” is equivalent to the two statements “P implies Q” and “Q implies P”. So you can prove an “if and only if” by proving two implications: 1. Write, “We prove P implies Q and viceversa.” 2. Write, “First, we show P implies Q.” Do this by one of the methods in Section 2. 3. Write, “Now, we show Q implies P.” Again, do this by one of the methods in Section 2. Example Two sets are defined to be equal if they contain the same elements; that is, X = Y means z ∈ X if and only if z ∈ Y . (This is actually the first of the ZFC axioms.) So set equivalence proofs often have an “if and only if” structure. Theorem 4 (DeMorgan’s Law for Sets). Let A, B, and C be sets. Then: A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Pro0. We show 2∈A∩(BUC) implies z∈(AnB)U( AnC) and vice-versa First, we show z∈A∩(BUO) implies z∈(AnB)∪(AnC). Assume z∈An(BUC) Then z is in A and z is also in B or C. Thus, z is in either AnB or Anc, which implies z∈(A∩B)∪(A∩C) Now, we show z∈(AnB)u(AnC) ) implies z∈An(BUC). Assume z∈(A∩B)∪(AnC) Then z is in both A and b or else z is in both a and C. Thus, z is in a and z is also in b or C. This implies z∈A∩(BUC) 4.2 Method #2: Construct a Chain of lffs In order to prove that P is true if and only if Q is true 1. Write, We construct a chain of if-and-only-if implications 2. Prove p is lent to a second statement which is equivalent to a third staement and so forth until you reach Q This method is generally more difficult than the first, but the result can be a short, elegant proof Example The standard deviation of a sequence of values T1, 2, .. n is defined to be √(x1-p)2+(x1-p)2+…+(xn-p)2 where u is the average of the values: Theorem 5. The standard deviation of a sequence of values 1, .. n is zero if and only if all th values are equal to the mean For example, the standard deviation of test scores is zero if and only if everyone scored exactly the class average Proof. We construct a chain of"if and only if"implications. The standard deviation of C1,...,In is zero if and only if √(x1-1)2+(x1-p)2+…+(x1n-p)2 where u is the average of 1, .. In. This equation holds if and only if (x1-1)2+(x1-1)2+…+(xn-p)2=0 since zero is the only number whose square root is zero. Every term in this equation is nonnegative, so this equation holds if and only every term is actually 0. But this is true if and only if every value ri is equal to the mean u
� � 10 Proofs Proof. We show z ∈ A ∩ (B ∪ C) implies z ∈ (A ∩ B) ∪ (A ∩ C) and viceversa. First, we show z ∈ A ∩(B ∪ C) implies z ∈ (A ∩ B)∪(A ∩ C). Assume z ∈ A ∩(B ∪ C). Then z is in A and z is also in B or C. Thus, z is in either A ∩ B or A ∩ C, which implies z ∈ (A ∩ B) ∪ (A ∩ C). Now, we show z ∈ (A∩B)∪(A∩C) implies z ∈ A∩(B∪C). Assume z ∈ (A∩B)∪(A∩C). Then z is in both A and B or else z is in both A and C. Thus, z is in A and z is also in B or C. This implies z ∈ A ∩ (B ∪ C). 4.2 Method #2: Construct a Chain of Iffs In order to prove that P is true if and only if Q is true: 1. Write, “We construct a chain of ifandonlyif implications.” 2. Prove P is equivalent to a second statement which is equivalent to a third staement and so forth until you reach Q. This method is generally more difficult than the first, but the result can be a short, elegant proof. Example The standard deviation of a sequence of values x1, x2, . . . , xn is defined to be: 2 (x1 − µ)2 + (x1 − µ)2 + . . . + (xn − µ) where µ is the average of the values: x1 + x2 + . . . + xn µ = n Theorem 5. The standard deviation of a sequence of values x1, . . . , xn is zero if and only if all the values are equal to the mean. For example, the standard deviation of test scores is zero if and only if everyone scored exactly the class average. Proof. We construct a chain of “if and only if” implications. The standard deviation of x1, . . . , xn is zero if and only if: (x1 − µ)2 + (x1 − µ)2 + . . . + (xn − µ)2 = 0 where µ is the average of x1, . . . , xn. This equation holds if and only if 2 (x1 − µ) 2 + (x1 − µ) + . . . + (xn − µ) 2 = 0 since zero is the only number whose square root is zero. Every term in this equation is nonnegative, so this equation holds if and only every term is actually 0. But this is true if and only if every value xi is equal to the mean µ