Circuits are composed of inputs logic gates and outputs. There are 6 kinds of logic gates relevant in Software Development and Design. These are the AND, OR, NOT, NAND, NOR and XOR gates as displayed below.
Not my image, but very clever and summarises logic gates perfectly. Source: https://flowingdata.com/2020/10/26/halloween-logicals/
This presentation gives examples and a short summary of the fundamental logic gates used in computing and briefly describes how logic gates become CPUs, RAM and so on.
As computers work in binary, the two inputs (A and B) and the output (Q) are all stored as 0 or 1.
An AND gate results in output to be true (1) only if both inputs are true (1). Otherwise, the output stays as false (0).
In an OR gate, either A or B must be true (1) for the output to be true (1).
A NOT gate only has one input which is reversed. For example, having an input of false (0) would result in the output being true (1).
A NAND gate (short for NOT AND) functions as a AND and NOT gate by deriving an output from the two inputs and reversing it. For example, two inputs that are both false would result in the output being true.
A NOR gate (short for NOT OR) functions as an OR and NOT gate by deriving an output from the two inputs as an OR gate and reversing it. For example, an input of both true (1) and false (0) would result in the output being false (0).
A XOR gate (short for exclusive or) requires one input to be true (1) for the output to be true. However, if both inputs were to be true (1), then the output would be false (0).
A way of mathematically representing the function of a gate or circuit is through the use of a truth table. A truth table takes a look at all the possible inputs and outputs in a circuit and tabulates them. Each of the above gates posses their own truth table shown below.
Figure 1.a Different types of Truth Tables where A and B are the inputs and Q is the output.
As shown in Figure 1.a, truth tables can be used to display the workings of the gate in a simple numerical form. In this same way, truth tables can be used to simplify the workings of a circuit.
The first step is to identify all gates present in the logic circuit.
Then, construct a truth table for the circuit.
Now exclude everything but the inputs and the final output.
Now you need to look at the rows that give an output of 1 and find the similarities between them.
In this case C must be 0 to get 1 as an output. Therefore C must go through a NOT gate followed by an AND gate.
Now pay attention to the A and B columns that right there is the truth table for one specific type of gate, a NAND gate. This means that first A and B go through a NAND gate before going through the AND gate that the C input goes through.
This results in the below logic circuit:
This is how a truth table can be used to simplify a logic circuit, turning a circuit with 10 logic gates into one contain only 3. Still this only one method of simplifying logic circuits the second method of circuit simplification is called boolean algebra.