# Boolean Logic

Boolean logic is the most commonly used logic system nowadays. This is due mostly to the prevalence of computers, which base all of their calculations on Boolean logic. Boolean logic is a binary logic system, meaning that it takes into account two possible states: 0 and 1. These can then be translated into other, more useful meanings. For example, 0 could represent the state "false" and 1 could be "true". Thus one could use Boolean logic to assess the validity of a statement. 0 and 1 can also represent on and off, yes and no, or basically any other pair of opposite states.

Boolean logic is really just a set of rules for the manipulation of given inputs. It consists of a set of "logic gates", each of which is a different set of rules. The three main logic gates are AND, OR, and NOT. AND and OR require two inputs, whereas NOT only requires one. Here is an explanation of each gate:

AND

The visual representation of the AND gate looks like this:
Sometimes, it is also written like this: Ç (ie. "p AND q" can also be written as "p Ç q")

When two inputs are entered into the AND gate, the output is always 0 unless both inputs are 1. Here is a truth table for the AND gate:

 p q p AND q 1 1 1 1 0 0 0 1 0 0 0 0

OR

The visual representation of the OR gate looks like this:
Sometimes, it is also written like this: È (ie. "p OR q" can also be written "p È q")

When two inputs are entered into the OR gate, the output is always 1 unless both inputs are 0. Here is a truth table for the OR gate:

 p q p OR q 1 1 1 1 0 1 0 1 1 0 0 0

NOT

The visual representation of the NOT gate looks like this:
Sometimes, it is also written like this: - (ie. "NOT p" can also be written as "-p")

When an input is entered into the NOT gate, the output is the opposite of that input. In other words, if the input is 1, the output is 0. And if the input is 0, the output is 1.

Since both the input and output for a gate are ones and zeros, the output from one gate can serve as the input for another. Two or more gates linked in this fashion are called a logic network. The truth table still functions the same way. For example, consider the network below.

P and q are both inputs to the AND gate. Then, the output from the AND gate and q are inputs for the OR gate. The output from the OR gate is input for the NOT gate. The output from the NOT gate is the final result for the whole network.

Now it's your turn. See if you can follow through the logic network and fill in the two remaining cells in the truth table below.

 p q OUT 1 1 0 1 0 1 0 1 0 0
And there you have it. Boolean logic in short. If you would like a more in-depth explanation, go to http://tqd.advanced.org/2723/lessons.html.