Boolean logic – Binary Logic

KS3 Computer Science

11-14 Years Old

48 modules covering EVERY Computer Science topic needed for KS3 level.

GCSE Computer Science

14-16 Years Old

45 modules covering EVERY Computer Science topic needed for GCSE level.

A-Level Computer Science

16-18 Years Old

66 modules covering EVERY Computer Science topic needed for A-Level.

KS3 Binary System (14-16 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

A-Level Binary (16-18 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

Candidates should be able to:

  • explain why data is represented in computer systems in binary form
  • understand and produce simple logic diagrams using the operations NOT, AND and OR
  • produce a truth table from a given logic diagram.

Why is data represented in computer systems in binary form?

Computer systems are based on logic circuits. This type of circuit only has two states. For example, a current can either be flowing/not flowing or a switch can be either on/off. These two states are easily and reliably detected and transmitted by computer systems.

In computer systems data is represented in binary form because binary numbers are made up of only 2 digits (0/1) which means the two states of a logic circuit can easily represent/store a binary number (i.e. 0 = OFF and 1 = ON).

In computer storage, data is also easily stored in binary form as long as the storage media can represent the 2 different digits:

  • On magnetic media such as a hard drive these are represented by magnetising an area of the disk platter either North or South.
  • On optical media such as a CD/DVD/Blu Ray disk, these are represented by an area of the disk surface either reflecting or not reflecting a laser beam.

Every possible type of data such as numbers, text, audio, images, video etc. has to be converted (digitised) into binary form before it can be stored or processed by a computer system.

Conversion between denary (decimal) and binary:

Denary to binary conversionBinary to denary conversion
Denary number:
Binary conversion:
Binary number:
Denary conversion:

What are logic diagrams and how are they produced?

A logic gate performs a logical operation on one or more logic inputs and produces a single logic output. The logic used in computer systems is called Boolean logic because there are only 2 possible values, TRUE or FALSE (represented in binary as 1 or 0).

A logic diagram is a diagram that represents one or more of logic gates linked together to form a logic circuit.

In logic diagrams, symbols are used to represent logic gates, letters are used to label the input(s) and output(s) and lines are used to show how logic gates are connected.

The 3 basic logic gates are called AND, OR and NOT gates.

The symbols for the 3 basic logic gates
ANDORNOT
The logical AND symbol
The logical OR symbol
The logical NOT symbol
This logic gate has 2 inputs and 1 output.

The output is TRUE only if one input AND the other input is TRUE.

This logic gate can be written as a logic statement:

O = A AND B

This logic gate has 2 inputs and 1 output.

The output is TRUE if one input OR the other input isTRUE.

This logic gate can be written as a logic statement:

O = A OR B

This logic gate has 1 input and 1 output.

The output is TRUE if the input is FALSE and visa-versa.

This logic gate can be written as a logic statement:

O = NOT A

Examples of Logic Diagrams

A logic diagram that combines an AND and a NOT gate
A logic diagram showing an OR gate combined with a NOT gate
Logic diagram: O = (NOT A) AND B
In this logic diagram, the output will be FALSE onlywhen inputs A and B are both TRUE.

This logic diagram can be written as a logic statement:

O = NOT (A AND B)

This gate combination is known as a NAND gate and can be represented by the symbol shown below.

In this logic diagram, the output will be TRUE only when inputs A and B are both FALSE.

This logic diagram can be written as a logic statement:

O = NOT (A OR B)

This gate combination is known as a NOR gate and can be represented by the symbol shown below.

In this logic diagram, the output will be TRUE onlywhen input A is FALSE and input B is TRUE.

This logic diagram can be written as a logic statement:

O = (NOT A) AND B

 
The symbol for a NAND gate
 
The symbol for a NOR gate

The logic diagram below is for a circuit made up of AND, OR and NOT gates. It has 2 inputs (A and B) and 2 outputs (S and C). This circuit is called a half-adder and is designed to add 2 binary numbers with a carry (C) if the sum (S) is greater than 1.

Boolean logic: An example of a logic diagram, the half-adder logic circuit
An example of a logic diagram, the half-adder logic circuit

This logic diagram can be written as the following logic statements:

S = (A OR B) AND (NOT (A AND B))
C = (A AND B)


What is a truth table?

A truth table is a table that lists all the output(s) for every possible combination of input(s) in a logic diagram.

The truth tables for the 3 most common logic gates.

ANDORNOT
INPUT OUTPUT
0 0 0
0 1 0
1 0 0
1 1 1
INPUTOUTPUT000010100111INPUTOUTPUT000010100111
INPUT OUTPUT
0 0 0
0 1 1
1 0 1
1 1 1
INPUTOUTPUT000011101111INPUTOUTPUT000011101111
INPUT OUTPUT
0 1
1 0
INPUTOUTPUT0110INPUTOUTPUT0110
INPUTOUTPUT
000
010
100
111
INPUTOUTPUT
000
011
101
111
INPUTOUTPUT
01
10
INPUTOUTPUT
000
010
100
111
INPUTOUTPUT
000
011
101
111
INPUTOUTPUT
01
10

How is a truth table produced from a logic diagram?

To produce a truth table from a logic diagram you need to work out the outputs for every possible combination of inputs. If a logic diagram has only 2 inputs then there will only be 4 input combinations (00, 01, 10 and 11). If there are 3 inputs then there will be 8 possible combinations and 4 inputs would give 16 combinations. Therefore n inputs give 2n outputs.

Examples of truth tables produced from logic diagrams

A logic diagram that combines an AND and a NOT gate

A logic diagram showing an OR gate combined with a NOT gate

Logic diagram: O = (NOT A) AND B
INPUT OUTPUT
A B O
0 0 1
0 1 1
1 0 1
1 1 0
INPUTOUTPUTABO001011101110INPUTOUTPUTABO001011101110
INPUT OUTPUT
A B O
0 0 1
0 1 0
1 0 0
1 1 0
INPUTOUTPUTABO001010100110INPUTOUTPUTABO001010100110
INPUT OUTPUT
A B O
0 0 0
0 1 1
1 0 0
1 1 0
INPUTOUTPUTABO000011100110INPUTOUTPUTABO000011100110
INPUTOUTPUT
ABO
001
011
101
110
INPUTOUTPUT
ABO
001
010
100
110
INPUTOUTPUT
ABO
000
011
100
110
INPUTOUTPUT
ABO
001
011
101
110
INPUTOUTPUT
ABO
001
010
100
110
INPUTOUTPUT
ABO
000
011
100
110

The truth table for the half-adder circuit:

INPUTSOUTPUTS
ABDESC
000100
011110
101110
111001
A 14 pin semiconductor chip with a logic gate diagram overlay to show the internal connections

Logic gates are typically formed as integrated circuits on semiconductor chips.

The example shown is a 14 pin chip containing 4 NAND gates.

Extras

Further Readings: