Home Chemistry Physics HTML
Night More

Revise Now

GCE Subjects

Physics Chemistry CS Accounting

Coding Lessons

Learn HTML Learn SEO


What do you want
to do?

Contact us Support

more topic chapters

Logic Gates & Truth Tables & Logic Circuits

Logic circuits are made from logic gates

Logic gates

These manipulate the bits entered to the gate and output a bit depending on the type of the gate used

We usually use a truth table to show the different combinations of bits which can be entered to the logic gate and their corresponding outputs. A bit can be either 0 or 1

You will need to know some of these gates and how to draw them and draw their truth table:

  • NOT Gate
  • Not gate computer science

    This only has a single input, so this leads to 21 possibilities.

    So the gate outputs the value opposite from which was entered. For example if a 0 was entered, it then outputs 1 (vice versa)

    Truth Table
    Input Output
    1 0
    0 1

  • AND Gate
  • AND gate computer science

    There can have two or more inputs

    In this both the inputs must be true for the output to be true.

    Truth Table
    A B Output
    0 0 0
    0 1 0
    1 0 0
    1 1 1

    It is very important to note down that if we have 2 inputs this gives us 22 possibilties and so we have 4 combinations.

    Also it better if you memorise the pattern of the input values as it is very useful.

    So the first column is half 00 and half 11

    The next column we have 0101

  • OR Gate
  • OR gate computer science

    This also can have two or more input values.

    In this gate either one of the input values must be true for the output to be true.

    Truth Table
    A B Output
    0 0 0
    0 1 1
    1 0 1
    1 1 1

  • NAND Gate
  • NAND gate Computer science

    It is the opposite of the AND gate. This is done by using a NOT gate after the AND gate.

    The output is TRUE only when both Inputs are not TRUE which means only when inputs are both true the output is false. If one input is true and the other one is not then the output is still true

    In simpler terms the output is true when neither A or B are both true

    Truth Table
    A B Output
    0 0 1
    0 1 1
    1 0 1
    1 1 0

    If you do forget how to draw the table just draw the opposite of the AND truth table.

  • NOR Gate
  • NOR gate computer science

    It can have 2 or more inputs

    The Output is only TRUE if the neither the input values are TRUE.

    So if one of the input values are true the output values is false.

    Truth Table
    A B Output
    0 0 1
    0 1 0
    1 0 0
    1 1 0

  • XOR
  • Xor gate Computer science

    It only can have 2 inputs

    The output is TRUE when the input values are different (not same).

    Truth Table
    A B Output
    0 0 0
    0 1 1
    1 0 1
    1 1 0

3 Inputs

Most questions usually have 3 inputs (A B C) and so this leads to 23 possibilities = 8 combinations

So now there are 8 rows and 3 inputs. So we also need to remember this pattern

Truth Table
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

We need to Memorise this form of inputs

The 1st column is half 0000 and half is 1111

The 2nd column is 00110011

The 3rd column is 01010101

We create the truth table based on the number of input values the ciruit begins with and not with the intermediate values

Logic expressions and Problem statements

The definitions are not required to be remembered but the understanding is important.

Usually questions gives us problem statement as the example below:

The systems reorders if the inventory level is below 10 units or if the user makes a large order

A logic proposition is the statement which can be either TRUE or FALSE. Ex - the user makes a large order can be true or false.

This must be converted to a logic expression which then we replace the the logic proposition with simple variables such as:

System reorder(output) - X

Inventory below 10 units - A

Large order - B

This is like a normal simple logic gate but usually most examples contains 3 inputs.

X = A OR B

There are somethings you need to remember. By default we name the variable of a logic proposition with a variable A - this when the value of the variable is 1.However, if we want to represent the variable which has a value of 0 (FALSE). We must use NOT A

Lets see an example - the system sends an alarm if the chemical process is not working - 0 or if the user has switched off the system - 1


The reason why we define it this way is that we expect the output X to be 1 and usually they state this in logic expressions

Truth Table for logic circuits

After finding the Logic expression we must draw the logic circuits and there is a simple way to do this

This is an example


Usually the brackets will be given but sometimes they don't give brackets such as the below example:


In this way we read from the left to the right when drawing the logic ciruits so this means we draw NOT A AND NOT B first then we Add the AND C. Note that I didn't make an intermediate variable for NOT A OR NOT B as they are very easy to do.

So when we draw the truth tables for these its best to get the intermediate values


We name a new variable for the intermediate steps. Then the D AND C are compared


Usually logic cirucits are not that easy and sometimes there could be many intermediate variables. Also you need to remember as 3 inputs are used there should be 8 possibilites.

If we want we could make intermediate variables for NOT A - E and NOT B - F

logic gates example and questions computer science. This shows an example of a past paper question of the Cambridge computer syllabus of logic gates and circuits
The logic circuit

Truth Table
0 0 0 1 1 1 0
0 0 1 1 1 1 1
0 1 0 1 0 0 0
0 1 1 1 0 0 0
1 0 0 0 1 0 0
1 0 1 0 1 0 0
1 1 0 0 0 0 0
1 1 1 0 0 0 0
E - NOT A.

This shows that the output is only true when both A and B are FALSE and C is TRUE

Simplifying the circuits or removing variety

In some questions they give a logic ciruit and ask us draw the logic circuits to draw only using a single type of Gate - NAND or NOR

There are some points you need to note:

There are infinite possibilites of replacing a gate with another gate and so there is no proper answer. Also if you do want to find the gates used to replace a particular gate, you can use my method

Say for example the AND gate must be replaced using only NAND gates

I know my output must be 0001

And the output for NAND is 1110

I need to see a connection between these two outputs

In other word if I compared the output of NAND gate with another NAND gate(or more)it must give me 0001

NAND values Missing Input Required Output
1 - 0
1 - 0
1 - 0
0 - 1

For you to identify this requires practice and a bit of trial and error

As we know that the next gate must be a NAND gate(or else this could lead to infinite possibilities).

So the value of the first NAND gate is compared with another NAND gate.

So to get 0001 as required output I must try 1110

Which is same as the first row. This means the output is split or duplicated as the diagram below

Simplifying logic gates in Cambridge computer science

They will ask to replace NOR With OR gate as this is because OR and AND and NOT gates are fundamental gates which are used to create more complex gates

Below I gave some very common examples which you have to remember

Simplifying logic gates in Cambridge computer science
AND Gate can be replaced using NAND Gates only

Simplifying logic gates in Cambridge computer science
AND Gate can be replaced using NOR Gates only

Simplifying logic gates in Cambridge computer science
OR Gate can be replaced using NAND Gates only

Simplifying logic gates in Cambridge computer science
OR Gate can be replaced using NOR Gates only

If we need to simplify just reverse the process


These are things you might like. Clicking these ads can help us improve our free services in the future...

End of Chapter Videos
Collection of Videos to Support Your Understanding.

Remember these videos are handpicked by me and I feel these are one of the best ones out there. But I constantly update this list for each chapter.The Youtubers are more than welcome to contact me.

Also, don't forget to Subscribe to our Youtube channel - Wiscus