MATH 245 Spring 2009 This is mathematics for computer science Logic and proof Induction and recursion Counting and Probability Course structure Weekly homework Bi-weekly quizes (rewriteable) Final
How to Succeed Read the book Ask questions in class Form study groups Seek help early and often Check web site: http://www.cs.plu.edu/courses/math245/spring2009/
Logic Need formal, careful rules for reasoning Avoid false conclusions Facilitate decision making and design Based in Philosophy first and then Mathematics (all scientists were philosophers then (time of Aristotle))
Statement A true or false sentence Good Bad John got an A in Geometry last semester. Crows are birds. Bad John is a religious X + Y = 5 Variables are used to represent a statement: p, q, r, ...
Logic Compound Statements Two or more statements joined by not (~), and (^), or (v) p = It is Monday, q = It is February, r = School is not in session. ~p q ^ r q v ~r
Truth Tables p q p v q t t t t f t f t t f f f p q r p ^ q ~r (p ^ q) v ~r t t t t f t t t f t t t t f t f f f t f f f t t f t t f f f f t f f t t f f t f f t f f f f t t
Logical Equivalence p q p v q q v p t t t t t f t t f t t t f f f f Useful to simplify or otherwise manipulate compound logic statements. E.G. Simplifying boolean conditions in coding
De Morgan's Laws Rules for NOT combined with AND, OR ~( p v q ) == ~p ^ ~q ~( p ^ q ) == ~p v ~q Can use a Truth Table to prove these
Tautologies and Contradictions Tautology – compound statement that is always true: (p v ~p) Contradiction – one that is never true: (p ^ ~p)
Conditional Statements The troublesome if ; implication If it rains then ... p -> q ( hypothesis implies conclusion ) Truth Table is the troublesome part p q p -> q t t t t f f f t t (weird?) f f t (seems so)
Logical Equivalences Operator precedence Show TT for p ^ ~q -> r Show p -> q == ~p v q
Negation of a conditional ~( p -> q ) ?? Since TT is F only when p is T and q is F, ~p ^ q Can also use the above equivalence and De Morgan's Laws NEVER use “if” in the negation of an “if” Negate: if PLU is in Tacoma then it is in Washington
Contrapositive An implication stated with negatives (sort of De Morgans Law again) Contrapositive of p -> q is ~q -> ~p These are equivalent Contrapositive: if PLU is in Tacoma then it is in Washington
Converse and Inverse of p -> q Converse is q -> p Inverse is ~p -> ~q Converse and Inverse: if PLU is in Tacoma then it is in Washington
Only If and Biconditional of p -> q Only If: q only if p Another way to say if p then q Biconditional: p if and only if q (true when p and q are equal)
Necessary and Sufficient Conditions Alternate ways of saying if, only if r is a sufficient condition for s if r then s (r -> s) r is a necessary condition for s r iff s ( r <-> s )
Logic and English Compound statement sentences need not be related if 2 + 2 = 4 then today is Monday English if usually means iff if you work hard then you will succeed English “or” usually mean exclusive or PLU is in Tacoma or it is in Washington