Download - COEN231-lect1

Transcript
Page 1: COEN231-lect1

COEN231: Discrete Mathematics

Prof. Chadi Assi

[email protected]

EV7.635

Page 2: COEN231-lect1

COEN231: General Information

• Course Description: – Foundations Sets, Logic and Algorithms, Integers and

Mathematical Induction, Relations and Posets, Matrices and Closures of Relations, Functions, Counting Principles, Recurrence Relations, Graph Theory, Trees and Networks

• Office hours: Thursdays from 11:00 to 13:00 or by appointment

• Course page: ENCS Moodle

Page 3: COEN231-lect1

COEN231: General Information

• Textbook : – Kenneth H. Rosen “Discrete Mathematics and Its

Applications” 7th (or 6th Edition), McGraw Hill publisher

• Tutorials: Three sections (Mina Yazdanpaneh [email protected]) (verify rooms!)

• UA: Wednesday 16:15-17:05 H625 • UB: Monday 16:15-17:05 H427 • UC: Friday 16:15-17:05 FG-B055

• Assignments: 4-5 assignments in total; 50% penalty on late assignments; no assignments are accepted once solutions are posted.

Page 4: COEN231-lect1

COEN231: General Information

• Two in-class midterms and one final (closed book and notes, no calculators)

• Final will cover material from the entire course• Weight distribution

– Assignments: 20%– Midterms (2): 30%– Final: 50%

• There will be no makeup if you miss the midterms; the corresponding weight is added to that of the final

Page 5: COEN231-lect1

The Foundations: Logic and Poofs

Page 6: COEN231-lect1

Objectives

• Learn about statements (propositions)

• Learn how to use logical connectives to combine statements

• Explore how to draw conclusions using various argument forms

• Become familiar with quantifiers and predicates

• Learn various proof techniques

Page 7: COEN231-lect1

Propositional Logic

• Definition: Mathematical logic provides methods for reasoning, rules and techniques to determine whether a statement or argument is valid

• Example of a statement: If x is an even integer, then x + 1 is an odd integer

• One needs to reason about this statement to determine whether it is true or false

• Such a statement is called Theorem (defined later)

• NOTE: the above statement is true under the condition that “x is an integer” is true

Page 8: COEN231-lect1

Propositional Logic

• A proposition, or a statement, is a declarative sentence that is either true or false, but not both

– Examples:

• 2 is an even number (true)

• Toronto is not the capital of Canada (true)

• A is a consonant (false)

– The following are not propositions:

• What time is it? (not a declarative sentence)

• x+1 = 2 (neither true nor false)

Page 9: COEN231-lect1

Propositional Logic

• Variables (usually lower case letters) are used to represent propositions.

• A statement has usually a truth value: T if it is a true proposition and F if it is false.

• Definition:

Let p be a proposition. The negation of p is denoted as ¬p (or ~p) and is the statement: “It is not the case that p” or “not p”. The truth values of p and ~ p are opposite.

Page 10: COEN231-lect1

Propositional Logic

• Find the negations of:– Today is Friday

– At least 10 inches of rain fell today in Miami

• Truth Table:

Page 11: COEN231-lect1

Propositional Logic

• Definition– Let p and q be statements. The conjunction of p

and q, written p ∧ q , is the statement formed by joining statements p and q using the word “and”.

– The statement p ∧ q is true if both p and q are true; otherwise p ∧ q is false.

Truth Table

Page 12: COEN231-lect1

Propositional Logic

• Definition– Let p and q be statements. The disjunction of p

and q, written p V q , is the statement formed by joining statements p and q using the word “or”.

– The statement p V q is false when both p and q are false; otherwise it is true.

Truth Table

Page 13: COEN231-lect1

Propositional Logic

• Example 1– p is the statement “Today is Friday” q is the

statement “It is raining today”, then the conjunction of p and q is:

“Today is Friday and it is raining today”Statement is true only on rainy Fridays.

• Example 2– The disjunction of p and q is: “Today is Friday or it is raining today”

This statement is true on any day that is either Friday or a rainy day (including rainy Fridays); it is false when it is not Friday and it does not rain.

Page 14: COEN231-lect1

Propositional Logic

• Definition– Let p and q be statements. The exclusive or of p

and q, written p q , is the statement that is true when exactly one of p and q is true and false otherwise.

Page 15: COEN231-lect1

Propositional Logic

• Definition– Let p and q be statements. The statement “if p then q” is

called an implication or a conditional statement and is denoted as p q.

• It is false when (p is true and q is false) and true otherwise.

– p q is read:• “If p, then q”

• “p is sufficient for q”

• q if p

• q whenever p

• p implies q

• p only if q

• p is called the hypothesis, q is called the conclusion

Page 16: COEN231-lect1

Propositional Logic

• Example:– Let p: Today is Sunday and q: I will wash the car. The

implication p q is the statement:• p q : If today is Sunday, then I will wash the car

– The converse of this implication is written q p• If I wash the car, then today is Sunday

– The inverse of this implication is ¬ p ¬ q• If today is not Sunday, then I will not wash the car

– The contrapositive of this implication is ¬ q ¬ p• If I do not wash the car, then today is not Sunday

Page 17: COEN231-lect1

Propositional Logic

• Definition– Let p and q be statements. The statement “p if and only

if q” is called the bi-implication or biconditional statement of p and q

– The biconditional “p if and only if q” is written p q– p q is read:

• “p is necessary and sufficient for q”• “q iff p”• “q when and only when p”

Page 18: COEN231-lect1

Propositional Logic

• Definition

– p q has the same truth table as: (p q) ∧ (q p)

– Example: p: You can take the flight, q: You buy a ticket p q is: You an take the flight iff you buy a ticket.

Page 19: COEN231-lect1

Propositional Logic

• Definitions– Symbols p ,q ,r ,...,called statement variables

– Symbols ¬, ∧, v, →,and ↔ are called logical connectives

Page 20: COEN231-lect1

Propositional Logic

• Compound Propositions (or statement formula)– Truth table of the compound proposition

(p v ¬q) → (p ∧ q)

Page 21: COEN231-lect1

Propositional Logic

• Precedence of logical connectives is:

– ¬ highest

– ∧ second highest

– v third highest

– → fourth highest

– ↔ fifth highest

• Examples¬ p v q is (¬ p) v q and NOT ¬ (p v q)

p ∧ q v r is (p ∧ q ) v r and not (p ∧ (q v r)

Page 22: COEN231-lect1

Propositional Logic

• Translating English sentences into expressions:

Example:

“You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old”

Define the following statements:p: You can ride the roller coaster

q: You are under 4 feet tall

r: You are older than 16 years old

Then the sentence can be written as

“If you are NOT under 4 feet tall AND you are older than 16 years old, then you can ride the roller coaster” or

q ∧ ¬r → ¬p

Page 23: COEN231-lect1

Propositional Logic

• Translating English sentences into expressions:

Example:

“You can access the Internet from campus only if you are a computer science major or you are not freshman”

Define the following statements:p: You are a computer science major

q: You are a freshman

r: You can access the Internet from campus

Then the sentence can be written as

“If you can access the Internet from campus, then you are a computer science major or you are not a freshman”

p V ¬q → r

Page 24: COEN231-lect1

Propositional Equivalence

• Definition:

– A compound proposition is said to be a tautology if its truth value is always T for any assignment of the truth values to the statement variables occurring in it

– Example: (¬p ∧ q ) → (¬(q → p ))

Page 25: COEN231-lect1

Propositional Equivalence

• Definition:

– A compound proposition is said to be a contradiction if its truth value is F for any assignment of the truth values to the statement variables occurring in it

– Example: p and not p

Page 26: COEN231-lect1

Propositional Equivalence

• Definition: Logical Equivalence

– Two compound propositions p and q are said to be logically equivalent if the statement formula p ↔ q is a tautology. The notation p ≡ q (or p q) is used to denote logical equivalence.

– Example: Show that ¬ (p v q ) and ¬p ∧ ¬ q are logically equivalent:

• To show whether two compound propositions are logically equivalent, we may use the truth table.

Page 27: COEN231-lect1

Propositional Equivalence

• Definition: Logical Equivalence

– Example: Show that ¬ (p v q ) and ¬p ∧ ¬ q are logically equivalent:

• To show whether two compound propositions are logically equivalent, we may use the truth table.

Page 28: COEN231-lect1

Logical Equivalences

Table 1

Page 29: COEN231-lect1

Table 2

Page 30: COEN231-lect1

Table 3

Page 31: COEN231-lect1

Propositional Equivalence

• Example: Show that ¬ (p q ) and p ∧ ¬ q are logically equivalent

– We can use the truth table to show this. We can also use the rules listed before.

p q ≡ ¬ p q (from Table 2), therefore

¬(p q) ≡ ¬(¬ p q )

≡ ¬(¬ p) ∧ ¬ q (De Morgan’s law)

≡ p ∧ ¬ q (Double negation law)

Page 32: COEN231-lect1

Propositional Equivalence

• Example: Show that ¬ (p (¬ p ∧ q )) and ¬ p ∧ ¬ q are

logically equivalent.¬ (p (¬ p ∧ q )) ≡ ¬ p ∧ ¬(¬ p ∧ q )) (De Morgan’ law)

≡ ¬ p ∧ [¬(¬ p) ¬(q )] (De Morgan’ law) ≡ ¬ p ∧ (p ¬q ) (Double

negation)

≡ (¬ p ∧ p ) (¬ p ∧ ¬q ) (Distributive law)

≡ F (¬ p ∧ ¬q )

≡ (¬ p ∧ ¬q ) F (commutative law)

≡ ¬ p ∧ ¬q (identity law for F)

Page 33: COEN231-lect1

Predicates and Quantifiers

Page 34: COEN231-lect1

Predicates and Quantifiers

• Predicate logic: is a powerful type of logic which may be used to express the meaning of a wide range of statements.

• Consider the statements: – “x is greater than 3”– “Computer x is working properly”

The truth of such statements depend on the value assigned to

the variable x

The statement “x is greater than 3” has two parts: the variable x which is the subject of the statement and the predicate which refers to a property the subject can have.

Page 35: COEN231-lect1

Predicates and Quantifiers

• “x is greater than 3” may be denoted by P(x) where P denotes the predicate and x is the variable.– P(x) is the value of the propositional function P at x. Upon

assigning a value to x, P(x) becomes a proposition with a T or F value.

• P(4) is True and P(2) is False.

• Statements may also involve more than one variable. Statement “x = y + 3” may be denoted by Q(x, y) where x and y are the variables and Q is the predicate. – Q(3, 0) is T and Q(0, 2) is false.

Page 36: COEN231-lect1

Predicates and Quantifiers

• A statement involving n variables x1, x2, …xn is denoted by P(x1, x2, …xn) where P is called n-ary predicate

Page 37: COEN231-lect1

Predicates and Quantifiers

• Some mathematical statements assert that a property is true or false for all values of a variable in a particular domain, called domain or universe of discourse

• Such Statements are expressed using universal quantifications.

• Definitions:

The universal quantification of P(x) is the statement:

“P(x) for all values of x in the domain”

The notation xP(x) denotes the universal quantification of P(x) and is called the universal quantifier

xP(x) is read as: “for all x P(x)” or “for every x P(x)”. An element for which P(x) is false is called counter example.

Page 38: COEN231-lect1

Predicates and Quantifiers

• Examples

– Let P(x) be the statement “x + 1 > x” . What is the truth value of P(x) when the domain of discourse is all real numbers?

• Clearly, P(x) is true for all real numbers, hence xP(x) is true.

– Let Q(x) be the statement “x < 2” . What is the truth value of Q(x) when the domain of discourse is all real numbers?

• For x = 3, Q(x) is false (a counterexample). Hence, xQ(x) is False.

• NOTE: for every, for each, given any, for any, for arbitrary, etc. are all equivalent to “for all”

Page 39: COEN231-lect1

Predicates and Quantifiers

• Remark:

– When all elements in the domain can be listed, e.g., x1, x2, …,xn, then:

xP(x) has the same value as the conjunction

P(x1) P(x2) … P(xn)

• Example:

– P(x) is “x2 < 10” , domain is positive integers not exceeding 4. Therefore, xP(x) is the same as:

P(1) P(2) P(3) P(4)

Since P(4) is false (42 < 10), then xP(x) is false.

Page 40: COEN231-lect1

Predicates and Quantifiers

• Definitions:

The existential quantification of P(x) is the statement:

“There exists an element x in the domain such that P(x)”

The notation xP(x) denotes the universal quantification of P(x) and is called the existential quantifier

• The domain must always be specified

• The symbol is read as “there exists”

xP(x) is read as:

– “There is an x such that P(x)”

– “There is at least one x such that P(x)”

– “There is some x such that P(x)”

Page 41: COEN231-lect1

Predicates and Quantifiers

• Example

P(x) is the statement “x > 3”. What is the truth value of xP(x) where the domain consists of all real numbers?

xP(x) is true since for x = 4, P(x) is true.

• Example

Q(x) is the statement “x = x + 1”. What is the truth value of xQ(x) where the domain consists of all real numbers?

Q(x) is false for all x, therefore xQ(x) is false

Page 42: COEN231-lect1

Predicates and Quantifiers

• Remark:

– When all elements in the domain can be listed, e.g., x1, x2, …,xn, then:

xP(x) has the same value as the conjunction

P(x1) P(x2) … P(xn)

• Example:

– P(x) is “x2 > 10” , domain is positive integers not exceeding 4. Therefore, xP(x) is the same as:

P(1) P(2) P(3) P(4)

Since P(4) is true (42 > 10), then xP(x) is true.

Page 43: COEN231-lect1

Predicates and Quantifiers

• Uniqueness quantifier: ! xP(x)

There exist only one (or exactly one) x such that P(x) is true.

• Precedence of quantifiers

and have higher precedence than other logical connectors.

For example, xP(x) Q(x) means (xP(x)) Q(x)

Page 44: COEN231-lect1

Predicates and Quantifiers

Logical Equivalence involving quantifiers:

Definition: Two statements (S and T) involving predicates and quantifiers are logically equivalent iff they have the same truth value. We use the notation S T to indicate the logical equivalence.

Example:

Show that x (P(x) Q(x)) and x P(x) x Q(x) are logically equivalent (same domain is used).

NOTE: We can distribute a universal quantifier over a conjunction (but not a disjunction) and we can distribute an existential quantifier over a disjunction (but not a conjunction).

Page 45: COEN231-lect1

Predicates and Quantifiers

To show that x (P(x) Q(x)) and x P(x) x Q(x) are logically equivalent, we need to show they always take the same truth value irrespective of what the predicates P and Q are and irrespective of the domain of discourse.

First we show if x (P(x) Q(x)) is true, then x P(x) x Q(x) is also true. Second we show if x P(x) x Q(x) is true, then x (P(x) Q(x)) .

Suppose x (P(x) Q(x)) is true. This means that if a is in the domain, then P(a) Q(a) is true. Hence, P(a) is true and Q(a) is true. Since P(a) and Q(a) are true for any a in the domain, we conclude that x P(x) and x Q(x) are both true and therefore x P(x) x Q(x) is also true.

Similarly we can show the second part.

Page 46: COEN231-lect1

Predicates and Quantifiers

Example: Express the statement

“Every student in this class has studied calculus”

using predicates and quantifiers.

Solution:

The statement can be rewritten as:

“For every student in the class, that student has studied calculus”

Or

“For every student x in the class, x has studied calculus”

Define C(x): “x has studied calculus” and the domain for x is all students in the class. Thus, our statement can be written as: x C(x)

Page 47: COEN231-lect1

Predicates and Quantifiers

We may also change the domain to consist of all people, and then the statement is written as:

“For every person x, if person x is a student in this class, then x has studied calculus.”

Then we need to define the statement S(x): “person x is a student in this class”

And the statement may be expressed as:

x (S(x) C(x))

Page 48: COEN231-lect1

Predicates and Quantifiers

Example: Express the statement

“Some student in this class has visited Mexico”

using predicates and quantifiers.

Solution:

The statement can be rewritten as:

“There is a student in the class, that student has visited Mexico”

Or

“There is a student x in the class, x has visited Mexico”

Define M(x): “x has visited Mexico” and the domain for x is all students in the class. Thus, our statement can be written as: x M(x)

Page 49: COEN231-lect1

Predicates and Quantifiers

Example: Express the statement

“Every student in this class has visited either Canada or Mexico”

using predicates and quantifiers.

Solution:

The statement can be rewritten as:

“For every student in the class, that student has visited either Canada or Mexico” Or

“For every student x in the class, x has visited Canada or x has visited Mexico”

Define C(x): “x has visited Canada” and M(x): “x has visited Mexico” the domain for x is all students in the class. Thus, our statement can be written as: x ( C(x) M(x) )

Page 50: COEN231-lect1

Predicates and Quantifiers

Negating Quantified Expressions

“Every student in your class has taken a course in calculus” is expressed as:

x P(x)

where P(x) “x has taken a course in calculus” and the domain is “all students in your class”.

Negating: “It is not the case that every student in your class has taken a course in calculus” or:

“There exists one student in your class who has not taken a course in calculus”

That is: x ¬P(x)

Page 51: COEN231-lect1

Predicates and Quantifiers

Negating Quantified Expressions

Example:

Negate: “There is an honest politician”

Let: H(x): “politician x is honest”, then statement above becomes: x H(x)

Its negation is: ¬ x H(x) or x ¬ H(x)

In other words: “All politicians are not honest”.

Page 52: COEN231-lect1

Predicates and Quantifiers

Examples

• Negate x (x2 > x) and x (x2 = 1 )

• Show that ¬ x (P(x) Q(x)) and x (P(x) ¬ Q(x)) are logically equivalent

Page 53: COEN231-lect1

Nested Quantifiers

Page 54: COEN231-lect1

Nested Quantifiers

Example:

x y (x + y = 0)

This can be thought of as: x Q(x)

where :

Q(x) is y P(x, y) and where P(x, y) is x + y = 0

Example: Translate into English (domain consists for all real numbers.):

x y ( (x > 0) (y < 0) (xy < 0) )

“For every real number x and for every real number y, if x > 0 and if y < 0,then xy < 0.”

“Or the product of a positive real number and a negative real number is always negative”

Page 55: COEN231-lect1

Nested Quantifiers

Page 56: COEN231-lect1

Nested Quantifiers

Example:

Translate the statement “The sum of two positive integers is always positive” into a logical expression.

Statement is rewritten as:

“For every two integers, if these integers are both positive, then the sum of these integers is always positive”

if x and y are integer variables, then:

“For all positive integers x and y, x + y is positive”

or in logical expression:

x y ( (x > 0) (y > 0) (x + y > 0) )

Page 57: COEN231-lect1

Nested Quantifiers

Example:

Translate into English the statement :

x ( C(x) y (C(y) F(x,y)))

where, C(x) : x has a computer. F(x,y): x and y are friends. domain is all students in your school.

The statement reads:

“For every student x in your school, x has a computer or there exists one student y in the school that has a computer and a friend with student x ”

Or:

“Every student in your school either has a computer or has a friend who has a computer”

Page 58: COEN231-lect1

Nested Quantifiers

Example:

Express the statement : “if a person is a female and is a parent, then this person is someone’s mother” as a logical expression. Domain is all people.

We can write: “For every person x, if x is a female and x is parent, then there exists a person y such that person x is the mother of person y”

Let F(x): “person x is a female”

Let P(x): “person x is a parent”

Let M(x, y): “person x is the mother of person y”. Then:

x ( F(x) P(x) y M(x,y))

Page 59: COEN231-lect1

Nested Quantifiers

Example:

Express the statement : “Everyone has exactly one best friend” as a logical expression. Domain is all people.

We can write: “For every person x, x has exactly one best friend”

Let B(x, y): “person y is the best friend of person x”. Then we write:

“There is a person y who is best friend to x and any person z who is not person y is not the best friend of x”. OR

“For every person x, there is a person y who is best friend to x and if any person z is different from y then z is not best friend to x”.

x y ( B(x, y) z ((z y) ¬B(x, z)))

Page 60: COEN231-lect1

Nested Quantifiers

Negating nested quantifiers:

Successively apply rules for negating statements with single quantifiers.

Example: Negate x y (x y = 1)

¬ [x y (x y = 1)]

¬ x ¬ y ¬(x y = 1)

x y (x y 1)

Page 61: COEN231-lect1

Rules of Inference

Page 62: COEN231-lect1

Rules of Inference

• Basic tools for establishing the truth of statements

Example: Consider this argument involving propositions

“If you have a current password, then you can log onto the network”

“You have a current password”

Therefore

“You can log onto the network”

Determine whether this argument is valid or not?

Let p: “you have a current password”, q: “you can log onto the network”

Page 63: COEN231-lect1

Rules of Inference

Let p: “you have a current password”, q: “you can log onto the network”

Then, the argument has the following form:

p q

p

_________

q

Where denotes “therefore”

Note: the statement ((p q) p ) q is a tautology; that is the conclusion is always true whenever the premises or statements making up the proposition are true. Therefore, we say the argument is a valid argument.

Page 64: COEN231-lect1

Rules of Inference

Definition:

An argument in propositional logic is a sequence of propositions. All but the final proposition in the argument are called premises and the final proposition is called conclusion.

An argument is valid if the truth of all its premises implies that the conclusion is true.

Example:

Suppose the conditional statement “If it snows today, then we will go skiing” and hypothesis: “It is snowing today” are both true. Therefore, the conclusion: “We will go skiing” is true.

Page 65: COEN231-lect1
Page 66: COEN231-lect1

Rules of Inference

Example:

“If it rains today then we will not have a barbecue today. If we do not have a barbecue today, then we will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow.”

p : it rains today

q : we will have a barbecue today

r : we will have a barbecue tomorrow

Page 67: COEN231-lect1

Introduction to Proofs

Page 68: COEN231-lect1

Introduction to Proofs

• A proof is a valid argument that establishes the truth of a mathematical statement

• A proof may use the hypotheses (or premises) of the theorem, axioms assumed to be true as well as previously proven theorems.

• Rules of inference may also be used to help in establishing the truth of the statement being proved.

• A theorem is a statement that can be shown to be true

• A proposition is a less important theorem

• An axiom is a statement that is assumed to be true

• A lemma is a less important theorem which is used in the proof of other results.

• A corollary is a theorem that can be established directly from a theorem which has bee proven

Page 69: COEN231-lect1

Methods for Proving Theorems

• One way for stating a theorem is:

x (P(x) Q(x))

To derive the proof: we show that P(c) Q(c) is true for some element c in the domain and then apply universal generalization.

• Direct proofs:

A direct proof shows that a conditional statement p q is true by showing that if p is true then q must be true, so that the combination p true and q false never occurs. In direct proofs, we may use axioms, premises, other results, etc.

Page 70: COEN231-lect1

Methods for Proving Theorems

Show that

“If n is an odd integer, then n2 is odd”

Proof:

Assume the hypothesis is true, that is “n is odd”.

Definition: an integer n is even if there exists an integer k such that n = 2k and n is odd if there exists another integer k such that n = 2k + 1.

n is odd, then n = 2k + 1 (from the above definition), therefore:

n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1

which shows that n2 is one more than twice an integer,

and therefore n2 is an odd integer.

Page 71: COEN231-lect1

Methods for Proving Theorems

Show that

“If m and n are perfect squares, then nm is also a perfect square”

NOTE: an integer a is perfect square if there is an integer b s.t.: a = b2

Proof:

Assume the hypothesis is true, that is “n and n are perfect squares”.

There exists integers s and t such that: n = s2, m = t2. Hence,

nm = s2 t2 = (st)2 . Since the product st of two integers s and t is also an integer, then nm is a perfect square.

Page 72: COEN231-lect1

Methods for Proving Theorems

Indirect Proofs Proof by contraposition

This method makes use of the fact that p q is equivalent to its contrapositive ¬ q ¬ p

Hence, p q can be proved by showing its contrapositive is true.

Here, we take ¬q as the hypothesis and we show that ¬ p must follow.

Example: Prove that if n is integer and 3n + 2 is odd, then n is odd.

Solution: in class

Example: Prove that if n = ab, a and b are positive integers, then:

Solution: in class

or nbna

Page 73: COEN231-lect1

Methods for Proving Theorems

Definition:

The real number r is rational if there exists integers p and q with q 0 such that r = p/q (a real number that is not rational is irrational)

Example: Prove that the sum of two rational numbers is rational

Solution: in class

Example: Prove that if n is an integer such that n2 is odd, then n is odd

Solution: in class

Page 74: COEN231-lect1

Methods for Proving TheoremsProof by contradiction (1)

Suppose we want to prove that a certain statement p is true.

Suppose we can find a contradiction q such that: ¬ p q is true.

Because q is false and ¬ p q is true, it follows that ¬ p must be false. Therefore, p must be true.

How can we find the contradiction q?

¬ r r is a contradiction for some proposition r.

Then we can prove that p is true if we can show that ¬ p (¬ r r) is true for some proposition r.

Page 75: COEN231-lect1

Methods for Proving TheoremsProof by contradiction (1)

Example: Prove that is irrational by giving a proof by contradiction.

Solution: in class

NOTE: The real number r is rational if there exists integers p and q with q 0 such that r = p/q (a real number that is not rational is irrational)

Example: Show that at least 4 days of any 22 days must fall on the same day of the week.

2

Page 76: COEN231-lect1

Methods for Proving TheoremsProof by contradiction (2)

(1) We can prove conditional statements using proof by contradiction. We assume the negation of the conclusion, we use the premises of the theorem to arrive at a contradiction.

This works since: ( p q ) (p ¬q ) F

(2) We can also write the proof of contraposition as a proof by contradiction. (In contraposition, we assume ¬q is true and show that ¬p is false). Now, we suppose both p and ¬q are true. Then we use the steps of contraposition ¬q ¬p to show that ¬ p is true. Hence, p and ¬p which is a contradiction.

Example: Prove by contradiction that “if 3n + 2 is odd, then n is odd”

Solution: in class

Page 77: COEN231-lect1

Methods for Proving TheoremsProofs of Equivalence

To prove a theorem whose statement is of the form: p q , we show that p q and q p are both true. This follows from the following tautology:

( p q ) ( p q ) ( q p )

Example: Prove the theorem: “If n is a positive integer, then n is

odd if and only if n2 is odd”

Solution: In class

Page 78: COEN231-lect1

Methods for Proving TheoremsCounterexamples

To show that a statement of the form x P(x) is false, we only need to find a counterexample; that is an example x for which P(x) is false.

Tip: When you have to prove a statement of the form x P(x) but you could not establish the proof, then look for a counter example.

Example: Show that “every positive integer is the sum of the squares of two integers” is false