## Logic Basics

True or False. That's the name of the game when it comes to logic problems. For this section, any variable given, assume that the variable can be either True or False. For example, lets define the A and B variables. At any time, A and B can either hold a value of True or False value. When discussing logic, two important operators are the 'intersection' and the 'union'. The intersection is denoted by "x" and the union is denoted by "+". In logic, these operators do not mean multiply or add. You can think of the intersection as "AND" and the union as "OR". The following are two truth tables for A and B. Notice that in the AND truth table, the result is True only when both A and B are True. If either A or B is False, then the result is False. In the OR truth table, the result is False only when both A and B are False.

Using these truth tables as guides, we can define some interesting rules.

A x True = AA x False = False A x A = A A + True = True A + False = A A + A = A |
If A is True, the result is True. If A is False, the result is False
If A is either True or False, the result is False If A is True, the result is True. If A is False, the result is False If A is either True or False, the result is True If A is True, the result is True. If A is False, the result is False If A is True, the result is True. If A is False, the result is False |

It may by easier to visualize things if we use Venn Diagrams. Venn diagrams are usually used for set theory. Boolean algebra can be viewed as a form of set theory with the special condition that all sets used can only have the values of True and False. In set theory we would write that as

**{T, F}**. In the images below it's easy to see what we mean by intersect and union now. Also, in set theory we use the number 1 to indicate the universe or everything. In the diagrams below, the light blue indicates what is selected.Here are some absorption laws. When placing a ! in front of a set, that means to select everything but the set. Also in boolean algebra, the intersection takes precedence to the union.

The following are known as De Morgan's theorems.

**!(A + B) = !A x !B****!(A x B) = !A + !B**You can plug in True and False values to verify that these relations are true. Lets take the first relation for example.

A | B | A + B |

0 | 0 | 0 |

0 | 1 | 1 |

1 | 0 | 1 |

1 | 1 | 1 |

A | B | A + B |

**!(A + B)**| !A | !B |**!A x !B**0 | 0 | 0 |

**1**| 1 | 1 |**1**0 | 1 | 1 |

**0**| 1 | 0 |**0**1 | 0 | 1 |

**0**| 0 | 1 |**0**1 | 1 | 1 |

**0**| 0 | 0 |**0**You can also see it with the Venn Diagrams.

A lot of complicated relations can be more easily viewed and understood by using Venn diagrams. However, Venn Diagrams are really only useful for the easy stuff. When we start to use more sets, then it could get messy. For example, lets say we have a problem we would like to solve. Our problem is that we would like to choose the perfect girlfriend. Not so easy you may say. However, if you define your criteria, then we can turn it into a boolean equation. Then we can solve the equation to see if all your criteria have been met. Lets first define some possible criteria.

**DD = Double D cups**

**D = D cups**

C = C cups

LH = Long hair

SH = short hair

C = C cups

LH = Long hair

SH = short hair

**B = Black**

**W = White**

**A = Asian**

Now you say to yourself, "You know? I would really like a girlfriend who is white with long hair and double D boobs, or I guess she can be black with short hair and either C sized boobs or D sized boobs, or maybe just as long as she's asian." Well, we can write out your "preferred girlfriend" as a boolean equation.

**(W x LH x DD) + (B x SH x (C + D)) + A**

Now you have your equation ready to go, you head on out to the Quick Date place where you go from table to table and have quick 1 minute "dates" with different people. You sit down at your first table and look at the young lady sitting across from you. She's white with long hair and B sized boobs. We put those values into the equation like so: (1 x 1 x 0) + (0 x 0 x (0 + 0)) + 0 = 0. The result is 0, so she is not a match for you.

You sit down at the next table and see a woman who is black with short hair and double D boobs. You seem excited, so you put it into your equation like so: (0 x 0 x 1) + (1 x 1 x (0 + 0)) + 0 = 0. It still equals 0, so she unfortunately did not meet your criteria. The next table you meet an Asian girl with long hair and B sized boobs. You put it into your equation to find (0 x 1 x 0) + (0 x 0 x (0 + 0)) + 1 = 1. That worked! You found a match and true love! Boolean algebra has saved the day!

You sit down at the next table and see a woman who is black with short hair and double D boobs. You seem excited, so you put it into your equation like so: (0 x 0 x 1) + (1 x 1 x (0 + 0)) + 0 = 0. It still equals 0, so she unfortunately did not meet your criteria. The next table you meet an Asian girl with long hair and B sized boobs. You put it into your equation to find (0 x 1 x 0) + (0 x 0 x (0 + 0)) + 1 = 1. That worked! You found a match and true love! Boolean algebra has saved the day!

Later you think to yourself, I wonder if I could have used switches that were connected to a light bulb to see if they were a match. You close the switches for when the criteria is met and leave the switches open when they are not met. If the lightbulb lights up, then you have a match. D