If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Logic circuits

Computers often chain logic gates together, by taking the output from one gate and using it as the input to another gate. We call that a logic circuit.
Circuits enables computers to do more complex operations than they could accomplish with just a single gate.
The smallest circuit is a chain of 2 logic gates. Consider this circuit:
A diagram where two inputs A and B go into an AND gate. The output of the AND gate goes to an OR gate. Another input C also goes into the OR gate.
Inputs A and B first go through an AND gate. Then the output of that gate goes through an OR gate, combined with another input, C.
Now interesting things happen based on which inputs are 0 or 1.
Let's set everything to on at first - all inputs are 1 or "true":
A diagram where two inputs A and B go into an AND gate. The output of the AND gate goes to an OR gate. Another input C also goes into the OR gate. All wires are shown in the on state, labeled with 1.
The output is also 1 or "true", since 1 AND 1 is 1, and 1 OR 1 is also 1.
What if we set inputs A and B to off, and keep C on?
A diagram where two inputs A and B go into an AND gate. The output of the AND gate goes to an OR gate. Another input C also goes into the OR gate. Inputs A and B are shown in the off state, and the output from their AND gate is also shown in the off state. Input C is shown in the on state. The final output is shown in the on state.
In this case, the output is still 1! That's because the final step is an OR gate, so it only needs one of the inputs to be on for it to output a 1.
Check your understanding
Now you try it. What do you think this chain will output if we set inputs A and B to 1 and set input C to 0?
A diagram where two inputs A and B go into an AND gate. The output of the AND gate goes to an OR gate. Another input C also goes into the OR gate. Inputs A and B are shown in the on state. Input C is shown in the off state.
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi

Check your understanding
Try one more combination. What if we set input A to 1, input B to 0, and input C to 0?
A diagram where two inputs A and B go into an AND gate. The output of the AND gate goes to an OR gate. Another input C also goes into the OR gate. Input A is shown in the on state, input B is shown in the off state, and input C is shown in the off state.
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi

If you're struggling to figure out what a circuit outputs, try tracing it one gate at a time. Get out a pencil and paper, start on the first gate, write its output over the wire, then look at the next gate. Theoretically, you could figure out the output for a chain of gates that's hundreds of gates long! You probably have more exciting things to do though, so it's a good thing that we typically have computers to do that for us.

🙋🏽🙋🏻‍♀️🙋🏿‍♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!

Want to join the conversation?