Logic Circuits
Circuit 1

If we build the circuit above, switch A must be closed in order for the bulb to come on. If A is open the light is off. If A is closed the light is on. We could build a table of the possibilities.
| A | Light on/off |
| closed | on |
| open | off |
This kind of table is called a truth table and is very useful for all sorts of logic problems. Usually instead of open or closed and off or on, we use T for true and F for false.
| A | x |
| T | T |
| F | F |
Circuit 2 - Series Circuits and "AND" gates

If we put two switches in a row, what happens? In the picture above, the only way the light will come on is if BOTH switch A and switch B are closed. If either one is open, the electrical current cannot reach the light bulb. The truth table would look like this:
| A | B | x |
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
This works in real life too. Your mom might say "If you finish your homework AND take out the trash, then you can go to the movie." The same table works, you get to see the movie only when A and B are true.
We can make computer chips to do this function for us. The symbol for the chip that makes AND decisions looks like this:

The computer chip looks at A and B, and if both are true then it switches X on.
Circuit 3 - Parallel Circuits and "OR" gates

What happens if the two switches are side by side? We call this a parallel circuit. In the picture above, the light will come on if EITHER switch A and switch B is closed. Only if both are open will the light be off.
| A | B | x |
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
What if mom says "If you clean the garage OR mow the lawn, then you can go to the movie." The table above works, you get to see the movie if you do either or both.
There is also a computer chips to do this function. The symbol for the chip that makes OR decisions looks like this:

The computer chip looks at A and B, and if either (or both) are true then it switches X on.
Circuit 4 - Combination Circuits

Here's a circuit that has parallel switches followed by a switch in series. What would it take to turn the light on? There are eight possible ways to set the switches. Only three of them turn the light on. Either A OR B has to be closed AND C has to be closed.
| A | B | C | x |
| T | T | T | T |
| T | T | F | F |
| T | F | T | T |
| T | F | F | F |
| F | T | T | T |
| F | T | F | F |
| F | F | T | F |
| F | F | F | F |
This is like when mom says "If you clean the garage OR mow the lawn, AND do your homework, then you can go to the movie."
We could hook a couple of chips up to do this.

The computer chip looks at A and B, and if either (or both) are true AND C is true, then it switches X on.
Other Logic Operators/Gates
We have already seen the AND and OR operators. There are plenty of other logic operators as well. Here's a somewhat complete list.
AND - If both are true, turn the light on
OR - If either (or both) is true, turn the light on
NOT - Reverse the state. If on, turn off. If off, turn on.
NAND- Reverse the state of an AND statement. If the AND gives an on, turn off. If AND evaluates to off, turn on.
NOR- Reverse the state of an OR statement. Do the OR. If on, turn off. If off, turn on.
XOR - Exclusive or. If A OR B but not both are on, turn on.
XNOR - Exclusive NOR. If A OR B but not both are on, turn on.
Here's a link to see the gates and truth tables for these other Logic Operators
Build Truth Tables and Draw Gate Diagrams for the Following
A AND B OR NOT C
A AND NOT (B OR C AND D)
A AND NOT B OR NOT C
A OR B AND (C OR D)
Hint 1: For problems with A, B and C you need 8 rows in a truth table. A, B, C, and D needs 16.
Hint 2: Do Stuff inside parenthesis first, NOTs second, ANDs third and ORs last
Java Applets for Logic
truth tables - http://sciris.shu.edu/~borowski/Truth/TruthTableConstructor.html
electronic logic gates - http://www.d-project.com/simcir/simcir.html
Logic in Computer Programming
The same logic operators are used in computer programming. Here's a sample of code. What operators are used?
INPUT "Number of MathClub kids present? "; KidNum
INPUT "Is it raining? (Y or N) "; Rain$
IF KidNum > 17 AND Rain$ = "Y" THEN
PRINT "Wow, a lot of people came out in the rain"
END IF
IF KidNum < 10 OR Rain$ = "Y" THEN
PRINT "Maybe more people will come next time."
END IF