Week 1: Logic Lecture 1, 8/1 (Sections 1.1 and 1.3) Examples of theorems and proofs Theorem (Pythagoras). Let ABC be a right triangle, with legs of lengths a and b, and hypotenuse of length c. Then a + b = c. Proof. Proof by picture. Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1). Proof. If n is even, add the numbers in pairs: 1 + n, + (n 1), 3 + (n ), and so on. Each sum is n + 1 and the number of pairs is n n(n+1), so the sum of all the numbers is. If n is odd, pairing up the numbers as before leaves the middle number n+1 unpaired. There are n 1 pairs, so the sum of all the numbers is (n 1)(n+1) + n+1 = n(n+1). Introduction to logic Proposition: a statement that is either true or false, not both. For instance: Horses are mammals or 1 + = 7. Ask for more examples! The truth value of a proposition is written as either T (true) or F (false). Propositional variables: We use letters like P and Q to represent arbitrary propositions. Their truth values can vary because the propositions they represent vary. Draw truth tables for the following propositions as they are introduced. Not : Given a proposition P, we write P ( not P ) for the new proposition It is not true that P. For instance, Horses are not mammals or 1 + 7. P is true whenever P is false, and vice versa. And : The proposition P Q ( P and Q ) is true when both P and Q are true, and false otherwise. For example, Horses are mammals and 1 + = 7 is a false statement because 1 + = 7 is false. Or : The proposition P Q ( P or Q ) is true when either P or Q (or both) are true and false when both P and Q are false. Let me emphasize that the logical or is true even when both P and Q are true. Unlike the logical or, we sometimes use or in everyday language to express a choice between two options: I will buy you a lollipop or I will buy you a Honeycrisp apple, with the intention that you can t have both. But this is ambiguous, and it s better to say either... or... if this is intended. Implies : The proposition P = Q ( P implies Q or if P, then Q ; sometimes denoted P Q ) is true except in the case when P is true and Q is false. A father might say to his daughter: My dear, if you get an A in astrophysics, then I will buy you a bicycle. When has the father upheld his word? If the daughter gets an A and father buys the bike, then all is well. If the daughter fails to get an A, then father need not buy a bike, though he might get it anyway as consolation. But if the daughter gets the A and father does not buy her the bicycle, then the daughter has a reason to be upset, and we would say daddy has been dishonest. 1
The converse of P = Q is Q = P. This is very different! Look at the truth tables. The contrapositive of P = Q is Q = P, and is equivalent to P = Q (the two propositions have the same truth table!). If and only if : P Q ( P if and only if Q, or P iff Q, or P is equivalent to Q ) is true if P and Q have the same truth value, and false otherwise. For instance P (P P ) is always true. Think of the proposition I will move to India if and only if you will move to India. I am claiming that we will either move together or not at all, and I will be wrong if one of us goes while the other stays. De Morgan s Laws, (P Q) P Q and (P Q) P Q are always true (prove using truth tables).
Lecture, 8/3 (Sections 1.4 and 1.6) Propositions involving variables A statement containing a variable, like x is greater than 3, is not a proposition since its truth value depends on the value of the variable. The variable x is the subject of the predicate (property) is greater than 3. A statement like x > 3 is a propositional function, denoted P (x), which becomes a proposition when you plug in a value for x, and then has a truth value. Note: I ll say much more about functions in the next two weeks. Propositional functions can have many input variables, such as the statement x = y + 3, which we could denote Q(x, y). (Think of values for x and y making the statement true, and values making it false.) Another way to turn a statement involving variables into a proposition is to use quantifiers. For this we need to specify what values of each variable are allowed, which we call its domain. For example, two possible domains for x that would make the statement x > 3 make sense are Z and R. Universal quantifier: x P (x) is the proposition that for all x in the domain, P (x) is true. For instance, x (x > 3) is true if the domain is integers 4, but false if it is integers 3 (we say 3 is a counterexample since 3 > 3 is false). Existential quantifier: x P (x) is the proposition that for at least one value of x in the domain, P (x) is true. For instance, x (x > 3) is true if the domain for x is all integers, but false if the domain is only negative integers. Arguments An argument is a sequence of propositions, called premises, followed by one additional proposition, called the conclusion. For instance, Premise 1: If you like tomatoes, you like pizza. Premise : You like tomatoes. Conclusion: You like pizza. In symbols, we can write this as Premise 1: P = Q Premise : P Conclusion: Q An argument is valid if the conclusion is true whenever all the premises are true. The above argument is valid (look at truth tables). The argument is not valid if we switch premise with the conclusion (homework problem!). Is the following argument using the universal quantifier valid? Premise 1: x ( P (x) = Q(x) ), x in some domain. Premise : Q(a), where a is a particular element in the domain. Conclusion: P (a). (Yes, it is. Prove using truth tables or contrapositive.) A silly valid argument: 3
Premise 1: P Premise : P Conclusion: Q. In words, this could be: (ask class for two propositions). If the premises lead to a contradiction, then the argument is guaranteed to be valid! 4
Week : Proofs Lecture 3, 8/8 (Sections 1.6 and 1.7) Review of argument, validity. Recall that an argument is valid when If all the premises are true, then the conclusion is true is always true. Rules of inference A compound proposition is a sentence built out of propositional variables (like P and Q), logical symbols (,,, =, ), and quantified propositional functions (like x P (x) and x Q(x)). A formal proof is used to show an argument is valid. One kind of proof is using a truth table, but this can get very complicated. A more useful method of proof is to construct a chain of implications from the premises to the conclusion, using rules of inference, which are tautologies (statements that are always true) of the form {compound proposition} = {compound proposition}. Examples of rules of inference (p. 7 and 76), each of which can be thought of as a small valid argument: (P Q) = P (1) P = (P Q) () ( (P Q) P ) = Q (3) ( (P = Q) P ) = Q (4) (P = Q) = ( Q = P ) (5) x P (x) = P (c), c any element of domain; (6) P (c) for arbitrary c = x P (x) (7) x P (x) = P (c) for some element c (8) P (c) for some element c = x P (x). (9) Think about what these are saying: most of them are obvious! Prove these for yourself using truth tables. Then you can apply them whenever you like! With these rules of inference, we can prove the validity of slightly more complicated arguments: Premise 1: P = Q Premise : Q Conclusion: P Proof. By (5), premise 1 implies that Q = P. Combining this with premise, (4) implies P. Premise 1: x (P (x) = Q(x)) 5
Premise : x P (x) Conclusion: x Q(x) Proof. By (8), premise implies P (c) for some element c. By (6), premise 1 implies P (c) = Q(c). By (4), P (c) and P (c) = Q(c) imply Q(c). Now we use (9) to conclude that x Q(x). Proofs in mathematics Mathematics begins with definitions and statements assumed to be true, called axioms or postulates. For example, the axioms of plane geometry. The starting point for this class: the integers, Z = {...,, 1, 0, 1,,... }, with the operations of addition (+) and multiplication ( ), and the real numbers R, with multiplication and addition. See (A1-A6) for a discussion of the axioms. A theorem is a valid argument (premises and conclusion). A proof is used to demonstrate the validity of a theorem. Starting with the premises of the theorem, one uses axioms and previously proved theorems as rules of inference to reach the conclusion. As theorems accumulate, mathematics grows ever lusher. Less important theorems are also called propositions, results, facts. A lemma is a theorem whose main importance is that it is used in the proof of other theorems. A corollary is a theorem that follows directly from another theorem. Definition 1. An integer n is even if there exists an integer k such that n = k, and odd if there exists an integer k such that n = k + 1 (note that n is either even or odd, but not both; think about how you would prove this!). Let s take a look at our first theorem! Theorem 1. If n is an odd integer, then n is odd. Is n is an odd integer a proposition? No! There is an implicit quantifier at work. In logical notation, let P (n) be the propositional function n is odd, where the domain for n is Z. As an argument, the theorem is No premises! Conclusion: n ( P (n) = P (n ) ). We saw earlier that to prove a n Q(n) claim, it suffices to show Q(n) for arbitrary n. So in terms of mathematics, we suppress the quantifier, think of n as arbitrary but fixed (so that P (n) is a proposition!), and the argument becomes Premise: No premises! Conclusion: P (n) = P (n ), which is logically the same as the more typical Premise: P (n). Conclusion: P (n ). How do we prove this argument is valid? 6
Lecture 4, 8/30 (more Section 1.7) Outline for writing proofs Step 1: Before you attempt a proof, convince yourself that the theorem is correct! Checking easy cases is often a good idea. Step : On scratch paper, write down the premises ( given ) at the top of the page, and the conclusion ( want ) at the bottom of the page. Make sure you know what you want to show before you try to show it! Step 3: Fill in the (both physical and logical) space between the given and want. Use definitions, axioms (mainly arithmetic in our case), and previously proved theorems to deduce the want from the given. This is an attempt at a direct proof: if you get stuck, try a proof by contraposition or contradiction instead (I ll define these terms below). Step 4: Once you have an outline of the proof on your scratch paper, convert it into precise, crisp English sentences. Label it proof, draw your favorite symbol at the end, and you have yourself a proof! In the theorem above, our given is that n is odd, namely that there exists an integer k such that n = k + 1. Our want is to show that n is odd, which means finding an integer j such that n = j + 1. How do we find this j? We need some way to use our information about n to deduce something about n. We have an equation for n, so square it! This gives us n = (k + 1) = 4k + 4k + 1 = (k + k) + 1. So setting j = k + k, which is an integer, we see that n = j + 1, so n is odd. So here is the theorem, with its proof: Theorem 1. If n is an odd integer, then n is odd. Proof. Since n is odd, there is an integer k such that n = k + 1. Then n = (k + 1) = 4k + 4k + 1 = (k + k) + 1. Since k + k is an integer, n is odd by definition. The preceding proof is called a direct proof. We started with the premise and deduced the conclusion. Sometimes direct proofs are difficult: Theorem. If n is an integer and n is odd, then n is odd. Attempt at a direct proof: n is odd, so n = k + 1. Thus n = ± k + 1. Now what? Instead, use a proof by contraposition, namely show the contrapositive is true (recall that an implication P = Q is logically equivalent to its contrapositive Q = P ). Proof. We prove the contrapositive, namely if n is even, then n is even. Since n is even, n = k for some integer k. Then n = (k) = 4k = (k ), so n is even by definition. Another useful type of proof is proof by contradiction. To prove P is true, it suffices to prove that ( P = Q) is true, where Q is a false statement. Because then if P is false, Q must be true, which it isn t. Theorem 3. If n is an integer, then it is either even or odd (not both). Proof. To see that every integer is even or odd, note that we can write the set of integers as {..., ( 1), ( 1) + 1, 0, (0 ) + 1, 1,... }. To see that an integer n cannot be both even and odd, we use a proof by contradiction. Assume for contradiction that n is even and odd. Since n is even, n = k for some integer k. Since n is odd, n = j + 1 for some integer j. Then k = j + 1, so (k j) = 1. Now there are three possibilities for k j: (1) k j 1. But then (k j), contradicting (k j) = 1. () k j = 0. But then (k j) = 0 1. (3) k j 1. But then (k j), contradicting (k j) = 1. So it cannot be that (k j) = 1. Thus our assumption, which led to the contradiction, must be false. So n cannot be both even and odd. 7
Week 3: More Proofs; Sets and Functions Lecture 5, 9/04 (even more Section 1.7) Next I will show you a famous proof by contradiction. The statement of the theorem requires a definition: Definition. A real number r is rational if there exist integers a and b with b 0 such that r = a/b. A real number that is not rational is called irrational. Rational numbers can be written in lowest terms, meaning r = a/b and a, b have no common factors. Theorem 4. is irrational. I don t know where to start for a direct proof, and proof by contraposition makes no sense here. But proof by contradiction works! This proof is more difficult than the other proofs in this section. Proof. Suppose for contradiction that the claim is false, so that is rational. Then = a b, and we may assume a and b are not both even (write the rational number in lowest terms). Squaring both sides gives = a b, or b = a. So a is even, from which it follows that a is even (contrapositive of Theorem 3!). Then a = k, so b = (k) = 4k. Dividing both sides by, we get b = k, so b is even. But this implies b is even, so we have shown that both a and b are even, which is a contradiction. Since assuming the claim was false led to a contradiction, the claim must be true. Proving equivalence. In math, we have many ways of saying the same thing. We can express the statement P = Q as: (i) P implies Q ; (ii) if P, then Q ; (iii) Q if P ; (iv) P only if Q; (v) P is sufficient for Q ; (vi) Q is necessary for P. For this reason, we can express P Q, which means P = Q and Q = P, as P if and only if Q or sometimes P is necessary and sufficient for Q. Theorem 5. An integer n is even if and only if n + is even. We need to prove n is even if n + is even (this means if n + is even, then n is even ) and n is even only if n + is even ( if n is even, then n + is even ). Proof. If n is even, then n = k for some integer k. Then n + = k + = (k + 1), so n + is even. On the other hand, if n + is even, then n + = k for some integer k. Thus n = k = (k 1), so n is even. 8
Lecture 6, 9/06 (Sections.1,.3) Sets and functions Definition 3. A set is an unordered collection of objects, called elements of the set. A set is said to contain its elements. If A is a set, we write a A to denote that a is an element of A, and a / A if a is not an element of A. To describe a set, either list all of its elements or state defining properties for an object to be in the set. Some examples of sets are: The set with no elements, called the empty set and denoted ; {kiwi, dragon, shark, turtle, penguin}; Z = {...,, 1, 0, 1,,... }, the set of integers; Z + = {1,, 3,... } = {n Z n 1}, the set of positive integers (sometimes called natural numbers ); Z 0 = {0, 1,,... }, the set of non-negative integers (sometimes called natural numbers ); R, the set of real numbers; (0, 1] = {x R 0 < x 1}; Definition 4. Let A and B be sets. We say A is a subset of B (A B) if every element of A is an element of B. Two sets A and B are equal (A = B) if A and B have the exactly same elements. Note that A = B if and only if both A B and B A. If two sets are not equal we write A B. We say A is a proper subset of B (A B) if A is a subset of B and A B. For example, the empty set is a subset of every set and a proper subset of every set other than itself. The second set listed above is a subset of the set of all mythical and real animals that are not mammals. We also have Z + Z 0 Z R and (0, 1] R. Now for what may be the most important object in all of mathematics: Definition 5. Let A and B be sets. A function (or map) f from A to B, written f : A B or A f B, is an assignment of exactly one element of B to each element of A. If a A, we write f(a) = b or a b if b is the unique element of B assigned by the function f to the a. We call A the domain of f and B the codomain of f. If f(a) = b, then we say b is the image of a and a is a preimage of b. The set of all images of f is called the image (or range) of f; it is a subset of B. To describe a function, either state explicitly which element of B is being assigned to each element of A, or give a rule (or several rules) that specifies the assignment. Examples: f {giraffe, 10, cardamom} {dolphin, cardamom, 99} given by giraffe 99, 10 99, cardamom dolphin. The image of f is {dolphin, 99}. Z f Z given by n n. Or Z g Z 0 with the same rule. We should think about the two functions in the last example above as different, so we define: Definition 6. Two functions A f B and C g D are equal if A = C, B = D, and f(a) = g(a) for all a A = C. Definition 7. A function A f B is injective (one-to-one) if f maps no two distinct elements of A to the same element B. Expressed more confusingly, this means that f(a 1 ) = f(a ) implies a 1 = a for all a 1, a A. 9
Week 4: More Sets and Functions Lecture 7, 9/11 (Section.3) Definition 8. A function A f B is surjective (onto) if the image of f is the entire codomain B. This means that for every b B there is an element a A such that f(a) = b. Definition 9. A function A f B is bijective if it is both injective and surjective. This means that f establishes a perfect correspondence of the elements of A with the elements of B. Examples: For any set A, the identity function A id A A is the bijective map defined by a a for all a A. The function Z f Z given by f(n) = n + 3. The exponential function R g R >0 given by x x. Definition 10. Given functions A f B and B g C, the composition of f and g is the function A g f C given by (g f)(a) = g(f(a)). Examples: For any set A, id A id A = id A. Given Z f Z defined by f(n) = n + 3 and Z g Z defined by g(n) = n, Z g f Z is the map (g f)(n) = g(f(n)) = g(n + 3) = (n + 3) = n + 6. Composing in the other order, Z f g Z is the map (f g)(n) = f(g(n)) = f(n) = n + 3. Note that f g g f! Definition 11. Let A f B and B g A be functions such that g f = id A and f g = id B. Then we say f and g are inverse functions. We also say f is invertible and that f has g as an inverse, and often denote that inverse by f 1. Examples: The inverse of id A is id A. The inverse of the function Z f Z given by f(n) = n + 3 is the function Z f 1 Z given by f 1 (n) = n 3. The inverse of the exponential function R g R >0 given by x x is the logarithm R >0 g 1 R that maps x log x. Theorem 6. A function A f B has an inverse if and only if it is bijective. 10
Proof. Suppose f has an inverse B g A. We check that f is injective. Suppose f(a 1 ) = f(a ). Then a 1 = id A (a 1 ) = (g f)(a 1 ) = g(f(a 1 )) = g(f(a )) = (g f)(a ) = id A (a ) = a, so f is injective. To see that f is surjective, suppose b B. Then g(b) A and so f is surjective. Thus f is bijective. f(g(b)) = (f g)(b) = id B (b) = b, Conversely, suppose f is bijective. Then define B g A to be the map that assigns to each element b B the unique element a A such that f(a) = b. Such an element a exists since f is surjective, and is unique since f is injective. Now we use this definition of g to compute (g f)(a) = g(f(a)) = a, (f g)(b) = f(g(b)) = b. Thus g f = id A and f g = id B, so g is the inverse of f. Lecture 8, 9/13 (Section.) Here is an example of a proof involving an inverse function. Theorem 7. The function R f R given by f(x) = x 3 is bijective. Proof. We will construct a function that is the inverse of f. Since an invertible function must be bijective, this will prove that f is bijective. Consider the function R g R mapping x x 1/3, which is a function since the cube root of any real number makes sense. We check the compositions. R g f R is the map x (g f)(x) = g(f(x)) = g(x 3 ) = (x 3 ) 1/3 = x, so g f = id R. Similarly, R f g R is the map (f g)(x) = f(g(x)) = f(x 1/3 ) = (x 1/3 ) 3 = x, so f g = id R. Combining sets Notation: from now on, I ll make heavy use of the notation := when I m defining something. Definition 1. Let A and B be sets. The union of A and B is the set A B := {x x A or x B}. The intersection of A and B is the set A B := {x x A and x B}. A and B are called disjoint if A B =. The difference of A and B (or the complement of B in A) is the set A B := {x A x / B}. Examples: Draw Venn diagrams. Let E be the even integers and O be the odd integers. Then E O =, so E and O are disjoint. E O = Z, Z E = O, and E Z =. We can take unions and intersections of an arbitrary number of sets. Definition 13. Let A 1, A,... be sets. Then their union is i=1 A i := {x x A i for some i} and their intersection is i=1 A i := {x x A i for all A i }. Examples: Set [a, b) := {x R a x < b}. [n, ) =. n=0 Then n=0 [n, n + 1) = [0, ) = R 0. On the other hand, Set (a, b) := {x R a < x < b}. Then n=1 ( 1 n, ) = (0, ). Definition 14. Let A and B be sets. The product of A and B is the set of ordered pairs A B := {(a, b) a A, b B}. Note: we could have defined a function from A to B to be a subset S of A B such that each a A is in exactly one pair (a, b) S. Defining A f B by f(a) = b would recover our original definition. 11