# Boolean algebra

Boolean algebra and can be used to describe logical expressions. The most common Boolean operators are AND, OR and NOT (always in capitals). Each operator has a standard symbol that can be used when drawing logic gate circuits.

An explanation of NOT, AND, OR and XOR logic gates

## NOT gate

A NOT gate has just one input. The output of the circuit will be the opposite of the input. If 0 is input, then the output is 1. If 1 is input, then 0 is output.

If A is the input and Q is the output, the truth table looks like this:

AQ
10
01

The Boolean expression is written as Q = NOT A.

## AND gate

An AND gate can be used on a gate with two inputs. AND tells us that both inputs have to be 1 in order for the output to be 1.

The truth table would look like this:

ABQ
000
010
100
111

The Boolean expression is written as Q = A AND B.

## OR gate

The OR gate has two inputs. One or both inputs must be 1 to output 1, otherwise it outputs 0.

The truth table would look like this:

ABQ
000
011
101
111

The Boolean expression is written as Q = A OR B.

## XOR gate

The exclusive OR gate works the same as an OR gate, but will output 1 only if one or the other (not both) inputs are 1.

The XOR gate is indicated with the extra curved line to the left of the main shape.

The truth table would read like this:

ABQ
000
011
101
110

The Boolean expression is written as Q = A XOR B.