2.4 – Boolean logic

πŸŽ‡2.4.1 Boolean logic

This section covers:

  • Simple logic diagrams using the operators AND, OR and NOT

  • Truth tables

  • Combining Boolean operators using AND, OR and NOT

  • Applying logical operators in truth tables to solve problems

🏠 Click here to go back to the main page.

This page is NOT YET READY


Why data is represented in computer systems in binary form



Electronic computers use electrical signals to control physical things and to represent data.

It is easy to understand how physical devices such as lights and motors can be controlled by an electrical signal - when the electric circuit is completed, electricity will flow and the light or motor will turn on.

We can also store date using electricity, and this is more difficult to understand. To do this, we need to convert the data into binary form, so that the information that it represents is made up of two values, zero and one. if you want to look at this in more depth, look at the section on topic 2.8 Data Representation.

So, the reason that data is represented in computer systems in binary form is because they use electrical signals which are either on or off, and we can use binary which has two different values one or zero to represent those signals.



Simple logic diagrams using the operations AND, OR and NOT



Of course, in real life, we will need to deal with situations that involve more than one signal.

Situations such as "Turn the light on, if it is dark outside, OR if the time is after 5p.m." and "Show the final score if the player has just died AND they have no more lives", involve two different signals.

We refer to the signals as logic signals and they can only have two values, TRUE and FALSE. On a computer, we can use a binary 1 to represent TRUE and a binary 0 to represent FALSE.

There are three basic logic operations:

AND

A logical AND operation will only give a TRUE value if both inputs are TRUE. This is written as

C = A β‹€ B which is read as "C is equal to A AND B"

OR

A logical OR operation will only give a FALSE value if both inputs are FALSE. This is written as

C = A ⋁ B which is read as "C is equal to A OR B"

NOT

A logical NOT operation simply reverse whatever the input is. This is written as

C = Β¬ A which is read a "C is equal to NOT A"

logicsymbols



Truth tables



Questions involving logic symbols will usually involve you using a truth table and being able to read a logic diagram. Here are some examples:

Question: Draw the truth table and logic diagram for C = A β‹€ B

Answer:

This is a simple logic problem involving one logic gate.



The truth table for this is:

logicQ1

The logic diagram looks like this:

(remember to add the labels!)

logicq1diag



Combining boolean operators using AND, OR and NOT to two levels



The GCSE Specification says that you must be able to use logic diagrams and truth tables to two levels. This is simply an extension of what you have already done, but the output of the first level will be the input of the second level. Here is an example question from the 2018 paper 2:



2018paper2questions3

Answer:

The first part of the question (3a i) is asking you to write the names of the two logic symbols. The one on the left is "AND", and the one on the right is "NOT". (Note, the question does not ask for this next part, shown in bold)

The logic diagram is showing

Q = NOT (A AND B) or

Q = Β¬(A β‹€ B)

To complete the truth table, remember the rule that an AND will only be true if both the inputs are true. All you have to do is write the opposite (the NOT) of that answer

qequalsnotaandb



The next question (3b) needs a logic diagram. There will be two inputs (A and B), and one output (Q). The input B will need a NOT symbol before the AND gate. This gives:

qequalsaandnotb



Applying logical operators in appropriate truth tables to solve problems