Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £29.99 £19.99. New subscribers only. T&Cs apply

Find out more

All the other gates

How can NAND gates be used to create a wide variety of other logic gates? Watch as Marc Scott explain NOT, AND, and OR gates, and more.

In this step, you are going to recap some of the logic gates you have already met, and look at all the other gates.

You should be familiar by now with the basic NAND gate and its truth table.

A NAND gate symbol (a symbol that looks like an extended D with a small circle just outside the D, touching its right-most point) and truth table (a table with three columns, labelled "Input A", "Input B", and "Output". The first row reads 0 0 1, the second 1 0 1. The third row reads 0 1 1 and the final row 1 1 0).

In the last step, you also tied the two inputs of a NAND gate together to make what is called a NOT gate. This also has its own symbol. The diagram below shows again how it is made from a NAND gate, and then shows the symbol for a NOT gate.

A triangle pointing right, with a small circle outside the triangle on its right-most tip. A larger circle to the right is connected to this small circle by a horizontal line. Another circle to the left is connected to the left-most edge of the triangle by a horizontal line.

In the video, I also went over the construction of an AND gate and showed you its truth table. Here they are again, with the symbol for an AND gate.

On the left, two NAND gates with the output from the first gate connected to the input of the second gate. In the middle, an AND gate symbol, which is the same as the NAND gate symbol except it does not have the small circle. On the right, a truth table with three columns, labelled "Input A", "Input B", and "Output". The first row reads 0 0 0, the second 1 0 0. The third row reads 0 1 0 and the final row 1 1 1.

You also independently put some NAND gates together in the configuration below, and worked out its truth table. This is called an OR gate and also has its own symbol.

On the left, three NAND gates arranged so that the outputs of two of the NAND gates form the input for the third. The two "input" NAND gates each have their two inputs connected together, so there are only two inputs in total to the circuit. In the middle, the OR gate symbol. This is like a D with the left-most straight line turned into a curve that goes into the D, and the right-most part of the D is changed to be a point. Two inputs come into this from the left and one output goes out to the right, all represented as circles connected to the rest of the symbol with horizontal lines. On the right, a truth table with three columns, labelled "Input A", "Input B", and "Output". The first row reads 0 0 0, the second 1 0 1. The third row reads 0 1 1 and the final row 1 1 1.

Another type of gate you can make is called an XOR gate (‘eXclusive OR’). Its output is 1 when one, but not both, of its inputs is 1. It can be assembled from four NAND gates like this and has the symbol shown:

On the left, four NAND gates in a circuit. The right-most of them leads to the output. The inputs of this NAND gate are the ouputs from two equivalent NAND gates. These each have one input from the fourth, left-most NAND gate, and the other inputs are direct inputs into the circuit. The fourth NAND gate takes one input from each input to the circuit. In the middle, the XOR symbol, which is the OR symbol with an extra curved line on the left-hand side, parallel to the edge of the shape of the OR gate. On the right, a truth table with three columns, labelled "Input A", "Input B", and "Output". The first row reads 0 0 0, the second 0 1 1. The third row reads 1 0 1 and the final row 1 1 0.

Any of the basic gates can be combined with a NOT gate to reverse the output. When this happens, the new gate created has an N inserted into the name, and the symbol has a small circle added to the front.

So when an AND gate is combined with a NOT gate, it produces a NAND gate — which you are already familiar with. An OR gate and a NOT gate produces a NOR gate. And an XOR gate with a NOT gate produces an XNOR gate.

Representations of the NAND, NOR, and XNOR gate symbols, which are the same as the AND, OR, and XOR gate symbols, except with the addition of a small circle between the main shape and the output, touching the right-most part of the main shape.

There is a downloadable PDF with a summary of all the gates and their NAND equivalents at the bottom of this step.

In a later step, there’s going to be a quiz on truth tables and logic gates, so it might be worth spending a little time reviewing the previous steps from this week, to ensure that you can answer all the questions.

This article is from the free online

How Computers Work: Demystifying Computation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now