# 5.6. Complex Circuits¶

To make more complex circuits we can use the output of some logic gates as the input to other ones. Doing this allows us to compute functions not described by the basic logic rules and functions that involve more than two inputs.

Say we want to make a circuit with this truth table:

Input 1 |
Input 2 |
Output |
---|---|---|

0 |
0 |
0 |

0 |
1 |
0 |

1 |
0 |
1 |

1 |
1 |
0 |

In other words, we want the output to be on only if the first input is on and the second is not. There is no basic logic rule that matches this function. However, we could implement the desired behavior with the circuit below. Try clicking the Input switches to test each of the four possible combinations - verify the circuit does what it is supposed to.

Hint

A switch is ON when the lighter part is at the bottom.

A red circle at the output or input to a gate indicates it is on. Black is off.

The final Output light turns bright red when it is on.

DC means “Direct Current” - think of it as the battery.

More complex circuits can have more than 2 inputs or more than one output. Here is a three-input circuit - see if you can figure out what state the input switches need to be in to produce an “ON” for output.

To write the truth table for that circuit, we need to have very possible state for the three inputs. For 3 inputs, each with 2 possible states, there are \(2^3 = 8\) possible combinations (000, 001, 010, 011, 100, 101, 110, 111). Thus, the truth table needs eight rows to show the possible inputs. If we try out each possibility, we can determine the outputs that go with each of the eight possible inputs:

Input 1 |
Input 2 |
Input 3 |
Output |
---|---|---|---|

0 |
0 |
0 |
0 |

0 |
0 |
1 |
0 |

0 |
1 |
0 |
0 |

0 |
1 |
1 |
0 |

1 |
0 |
0 |
0 |

1 |
0 |
1 |
0 |

1 |
1 |
0 |
0 |

1 |
1 |
1 |
1 |

The truth table claims that the output is only ON if all three switches are ON.