We've updated our

TEXT

# Logic Basics

In this section, we will learn how to construct logical statements. We will later combine our knowledge of sets with what we will learn about constructing logical statements to analyze arguments with logic.

### Learning Objectives

Introduction to Logic
• Combine sets using Boolean logic, using proper notations
• Use statements and conditionals to write and interpret expressions
• Use a truth table to interpret complex statements or conditionals
• Write truth tables given a logical implication, and it’s related statements – converse, inverse, and contrapositive
• Determine whether two statements are logically equivalent
• Use DeMorgan’s laws to define logical equivalences of a statement
Logic is a systematic way of thinking that allows us to deduce new information from old information and to parse the meanings of sentences. You use logic informally in everyday life and certainly also in doing mathematics. For example, suppose you are working with a certain circle, call it “Circle X,” and you have available the following two pieces of information.
1. Circle X has radius equal to 3.
2. If any circle has radius $r$, then its area is $\pi{r}^{2}$ square units.
You have no trouble putting these two facts together to get:
1. Circle X has area $9\pi$ square units.
You are using logic to combine existing information to produce new information. Since a major objective in mathematics is to deduce new information, logic must play a fundamental role. This chapter is intended to give you a sufficient mastery of logic.

## Boolean Logic

Logic is, basically, the study of valid reasoning. When searching the internet, we use Boolean logic – terms like “and” and “or” – to help us find specific web pages that fit in the sets we are interested in. After exploring this form of logic, we will look at logical arguments and how we can determine the validity of a claim. We can often classify items as belonging to sets. If you went the library to search for a book and they asked you to express your search using unions, intersections, and complements of sets, that would feel a little strange. Instead, we typically using words like “and,” “or," and “not” to connect our keywords together to form a search. These words, which form the basis of Boolean logic, are directly related to set operations with the same terminology.

### Boolean Logic

Boolean logic combines multiple statements that are either true or false into an expression that is either true or false.
• In connection to sets, a boolean search is true if the element in question is part of the set being searched.
Suppose M is the set of all mystery books, and C is the set of all comedy books. If we search for “mystery”, we are looking for all the books that are an element of the set M; the search is true for books that are in the set. When we search for “mystery and comedy” we are looking for a book that is an element of both sets, in the intersection. If we were to search for “mystery or comedy” we are looking for a book that is a mystery, a comedy, or both, which is the union of the sets. If we searched for “not comedy” we are looking for any book in the library that is not a comedy, the complement of the set C.

### Connection to Set Operations

A and B       elements in the intersection AB A or B         elements in the union AB Not A          elements in the complement Ac
Notice here that or is not exclusive. This is a difference between the Boolean logic use of the word and common everyday use. When your significant other asks “do you want to go to the park or the movies?” they usually are proposing an exclusive choice – one option or the other, but not both. In Boolean logic, the or is not exclusive – more like being asked at a restaurant “would you like fries or a drink with that?” Answering “both, please” is an acceptable answer. In the following video, You will see examples of how Boolean operators are used to denote sets. http://youtu.be/ZOLinnoXEAw

### Example

Suppose we are searching a library database for Mexican universities. Express a reasonable search using Boolean logic.

Answer: We could start with the search “Mexico and university”, but would be likely to find results for the U.S. state New Mexico. To account for this, we could revise our search to read: Mexico and university not “New Mexico”

In most internet search engines, it is not necessary to include the word and; the search engine assumes that if you provide two keywords you are looking for both. In Google’s search, the keyword or has be capitalized as OR, and a negative sign in front of a word is used to indicate not. Quotes around a phrase indicate that the entire phrase should be looked for. The search from the previous example on Google could be written:

Mexico university -“New Mexico”

### Example

Describe the numbers that meet the condition: even and less than 10 and greater than 0

Answer: The numbers that satisfy all three requirements are {2, 4, 6, 8}

### Example

An accountant needs to withhold 15% of income for taxes if the income is below $30,000, and 20% of income if the income is$30,000 or more.   Write an Excel expression that would calculate the amount to withhold.

Answer: Our conditional needs to compare the value to 30,000. If the income is less than 30,000, we need to calculate 15% of the income: 0.15*income. If the income is more than 30,000, we need to calculate 20% of the income: 0.20*income. In words we could write “If income < 30,000, then multiply by 0.15, otherwise multiply by 0.20”. In Excel, we would write: =IF(A1<30000, 0.15*A1, 0.20*A1)

### Try it now

Truth tables really become useful when analyzing more complex Boolean statements.

### Example

Create a truth table for the statement $A\wedge\sim\left(B\vee{C}\right)$

Answer: It helps to work from the inside out when creating truth tables, and create tables for intermediate operations. We start by listing all the possible truth value combinations for A, B, and C. Notice how the first column contains 4 Ts followed by 4 Fs, the second column contains 2 Ts, 2 Fs, then repeats, and the last column alternates. This pattern ensures that all combinations are considered. Along with those initial values, we’ll list the truth values for the innermost expression, $B\vee{C}$.

 A B C B ⋁ C T T T T T T F T T F T T T F F F F T T T F T F T F F T T F F F F
Next we can find the negation of $B\vee{C}$, working off the $B\vee{C}$ column we just created.
 A B C $B\vee{C}$ $\sim\left(B\vee{C}\right)$ T T T T F T T F T F T F T T F T F F F T F T T T F F T F T F F F T T F F F F F T
Finally, we find the values of A and $\sim\left(B\vee{C}\right)$
 A B C $B\vee{C}$ $\sim\left(B\vee{C}\right)$ $A\wedge\sim\left(B{\vee}C\right)$ T T T T F F T T F T F F T F T T F F T F F F T T F T T T F F F T F T F F F F T T F F F F F F T F
It turns out that this complex expression is only true in one case: if A is true, B is false, and C is false.

### Try it now

For any implication, there are three related statements, the converse, the inverse, and the contrapositive.

### Related Statements

The original implication is “if p then q”: $p\rightarrow{q}$ The converse is “if q then p”: $q\rightarrow{p}$ The inverse is “if not p then not q”: $\sim{p}\rightarrow\sim{q}$ The contrapositive is “if not q then not p”: $\sim{q}\rightarrow{p}$

### Example

Consider again the valid implication “If it is raining, then there are clouds in the sky.” Write the related converse, inverse, and contrapositive statements.

Answer: The converse would be “If there are clouds in the sky, it is raining.” This is certainly not always true. The inverse would be “If it is not raining, then there are not clouds in the sky.” Likewise, this is not always true. The contrapositive would be “If there are not clouds in the sky, then it is not raining.” This statement is valid, and is equivalent to the original implication.

### Negating Statements

Given a statement R, the statement $\sim{R}$ is called the negation of R. If R is a complex statement, then it is often the case that its negation $\sim{R}$ can be written in a simpler or more useful form. The process of finding this form is called negating R. In proving theorems it is often necessary to negate certain statements. We now investigate how to do this. We have already examined part of this topic. DeMorgan’s laws [latex-display]\sim\left(P\wedge{Q}\right)=\left(\sim{P}\right)\vee\left(\sim{Q}\right)\\\sim\left(P\vee{Q}\right)=\left(\sim{P}\right)\wedge\left(\sim{Q}\right)[/latex-display] (from "Logical Equivalence") can be viewed as rules that tell us how to negate the statements $P\wedge{Q}$ and $P\vee{Q}$. Here are some examples that illustrate how DeMorgan’s laws are used to negate statements involving “and” or “or.”

### Example

Consider negating the following statement. R : You can solve it by factoring or with the quadratic formula.

Answer: Now, R means (You can solve it by factoring) $\vee$ (You can solve it with Q.F.), which we will denote as $P\vee{Q}$. The negation of this is $\sim\left(P\vee{Q}\right)=\left(\sim{P}\right)\wedge\left(\sim{Q}\right)$. Therefore, in words, the negation of R is $\sim{R}$ : You can’t solve it by factoring and you can’t solve it with the quadratic formula. Maybe you can find $\sim{R}$ without invoking DeMorgan’s laws. That is good; you have internalized DeMorgan’s laws and are using them unconsciously.

### Example

We will negate the following sentence. R : The numbers x and y are both odd.

Answer: This statement means $\left(x\text{ is odd}\right)\wedge\left(y\text{ is odd}\right)$, so its negation is

$\sim\left[\left(x\text{ is odd}\right)\wedge\left(y\text{ is odd}\right)\right]=\sim\left(x\text{ is odd}\right)\vee\sim\left(y\text{ is odd}\right)\\\left(x\text{ is odd}\right)\wedge\left(y\text{ is odd}\right)=\left(x\text{ is even}\right)\vee\left(y\text{ is even}\right)$

Therefore the negation of R can be expressed in the following ways: $\sim{R}$: The number x is even or the number y is even. $\sim{R}$: At least one of x and y is even.