1.1 sets and logic

42
1.1 Sets and Logic Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside the brackets 2 A means 2 is an element of set A 3 A means 3 is not an element of set A Cardinal number – number of elements of a set notation: n(A) = # elements in set A

Upload: louvain

Post on 05-Jan-2016

27 views

Category:

Documents


0 download

DESCRIPTION

1.1 Sets and Logic. Set – a collection of objects. Set brackets {} are used to enclose the elements of a set. Example: {1, 2, 5, 9} Elements – objects inside the brackets 2  A means 2 is an element of set A 3  A means 3 is not an element of set A - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 1.1 Sets and Logic

1.1 Sets and Logic

• Set – a collection of objects. Set brackets {} are used to enclose the elements of a set.Example: {1, 2, 5, 9}

• Elements – objects inside the brackets2 A means 2 is an element of set A3 A means 3 is not an element of set A

• Cardinal number – number of elements of a setnotation: n(A) = # elements in set A

Page 2: 1.1 Sets and Logic

1.1 Sets and Logic

• Sets are equal – they contain the same elements (the order can be different)example: {A, B, C} = {B, C, A}

• {x | x has the property y} – This is read: “The set of x such that x has the property y”examples: {x | x is a letter grade}{x | x is an integer between –1.5 and 5.2}

Page 3: 1.1 Sets and Logic

1.1 Sets and Logic

• Universal set – set of all elements in a given situationexample: all outcomes when a die is rolledU = {1, 2, 3, 4, 5, 6}

• Empty set – set of no elements, denoted by • Subset – B A (B is a subset of A) true if every

element of B is also an element of A• Proper subset – B A (B is a proper subset of A)

true if B A and B A

Page 4: 1.1 Sets and Logic

1.1 Sets and Logic

• For all sets: A and A A

• # of subsets – a set with n distinct elements has 2n subsets

• {} is different from ; = {} has no elements (cardinality = 0){} has one element (cardinality = 1)

Page 5: 1.1 Sets and Logic

1.1 Sets and Logic

• Pascal’s triangle can be used to find the number of subsets with a given number of elements.

193684126126843691

18285670562881

172135352171

1615201561

15101051

14641

1331

121

11

1

Page 6: 1.1 Sets and Logic

1.2 Set Operations

• Complement of a set A – the set of all elements that are in the universal set associated with set A but not in A itself.In text: AC = complement of Aexample: U = {1, 2, 3, 4, 5, 6} A= {1, 2}then AC = {3, 4, 5, 6}

• Cardinalities: n(A) + n(AC) = n(U)example: n(U) = 12 and n(A) = 3; find n(AC)n(AC) = n(U) – n(A) = 12 – 3 = 9

Page 7: 1.1 Sets and Logic

1.2 Set Operations

• Venn diagrams – useful for visualizing sets

A

A B

AC A set and its complement

B A

Page 8: 1.1 Sets and Logic

1.2 Set Operations

• General Venn diagram for 2 sets

A

II

B

I

If A B region II is empty

If B A region IV is emptyIII

IV

Page 9: 1.1 Sets and Logic

1.2 Set Operations

• Union – The union of two sets A & B is the set that contains all the elements that are in A or B or both A and B – denoted AB(regions II, III, and IV above)

• Intersection – The set of all elements that are in both A and B – denoted by AB(region III above)

• Disjoint sets – If 2 sets have no elements in common they are disjoint - AB = (region III is empty)

Page 10: 1.1 Sets and Logic

1.3 Sets and Venn Diagrams

• De Morgan’s Laws for sets:

– ACBC = (AB)C

– ACBC = (AB)C

Page 11: 1.1 Sets and Logic

1. 3 Sets and Venn Diagrams

• General Venn diagram for 3 sets

A

C

BDivided into 8 regions

Page 12: 1.1 Sets and Logic

1.3 Sets and Venn Diagrams

• Venn diagram - shading

A BA B: crisscross area

A B: all shaded area

Page 13: 1.1 Sets and Logic

1.3 Sets and Venn Diagrams

• Venn diagram – disjoint sets

AB

BA

Page 14: 1.1 Sets and Logic

1.3 Sets and Venn Diagrams

• Cardinality rule for the union of 2 sets:n(AB) = n(A) + n(B) - n(AB)

• Cardinality rule for the union of 3 sets:n(ABC) = n(A) + n(B) + n(C) - n(AB) - n(BC) - n(AC) + n(ABC)

Page 15: 1.1 Sets and Logic

1.4 Inductive and Deductive Logic

• Inductive Logic – is the process of drawing a general conclusion from specific case.Example: When a number ending in 5 is squared, does the result end in 25?52 = 25152 = 225252 = 625552 = 3025952 = 90251252 = 15625Inductive logic says this is true

Page 16: 1.1 Sets and Logic

1.4 Inductive and Deductive Logic

• Inductive logic sometimes gives you a false conclusion.Example: Does the expression n2 – n + 11 always give a prime number?For n=2, n2 – n + 11 = 13 primeFor n=3, n2 – n + 11 = 17 primeFor n=4, n2 – n + 11 = 23 primeFor n=5, n2 – n + 11 = 31 primeFor n=6, n2 – n + 11 = 41 prime

Page 17: 1.1 Sets and Logic

1.4 Inductive and Deductive Logic

• Example: Does the expression n2 – n + 11 always give a prime number?For n=7, n2 – n + 11 = 53 primeFor n=8, n2 – n + 11 = 67 primeFor n=9, n2 – n + 11 = 83 primeFor n=10, n2 – n + 11 = 101 primeFor n=11, n2 – n + 11 = 121 = 112 not prime

Finally we get a counterexample!

Page 18: 1.1 Sets and Logic

1.4 Inductive and Deductive Logic

• Counterexample – a single case or example that is used to refute a mathematical conjecture

• Deduction – the process of drawing a specific conclusion from a general situation.

• Basic Syllogism (deductive logic)– 2 statements (premises and a conclusion

Page 19: 1.1 Sets and Logic

1.4 Inductive and Deductive Logic

• Inductive Logic (sometimes valid)Specific cases general case

• Deductive logic (always valid)General case specific cases

Page 20: 1.1 Sets and Logic

1.5 Logic Statements

• Statement – sentence that has a truth value. The statement is either true or false but not both

• Negation of a statement – a statement whose truth value is always the opposite that of the original statement. The negation of P is ~P.

• Quantifier – a word or phrase describing the inclusiveness of the statement.Examples: some, all most, few

Page 21: 1.1 Sets and Logic

1.5 Logic Statements

• The Accord is manufactured by Honda (statement)• Mathematics is the best subject

(not a statement - opinion)• Earth is the only planet in the universe (statement)• What are fireflies? (not a statement – question)• 2 – x = 3

(not a statement – equation with a variable)• 1 = 2 (statement)

Page 22: 1.1 Sets and Logic

1.5 Logic Statements

Quantifier for statement

Negation

All At least one is not

Some None

None At least one is

Page 23: 1.1 Sets and Logic

1.5 Logic Statements

• Paradox – a statement or group of statements that results in a contradictionExample: “This statement is false”- it cannot be given a truth value

• Zeno’s Paradox – Achilles and the tortoise (on page 34 of text)

Page 24: 1.1 Sets and Logic

1.6 Compound Statements

• Definition: A truth table for a statement is a table that provides the truth value of the statement for all possible situations

• Definition: Two statements are logically equivalent if they have the same truth tables

• Definition: Conjunction of two statements p and q is the statement “p and q” – which is only true if both p and q are true. Notation: p q

Page 25: 1.1 Sets and Logic

1.6 Compound Statements

• Definition: Disjunction of two statements p and q is the statement “p or q” – which is true if either p or q are true. Notation: p q

• Truth Tables:

p q p q p qT T T T

T F T F

F T T F

F F F F

Page 26: 1.1 Sets and Logic

1.6 Compound Statements

• De Morgan’s Laws for negation:– ~(p q) = (~p) (~q)– ~(p q) = (~p) (~q)

Page 27: 1.1 Sets and Logic

1.7 Conditional Statements

• Conditional statement - can be put in the form “if p then q” (Notation: pq)

• P is the antecedent or hypothesis; Q is the consequent or conclusion

• Truth table: p q p q

T T T

T F F

F T T

F F T

Page 28: 1.1 Sets and Logic

1.7 Conditional Statements

• Ways to translate pq:– If p then q– P only if q– P implies q– P is sufficient for q– Q is necessary for p– Q if p– All p are q

Page 29: 1.1 Sets and Logic

1.7 Conditional Statements

• Tautology - A compound statement that is true under all possible truth assignments.example: p ~p

• Contingency - A compound statement that is sometimes true and sometimes false depending on truth assignmentsexample: pq

• Contradiction - A compound statement” that is false under all possible truth assignmentsexample: p ~p

Page 30: 1.1 Sets and Logic

1.8 More Conditionals

• Converse of a conditional statement - formed by interchanging the hypothesis and the conclusion.example: converse of pq is qp

• Inverse of a conditional statement - formed by negating the hypothesis and the conclusion.example: inverse of pq is ~p~q

• Contrapositive of a conditional statement - formed by interchanging and negating the hypothesis and conclusion.example: contrapositive of pq is ~q~p

Page 31: 1.1 Sets and Logic

1.8 More Conditionals

• Conditional: pq Converse: qp

• Contrapositive: ~q~p Inverse: ~p~q

• Rule: Interchanging and negating the hypothesis and conclusion gives an equivalent conditional

Page 32: 1.1 Sets and Logic

1.8 More Conditionals

• Biconditional statement - can be put in the form “p if and only if q” (Notation: pq)

• Truth table:

p q p q

T T T

T F F

F T F

F F T

Page 33: 1.1 Sets and Logic

1.9 Analyzing Logical Arguments

• Definition: If pq is a tautology, then q “logically follows” from p

• Definition: conditional representation of an argumentis [p1 p2 p3…….. pn]q

Page 34: 1.1 Sets and Logic

1.9 Analyzing Logical Arguments

Direct Proof Proof by contradiction

Transitive Proof

1. pq 1. pq 1. pq

2. p 2. ~q 2. qr

q ~p pr

Page 35: 1.1 Sets and Logic

1.9 Analyzing Logical Arguments

• Definition: A fallacy is an argument that may seem to be a valid logical argument, but in fact is invalid.

a = bab = b2

ab – a2 = b2 – a2

a(b – a) = (b – a)(b + a)a = b + a

a = 2a1 = 2

Page 36: 1.1 Sets and Logic

1.9 Analyzing Logical Arguments

Fallacy:Affirming the consequent

Fallacy:Denying the antecedent

1. pq 1. pq

2. q 2. ~p

p ~q

Page 37: 1.1 Sets and Logic

1.9 Analyzing Logical Arguments

• Proof – affirming the consequent is not valid• Truth table for [(p q) q] p:

p q p q [(p q) q] [(p q) q] p

T T T T T

T F F F T

F T T T F

F F T F T

Page 38: 1.1 Sets and Logic

1.10 Logical Circuits

• Definition: Switch is an electronic component that can either have power flowing through it or not.Note: This is comparable to a logic statement– Switch – “on” or “off”– Statement – “T” or “F”

• Definition: A group of switches connected together is a circuit

Page 39: 1.1 Sets and Logic

1.10 Logical Circuits

• Definition: “series circuit” – connection of two or more switches so that the circuit works only if both switches are on.

p q

Page 40: 1.1 Sets and Logic

1.10 Logical Circuits

• Definition: “parallel circuit” – connection of two or more switches so that the circuit works if either of the switches is on.

p

q

Page 41: 1.1 Sets and Logic

1.10 Logical Circuits

• Definition: “complementary switches” – switches that are set up so that when one is on, the other is off and vice versa.

~p

Page 42: 1.1 Sets and Logic

1.10 Logical Circuits

• Open and closed switches:open = false, closed = true (current flows)p is open (false), q is closed (true)

p

q