# An introduction to AND gates

Binary logic gates usually have two inputs and just one output. To get an output from a binary logic AND gate, you must have a signal on * both *of the inputs. If C in the above diagram were a light, and A and B were both switches, then to turn the light on,

*switches must be switched on. If only one were on, or both were off then the light would be off.*

**both**Logic gates when they are put together can get quite complex so we need a tool called a * truth table* to help us understand all of the different permutations. With 2 inputs into this AND gate, there are 4 possible combinations of 1s and 0s. The number of permutations is always '

*'.*

**2 to the power of the number of inputs**A |
B |
C |

0 | 0 | 0 |

0 | 1 | 0 |

1 | 0 | 0 |

1 | 1 | 1 |

In the above truth table:

**if A is a 0 and B is a 0, the output C is a 0.****if A is a 0 and B is a 1, the output C is a 0.****if A is a 1 and B is a 0, the output C is a 0.****if A is a 1 and B is a 1, the output C is a 1.**

**Q1.** When we have just 2 inputs, there are a total of 4 combinations of 1s and 0s for the inputs. If you had 3 inputs, how many different combinations of 1s and 0s could you have for the inputs?**Q2.** If you had 4 inputs, how many different combinations of 1s and 0s could you have for the inputs?**Q3.** Study the following diagram:

How many inputs to the diagram are there? We only count an input if it starts from 'outside' the diagram. A, B and D start outside the diagram. C feeds in to the second AND gate as an input, but it starts life as an output of the first AND gate. It doesn't start from outside the diagram so it is not an input that we count. There are 3 inputs to the diagram (A, B and D) and one output from the diagram (E). However, it is always a good idea to think about every output from every logic gate. It helps you work out the overall logic of a diagram. Therefore, when we construct our truth table, we should show C as well.

Complete the following partially completed truth table. The number of permutations is always '* 2 to the power of the number of inputs*'. There are 3 inputs (A, B and D) so there are a total of 2 to the power of 3 = 8 different combinations. Use columns A and B to work out C. Then use columns C and D to work out column E.

Note: You can put the columns in any order you like! Put them in the order that makes working out the logic easiest for you.

A |
B |
D |
C |
E |

0 | 0 | 0 | 0 | |

0 | 0 | 1 | 0 | 0 |

0 | 1 | 0 | 0 | 0 |

0 | 1 | 1 | ||

1 | 0 | 0 | ||

1 | 0 | 1 | ||

1 | 1 | 0 | 1 | |

1 | 1 | 1 |

Something very interesting is happening in columns A, B and D. Can you spot what it is? HINT: Can you count in binary?

**Q4.** Study the following diagram:

How many inputs are there? What letters are the inputs?**Q5.** How many different combinations of inputs are there?**Q6.** How many outputs from the diagram are there? How many other outputs are there? State the letters that represent these outputs.**Q7.** Complete the following truth table: Use inputs A and B to work out column C. Then use C and D to work out column E. Finally, use columns E and F to work out column G.

A |
B |
D |
F |
C |
E |
G |

0 | 0 | 0 | 0 | 0 | 0 | 0 |

0 | 0 | 0 | 1 | 0 | ||

0 | 0 | 1 | 0 | 0 | ||

0 | 0 | 1 | 1 | 0 | ||

0 | 1 | 0 | 0 | 0 | ||

0 | 1 | 0 | 1 | 0 | ||

0 | 1 | 1 | 0 | 0 | ||

0 | 1 | 1 | 1 | 0 | ||

1 | 0 | 0 | 0 | |||

1 | 0 | |||||

Something very interesting is happening in columns A, B, D and F. Can you spot what it is? HINT: Can you count in binary?

**Q8.** Study this diagram:

How many inputs has it got? **Q9.** How many different combinations of inputs are there?**Q10.** Produce the truth table for the above diagram.