Boolean logic - OCRCombining Boolean operators using AND, OR and NOT gates

At the simplest level, computers are little more than a collection of transistors and circuits. They connect together to form logic gates, which in turn are used to form logic circuits.

Part ofComputer ScienceComputational thinking, algorithms and programming

Combining Boolean operators using AND, OR and NOT gates

can be combined to form more complex and . These combinations are known as logic circuits. AND, OR and NOT gates can be used in any combination to generate the desired output.

Combining two AND gates

Two combined AND gates

Here, the output Q is 1 (TRUE) only if inputs C and D are 1 (TRUE). D is only 1 (TRUE) if inputs A and B are 1 (TRUE).

As a , this circuit is:

ABCD = A /\ BQ
00000
00100
01000
01100
10000
10100
11010
11111
A0
B0
C0
D = A /\ B0
Q0
A0
B0
C1
D = A /\ B0
Q0
A0
B1
C0
D = A /\ B0
Q0
A0
B1
C1
D = A /\ B0
Q0
A1
B0
C0
D = A /\ B0
Q0
A1
B0
C1
D = A /\ B0
Q0
A1
B1
C0
D = A /\ B1
Q0
A1
B1
C1
D = A /\ B1
Q1

In , this circuit is represented as one of:

  • Q = (A AND B) AND C
  • Q = (A/\B) /\ C
  • Q = (A.B).C

Note - D is not strictly necessary in the table, but it helps in understanding Q.

Combining OR and NOT gates

A combined OR and NOT gate

Here, the output Q is 1 (TRUE) only if inputs A and B are both 0 (FALSE).

ABCQ
0001
0110
1010
1110
A0
B0
C0
Q1
A0
B1
C1
Q0
A1
B0
C1
Q0
A1
B1
C1
Q0

In , this circuit is represented as one of:

  • Q = NOT (A OR B)
  • Q = ¬ (A \/ B)
  • Q = NOT (A + B)
  • Q = \(\overline{A+B}\)

Note - This is sometimes called the NOR gate, ie a NOT OR gate. In the same way, a NOT AND gate can be referred to as the NAND gate.