Binary Logic


Since computers can only understand binary which means they can only do operations in 1s and 0s. Logic gates can help with doing these operations and are the building blocks of computers.

Logic gates

There are a number of different Logic gates take in one or more input and produce a single output.

NOT

A not gate inverts an input. On a gate the small circle represents an inverted input.

Input AOutput
01
10

AND

An and gate checks if input A and B are true. If they are both true the output is true.

Input AInput BOutput
000
100
010
111

NAND

A NAND gate checks if input A and B are true. If they are both true the output is false. In short its just an inverted AND gate.

Input AInput BOutput
001
101
011
110

OR

An OR gate checks if either of the inputs are true then the output is true.

Input AInput BOutput
000
101
011
111

NOR

A NOR gate is an inverted OR gate.

Input AInput BOutput
001
100
010
110

XOR

An exclusive or only is true if one of the inputs is true but not both.

Input AInput BOutput
000
101
011
110

Symbols

Sometimes symbols are used to show the logic gates. Here are some common symbols.