# 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

- Circle X has radius equal to 3.
- If any circle has radius [latex]r[/latex], then its area is [latex]\pi{r}^{2}[/latex] square units.

- Circle X has area [latex]9\pi[/latex] square units.

## 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.

*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

*A*⋂

*B*

*A*or

*B*elements in the union

*A*⋃

*B*Not

*A*elements in the complement

*Ac*

*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”

*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 0Answer: The numbers that satisfy all three requirements are {2, 4, 6, 8}

### Try it now

### 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

### Example

Create a truth table for the statement [latex]A\wedge\sim\left(B\vee{C}\right)[/latex]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, [latex]B\vee{C}[/latex].

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 |

A |
B |
C |
[latex]B\vee{C}[/latex] | [latex]\sim\left(B\vee{C}\right)[/latex] |

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 |

*A*

*and*[latex]\sim\left(B\vee{C}\right)[/latex]

A |
B |
C |
[latex]B\vee{C}[/latex] | [latex]\sim\left(B\vee{C}\right)[/latex] | [latex]A\wedge\sim\left(B{\vee}C\right)[/latex] |

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 |

### Try it now

### Related Statements

The original implication is “if*p*then

*q*”: [latex]p\rightarrow{q}[/latex] The converse is “if

*q*then

*p*”: [latex]q\rightarrow{p}[/latex] The inverse is “if not

*p*then not

*q*”: [latex]\sim{p}\rightarrow\sim{q}[/latex] The contrapositive is “if not

*q*then not

*p*”: [latex]\sim{q}\rightarrow{p}[/latex]

### 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.

### Try it now

**Negating Statements**

Given a statement *R*, the statement [latex]\sim{R}[/latex] is called the

**negation**of

*R*. If

*R*is a complex statement, then it is often the case that its negation [latex]\sim{R}[/latex] 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 [latex]P\wedge{Q}[/latex] and [latex]P\vee{Q}[/latex]. 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) [latex]\vee[/latex] (You can solve it with Q.F.), which we will denote as [latex]P\vee{Q}[/latex]. The negation of this is [latex]\sim\left(P\vee{Q}\right)=\left(\sim{P}\right)\wedge\left(\sim{Q}\right)[/latex].
Therefore, in words, the negation of *R* is
[latex]\sim{R}[/latex] : You can’t solve it by factoring and you can’t solve it with the quadratic formula.
Maybe you can find [latex]\sim{R}[/latex] 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 [latex]\left(x\text{ is odd}\right)\wedge\left(y\text{ is odd}\right)[/latex], so its negation is

[latex]\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)[/latex]

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

### Try it now

## Licenses & Attributions

### CC licensed content, Original

- Introduction and Learning Objectives.
**Provided by:**Lumen Learning**License:**CC BY: Attribution. - Revision and Adaptation.
**Provided by:**Lumen Learning**License:**CC BY: Attribution.

### CC licensed content, Shared previously

- Question ID 25462, 25592.
**Authored by:**Lippman, David.**License:**CC BY: Attribution.**License terms:**IMathAS Community License CC-BY + GPL. - Math in Society.
**Authored by:**David Lippman.**Located at:**http://www.opentextbookstore.com/mathinsociety/.**License:**CC BY: Attribution. - Question ID 108578, 108573, 109608, 109064.
**Authored by:**Hartley, Josiah.**License:**CC BY: Attribution.**License terms:**IMathAS Community License CC-BY + GPL. - Question ID 25472, 25467.
**Authored by:**Shahbazian, Roy.**License:**CC BY: Attribution.**License terms:**IMathAS Community License CC-BY + GPL. - Question ID 25595, 25597.
**Authored by:**Lippman, David.**License:**CC BY: Attribution.**License terms:**IMathAS Community License CC-BY + GPL. - DeMorgan's Laws.
**Authored by:**Wikipedia.**Located at:**https://en.wikipedia.org/wiki/De_Morgan%27s_laws.**License:**CC BY-SA: Attribution-ShareAlike.