




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Stephen Lovett
December 17, 2013
The term “discrete” mathematics stands in contrast to “continuous” mathematics, which refers to algebra of real numbers, calculus, and analysis. Discrete mathematics is typically not considered a branch of mathematics but the term is typically used to designate a course that introduces students to a variety of topics involving discrete mathematical structures. Discrete mathematics is particularly important for computer science because a computer does not function with continuous structures. A computer does not deal with real numbers but with integers and decimals terminating after a certain level of precision. At a finer level of detail, computers deal with bit strings (strings of 0s and 1s) which are in essence not continuous. When a computer draws the graph of a function, it does not draw a continuous graph but rather a sample of points connected by straight line segments. The rate of sampling should be fine enough to make the collection of straight line segments appear like a smooth curve. Both at the lowest level of machine design and at the higher level of programming, discrete mathematics governs the logical structures. Circuitry relies on binary functions (a discrete structure) and every data type used in computer programming can be phrased as a certain discrete mathematical structure. Some of the topics often introduced in a course on discrete mathematics are:
These notes offer the student some exercises. All of the problems are taken from Kenneth Rosen, Discrete Mathematics and its Applications, 6th edition. The solutions are given at the end of these notes. The student is encouraged to try the exercises on his or her own and then refer to the solutions only after having attempted the exercises.
Definition 2.2 The truth value of a proposition is whether it is true or false.
Just as in algebra we regularly use variables like x and y to refer to unspecified real numbers in equations or formulas, in logic we use variables to refer to propositions. We typically use the variable names p, q, and r and associate the symbol of T for the truth value of true and F for the truth value of false.
2.3 Compound Propositions
We create compound propositions by creating new ones from old propositions. When we do so, we may use a truth table to provide the truth value of the compound proposition based on the truth values of propositions that make it up. We often call atomic propositions the propositions that make up a compound proposition.
Definition 2.3 Let p be a proposition. The statement “It is not the case that p.” is a new proposition called the negation of p. This is denoted by ¬p.
Note: sometimes English grammar (or the grammar of any natural language) allows us to shorten the negation statement. For example, if p =“The shirt I wore yesterday was white.” then for ¬p we usually say “The shirt I wore yesterday was not white.” However, as we will see, this is not always correct or clear. To preserve clarity, using the more cumbersome phrase given in Definition 2.3 will always be correct. The truth table for ¬p is
p ¬p T F F T
Definition 2.4 Let p and q be propositions. The proposition “p and q” is denoted by p ∧ q and is the proposition that is true only when p and q are both true. This is called the conjunction of p and q
Example 2.5 Let p=“The driver drove a red car.” and q=“The driver wore a hat.” The conjunction proposition p ∧ q is “The driver drove a red car and the driver wore a hat.” In English, since the subject of each atomic proposition is the same, we often combine the two and say “The driver drove a red car and wore a hat.” Again, we need to take care when using these types shorteners.
The truth table for the conjunction is:
p q p ∧ q T T T T F F F T F F F F
Note that in this truth table, we write T and F such that the four rows run through all combinations of truth values for the atomic propositions p and q.
Definition 2.6 Let p and q be propositions. The proposition “p or q”, denote by p ∨ q is the proposition that is false only when both p and q are false. This is called the disjunction of p and q.
Example 2.7 Let p=“Frank’s bicycle has a flat tire” let q=“Frank is sick today.” The disjunction proposition is p ∨ q=“Frank’s bicycle has a flat tire or Frank is sick today.” The only way this compound proposition can be false if is Frank’s bicycle does not have a flat tire and if Frank is well.
The truth table for the disjunction proposition is: p q p ∨ q T T T T F T F T T F F F In English and in many other natural languages, we are often imprecise in our use of “or.” Sometimes we use “or” in an exclusive sense. For example, consider the sentence we may find on a menu at a restaurant: “The meal comes with chips or salad.” In this sentence, we understand that we can get chips or salad but not both. English does make provisions for being precise. In order to make it clear that we mean the exclusive or, we should say “The meal comes with either chips or salad.”
Definition 2.8 The exclusive or of two propositions p and q, denoted by p ⊕ q, is the compound proposition that is true exactly when one atomic proposition is true and the other is false.
The truth table for the exclusive or is: p q p ⊕ q T T F T F T F T T F F F Note that in Example 2.7, since we assumed we were using the usual “or”, the compound proposition of “Frank’s bicycle has a flat tire or Frank is sick today” is true even if Frank’s bicycle has a flat tire and Frank is sick today. The exclusive or proposition “Either Frank’s bicycle has a flat tire or Frank is sick today” would be false if Frank’s bicycle has a flat tire and Frank is sick today.
Definition 2.9 Let p and q be propositions. The implication statement p → q is the proposition that is false exactly when p is true and q is false.
The truth table for the implication proposition is p q p → q T T T T F F F T T F F T
Example 2.14 Consider the following situation involving bargaining. Suppose that a po- tential buyer says to the seller, “If I buy that chair, then the price of the chair must be less than 7000 Ksh.” With this type of sentence, the buyer (who we assume is truthful) is still allowing him or herself the option not to purchase the chair if the seller offers the chair for less than 7000 Ksh. (Recall that if the hypothesis of an implication statement is false, then implication statement is true regardless of the conclusion. Compare that sentence to the biconditional proposition “I will buy that chair if and only if the price of the chair is less than 7000 Ksh.” If the seller offers the chair for less than 7000 Ksh, then (in order not to be made out a liar) the buyer must purchase the chair.
2.4 Combining Statements
Just as in algebra we use parentheses to group algebraic expressions and impose and order of operations, we do that same in propositional logic. For example, we might write (¬p) ∨ q or (p → q) ∧ r. In order to reduce parentheses, we institute one operator precedence: the negation ¬ is taken before any other connective operator. Thus ¬p ∨ q means (¬p) ∨ q but does not mean ¬(p ∨ q). When creating a truth table for a compound proposition, it is not uncommon to insert extra columns to show the intermediate truth values. For example, a truth table for ¬p ∨ q is
p q ¬p ¬p ∨ q T T F T T F F F F T T T F F T T
We point out that ¬p ∨ q has the same truth table as p → q. We say that these compound propositions are logically equivalent. This will be the topic of the next section.
Example 2.15 For the sake of illustration we show how to construct the truth table for the compound proposition (p → q) ∧ r. Note that since there are three atomic propositions, we will need 8 rows to give us all possible combinations of truth value for p, q and r.
p q r p → q (p → q) ∧ r T T T T T T T F T F T F T F F T F F F F F T T T T F T F T F F F T T T F F F T F
2.5 Logic and Bit Operations
Definition 2.16 A bit in mathematics and in computer science stands for a binary digit. Bits can be 0 or 1. A bit string is a string of bits.
There is a direct connection between bits and bit operations used in programming and propositional logic, according to the following association
T 1 F 0 ¬ NOT ∧ AND ∨ OR ⊕ XOR
It is not uncommon to extend bit operations to bit strings by performing the operations on the bits in the same positions. For example, if x = 1001, y = 0011, and z = 1110, then
(x or y)XORz = (1001 or 0011)XOR1110 = 1011XOR1110 = 0101.
2.6 Section Exercises
Exercise: 1 p. For each of the following statements, decide if it is a proposition and state its truth value. a) “Boston is the capital of Massachusetts.” b) “Miami is the capital of Florida.” c) “2+3=5” d) “5+7=10” e) “x + 2 = 11” f) “Answer this question.” g) “x + y = y + x for every pair of real numbers x and y.”
Exercise: 3 p. Write in English the negation of the following propositions. a) “Today is Thursday.” b) “There is no pollution in New Jersey.” c) “2 + 1 = 3” d) “The summer in Maine is hot and sunny.”
Exercise: 8 p. Let p, q and r be the following propositions: p=“You have the flu.” ; q=“You miss the final exam.”; r=“You pass the course.” Write the following compound propositions in English. a) p → q b) ¬q ↔ r c) q → ¬r d) p ∨ q ∨ r e) (p → ¬r) ∨ (q → ¬r) f) (p ∧ q) ∨ (¬q ∧ r)
Exercise: 10 p. Define the following three propositions: p=“You get an A on the final exam.” q=“You do
3.1 Some Terminology
An important step in mathematical reasoning is to replace one statement with another that has the same truth value.
Definition 3.1 Depending on the truth values of the atomic propositions, if a compound proposition is
Example 3.2 The compound proposition p∨¬p is a tautology while p∧¬p is a contradiction.
Example 3.3 We can show that (p → q) ∨ p is a tautology by creating the corresponding truth table:
p q p → q (p → q) ∨ p T T T T T F F T F T T T F F T T
3.2 Logical Equivalences
Definition 3.4 Two compound propositions with the same truth value for all possible cases are called logically equivalent. Equivalently two compound propositions p and q are called logically equivalent if p ↔ q is a tautology.
Some people write p ≡ q while others write p ⇐⇒ q to mean that p and q are logically equivalent.
Definition 3.5 Given two compound propositions p and q, if p → q is a tautology, then we say that q is a logical implication of p. We write p =⇒ q for this situation.
Example 3.6 We already showed that p → q ⇐⇒ ¬p ∨ q.
Example 3.7 We now show that ¬(p ∨ q) ⇐⇒ ¬p ∧ ¬q by using a truth table.
p q p ∨ q ¬(p ∨ q) ¬p ¬q ¬p ∧ ¬q T T T F F F F T F T F F T F F T T F T F F F F F T T T T
This equivalence is called DeMorgan’s law.
possible and justify all the steps.
r → (¬p → (r ∧ q)) ⇐⇒ ¬r ∨ (¬(¬p) ∨ (r ∧ q)) by → equivalence twice ⇐⇒ ¬r ∨ (p ∨ (r ∧ q)) by the double negative law ⇐⇒ (¬r ∨ p) ∨ (r ∧ q) by associativity ⇐⇒ (p ∨ ¬r) ∨ (r ∧ q) by commutativity ⇐⇒ p ∨ (¬r ∨ (r ∧ q) by associativity ⇐⇒ p ∨ ((¬r ∨ r) ∧ (¬r ∨ q)) by distributivity ⇐⇒ p ∨ (T ∧ (¬r ∨ q)) by the OR tautology ⇐⇒ p ∨ (¬r ∨ q) by the identity law ⇐⇒ ¬r ∧ (p ∨ q) by associativity and commutativity ⇐⇒ r → (p ∨ q) by → equivalence
We could have stopped two lines before we did (but for aesthetic reasons we brought back in the → operator.
3.4 Section Exercises
Exercise: 6 p. Show that ¬(p ∧ q) and ¬p ∨ ¬q are logically equivalent.
Exercise: 8 p. Using DeMorgan’s law, state the negation of the following proposition. a) Kwame will take a job in industry or will go to graduate school. b) Yoshiko knows Java and knows calculus. c) James is young and strong. d) Rita will move to Oregon or to Washington.
Exercise: 10 p. Show that the following implication statements are tautologies by creating an appropriate truth table. (This means that the hypothesis compound proposition logically implies the conclusion.) a)
¬p ∧ (p ∨ q)
→ q b) (p → q) ∧ (q → r) → (p → r) c)
p ∧ (p → q)
→ q d)
(p ∨ q) ∧ (p → r) ∧ (q → r)
→ r
Exercise: 12 p. Show that the following implication statements are tautologies by using propositional equiv- alences to show that the compound proposition is equivalent to T. (This means that the hypothesis compound proposition logically implies the conclusion. You should be able to clearly state which propositional equivalence you use at each stage, though this exercise is not requiring you to state them.) a)
¬p ∧ (p ∨ q)
→ q b) (p → q) ∧ (q → r) → (p → r)
c)
p ∧ (p → q)
→ q d)
(p ∨ q) ∧ (p → r) ∧ (q → r)
→ r
Exercise: 14 p. Determine in any way you choose whether or not the following compound proposition is a tautology: (¬p ∧ (p → q)) → ¬q.
Exercise: 24 p. Show that (p → q)∧(p → r) is logically equivalent to p → (q∧r) by using logical equivalences. State the rules that you use at each stage of your reasoning.
Exercise: 30 p. Show that ((p ∨ q) ∧ (¬p ∨ r)) → (q ∨ r) is a tautology by any means you desire.
Exercise: 40 p. Give a compound proposition in p, q, and r that is true only when p is true, q is true, and r is false, and is false for all other combinations of truth values of p, q, and r.
Note that if the universe of discourse of a variable x can be listed as x 1 , x 2 ,... , xn for some positive integer n, then
∀x P (x) ⇐⇒ P (x 1 ) ∧ P (x 2 ) ∧ · · · ∧ P (xn).
Definition 4.4 The existential quantification of P (x), written ∃x P (x) or ∃x, P (x), often read briefly as “there exists an x such that P (x),” is the proposition that is true exactly when P (x) is true for at least one x in the universe of discourse.
Example 4.5 Consider the algebraic equation x^3 − x − 6 = 0. To ask whether this equation has a solution amounts to determining the truth value of the logical statement ∃x, x^3 −x−6 =
Example 4.6 Consider the proposition “There is someone in this MATH210 class who is not a CIS major.” This can be turned into an existential quantification statement as follows. Let the universe of discourse be all people. Let P (x) =“x is in this MATH210 class” and let Q(x) =“x is a CIS major.” Our proposition can be written as
∃x (P (x)∧ 6 Q(x)).
In order to arrive at this logic expression, we converted the original phrase to the equivalent but more cumbersome English phrase “There exists a person who is in this class and who is not a CIS major.”
Note that if the universe of discourse of a variable x can be listed as x 1 , x 2 ,... , xn for some positive integer n, then
∃x P (x) ⇐⇒ P (x 1 ) ∨ P (x 2 ) ∨ · · · ∨ P (xn).
In mathematics, we often run into statements where we would like to say that there exists a unique object with a certain property. We write this using quantifiers and predicates as ∃!x P (x) to mean that there exists a unique x in the unverise of discourse such that P (x) is true.
4.3 DeMorgan’s Laws for Quantifiers
Theorem 4.
¬ (∀x P (x)) ⇐⇒ ∃x (¬P (x)) ¬ (∃x P (x)) ⇐⇒ ∀x (¬P (x))
Example 4.8 Let the universe of discourse for the variable n be integers and let P (n)=“3n^2 + 2 n + 1 is a square integer.” The negation of ∀n (3n^2 + 2n + 1 is a square integer) is ∃n, (3n^2 + 2n + 1 is not a square integer). The logical error that someone could make here is to claim that the negation of ∀n (3n^2 + 2n + 1 is a square integer) is ∀n, (3n^2 + 2n + 1 is not a square integer).
4.4 Nested Quantifiers
When we work with propositional functions of two or more variables, in order to create propositions from them using quantifiers, we need to bind each variable with a quantifier. Mind that the order of how we list the quantifiers may matter to the meaning of the resulting proposition, so we read expressions from left to right.
Example 4.9 The statement that the operation of addition is commutative can be written as ∀x∀y, x + y = y + x,
where the universe of discourse is taken to be all real numbers.
Example 4.10 Suppose that the universe of discourse for both x and y is all real num- bers and let P (x, y)=“x < y” and let Q(x, y) =“x^2 < y^2 .” Consider the following four propositions:
(1) is false because x = −2 and y = −1 gives a counterexample. (2) is true because for any x, taking y = |x| + 1 gives a value for y that makes the proposition true. (3) is true because taking x = 1 (or any positive number) shows the proposition to be true. (4) is true by virtue of (3) being true.
Example 4.11 In calculus, we encounter the notion of continuity. A real-valued function f , defined on an interval [a, b], is continuous at a point x 0 inside the interval if
∀ε > 0 , ∃δ > 0 , ∀x, (|x − x 0 | < δ → |f (x) − f (x 0 )| < ε).
We assume the universe of discourse for all variables is the set of real numbers. (Note that we have adopted the convention of writing ε > 0 to mean that we only consider variables ε that are positive. In this situation, the use of commas between the quantifiers makes the proposition easier to read.) We would like to show what it means for a function to not be continuous at x 0. However, first note that
¬(p → q) ⇐⇒ ¬(¬p ∨ q) ⇐⇒ ¬(¬p) ∧ ¬q = p ∧ ¬q.
The negation of the definition of continuity is
¬ (∀ε > 0 , ∃δ > 0 , ∀x, (|x − x 0 | < δ → |f (x) − f (x 0 )| < ε)) ⇐⇒ ∃ε > 0 , ¬ (∃δ > 0 , ∀x, (|x − x 0 | < δ → |f (x) − f (x 0 )| < ε)) ⇐⇒ ∃ε > 0 , ∀δ > 0 , ¬ (∀x, (|x − x 0 | < δ → |f (x) − f (x 0 )| < ε)) ⇐⇒ ∃ε > 0 , ∀δ > 0 , ∃x, ¬(|x − x 0 | < δ → |f (x) − f (x 0 )| < ε) ⇐⇒ ∃ε > 0 , ∀δ > 0 , ∃x (|x − x 0 | < δ ∧ |f (x) − f (x 0 )| ≥ ε).
b) ∃x(x^4 < x^2 ) c) ∀x((−x)^2 = x^2 ) d) ∀x(2x > x)
Exercise: 24 p. In all the following statements, let P (x) be the propositional function that states “x is in your class”. Write each of the following English sentences using logic notation and predicates, assuming the universe of discourse is the students in your class and then assuming the universe of discourse is all people. For each one, label the new predicate that you define. a) “Everyone in your class has a cell phone.” b) “Someone in your class has seen a foreign movie.” c) “Someone in your class cannot swim. (Use S(x)=“x can swim”.) d) “Everyone in your class can solve quadratic equations.” e) “Someone in your class does not want to be rich. (Use R(x) =“x wants to be rich”.)
Exercise: 39 p. let x be taken from the universe of discourse of all printers and let j be taken from the universe of discourse of print jobs. Define the following predicates: O(x) =“x is out of service”, B(x) =“x is busy”, L(j) =“j got lost”, and Q(j) =“j got queued”. Write the following logic propositions in English. a) (∃x (O(x) ∧ B(x))) → (∃j L(j)) b) (∀x B(x)) → (∃j Q(j)) c) (∃j (Q(j) ∧ L(j)) → (∃x O(x)) d) ((∀x B(x)) ∧ (∀j Q(j))) → (∃j L(j))
Exercise: 54 p. he domain for x consists of the integers 1,2,3. Write the expression ∃!xP (x) using P (1), P (2), P (3), and compound proposition operators.
Exercise: 62 p. Let P (x) =“x is a duck”, Q(x) =“x is one of my poultry”, R(x) =“x is an officer” and S(x) =“x is willing to waltz”. For (a) through (d), translate the following English sentences into logic using predicates and quantifiers. a) “No ducks are willing to waltz.” b) “No officer is unwilling to dance.” c) “All of my poultry are ducks.” d) “None of my poultry is an officer.” e) Can you conclude from the above propositions that “My poultry are not officers”?
Exercise: 2 p. The universe of discourse consists of all real numbers. Express the following logic nested quantifier propositions in English. a) ∃x∀y(xy = y) b) ∀x∀y
(x ≥ 0) ∧ (y < 0)
→ (x − y > 0)
c) ∀x∀y∃z(x = y + z)
Exercise: 4 p. Consider the propositional function P (x, y)=“student x has taken class y.” x is from the set of students in the class and y is from the set of CS courses offered at the school. Express each of the following nested quantifier statements in English to sound as natural as possible. a) ∃x∃y P (x, y) b) ∃x∀y P (x, y) c) ∀x∃y P (x, y) d) ∃y∀x P (x, y) e) ∀y∃x P (x, y) f) ∀x∀y P (x, y)
Exercise: 6 p. C(x, y) is the statement that a student x is enrolled in class y. Express each of the logic expressions in English as naturally as possible. a) C(Randy Golberg,CS 252) b) ∃x C(x,Math 695) c) ∃y C(Carol Sitea,y) d) ∃x (C(x,Math 222) ∧ (C(s,CS 252)) e) ∃x∃y∀z
(x 6 = y) ∧ (C(x, z) → C(y, z)
f) ∃x∃y∀z
(x 6 = y) ∧ (C(x, z) ↔ C(y, z)
Exercise: 12 p. Use the propositional functions we use are I(x)=“x has an internet account” and C(x, y)=“x and y have chatted over the internet.” The universe of discourse is people in your class. Express the following English sentences using quantifiers and propositional functions. a) Jerry does not have an internet account. b) Rachel and Chelsea have not chatted over the internet. c) Jan and Sharon chatted over the internet. d) No one has chatted over the internet with Bob. e) Everyone who has chatted with Joseph over the internet has also chatted with Sanjay. f) There exists someone who does not have an internet account. g) Not everyone has an internet account. h) Only one person has an internet account. i) There is only one person who does not have an internet account. j) Everyone who has an internet account has chatted with someone else over the internet. k) Someone in the class has an internet account and who has chatted with everyone on the internet. l) There are two people who have not chatter over the internet. m) There exists someone who has chatter with everyone over the internet. n) There exists two different people who not both chatted over the internet with the same person. o) There exist two different people who between them have chatter with everyone in the class.