5. Logic Gates & Boolean Algebra Basic Logic Gates (AND, OR, NOT), Universal Gates (NAND, NOR), Truth Tables, Boolean Expressions, Logic Circuits,
Digital computers operate using electronic circuits that process information in the form of binary signals (0 and 1). These signals represent the two states of a digital system such as ON/OFF, TRUE/FALSE, or HIGH/LOW.
To perform logical operations on binary data, computers use logic gates. Logic gates are the fundamental building blocks of digital circuits and are used in processors, memory units, and other electronic systems.
The mathematical system used to analyze and design these logic circuits is called Boolean Algebra. Boolean algebra was developed by the mathematician George Boole and deals with variables that have only two possible values: 0 or 1.
By combining logic gates according to Boolean expressions, complex digital systems such as adders, multiplexers, processors, and memory circuits can be built.
Basic logic gates are the simplest digital circuits that perform logical operations on one or more binary inputs to produce a single binary output.
The three fundamental logic gates are:
These gates form the basis for all digital circuit design.
The AND gate performs a logical multiplication operation. It produces an output of 1 only when all its inputs are 1. If any input is 0, the output becomes 0.
This means that all conditions must be true for the output to be true.
The Boolean expression for an AND gate is:
A · B
| A | B | Output (A · B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
A security system may allow access only when two conditions are true, such as:
Only when both inputs are true does the system grant access.
The OR gate performs a logical addition operation. It produces an output of 1 if at least one input is 1.
The output becomes 0 only when all inputs are 0.
The Boolean expression for an OR gate is:
A + B
| A | B | Output (A + B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
An alarm system may activate if any one of multiple sensors detects movement.
For example:
If either sensor detects intrusion, the alarm is triggered.
The NOT gate performs a logical inversion operation. It has only one input and one output.
The output is always the opposite of the input.
If input is 1, output becomes 0.
If input is 0, output becomes 1.
The Boolean expression for a NOT gate is:
A'
or
¬A
| A | Output (A') |
|---|---|
| 0 | 1 |
| 1 | 0 |
A NOT gate can be used in systems where an action occurs when a condition is not satisfied.
For example, a light may turn on when darkness is detected, meaning when the light sensor input is 0.
Universal gates are special types of logic gates that can be used to implement any Boolean function and can also recreate all other logic gates.
The two universal gates are:
Because of their flexibility, these gates are widely used in digital circuit design and integrated circuits.
The NAND gate is the combination of an AND gate followed by a NOT gate.
It produces an output of 0 only when all inputs are 1. In every other case, the output is 1.
The Boolean expression for a NAND gate is:
(A · B)'
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
The NAND gate is widely used in digital electronics because any digital circuit can be constructed using only NAND gates.
The NOR gate is the combination of an OR gate followed by a NOT gate.
It produces an output of 1 only when all inputs are 0.
The Boolean expression for a NOR gate is:
(A + B)'
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Like the NAND gate, the NOR gate is also a universal gate, meaning all other logic gates can be constructed using only NOR gates.
A truth table is a table that shows the relationship between all possible input combinations and their corresponding outputs for a logic gate or logical expression.
Truth tables are used to analyze and verify the behavior of digital circuits.
For a system with n inputs, the truth table will contain 2ⁿ possible combinations.
For example:
Truth tables help engineers understand how a logic circuit will behave before physically building it.
Boolean expressions are mathematical representations of logical operations using Boolean variables and operators.
These expressions describe how the output of a logic circuit depends on its inputs.
Boolean variables can only have two values:
Represents logical multiplication.
Example:
A · B
Output is true only when both A and B are true.
Represents logical addition.
Example:
A + B
Output is true if at least one input is true.
Represents logical negation or inversion.
Example:
A'
Output is the opposite of A.
Example:
Y = (A · B) + C
This means the output Y will be true if A and B are both true OR if C is true.
Boolean expressions are used in the design and simplification of digital circuits.
A logic circuit is a combination of multiple logic gates connected together to perform a specific logical operation.
Logic circuits form the foundation of digital electronics and computer systems.
They process binary data and generate outputs according to the logical relationships between inputs.
In combinational circuits, the output depends only on the current inputs.
There is no memory element involved.
Examples include:
These circuits are commonly used in arithmetic operations and data processing.
Sequential circuits depend on both the current inputs and previous outputs.
These circuits include memory elements such as flip-flops and registers.
Examples include:
Sequential circuits are used in systems that require storing information.
Logic circuits are essential in modern digital systems because they are used in:
Every modern digital device—from smartphones to supercomputers—relies on logic circuits to perform operations.
Logic gates and Boolean algebra form the foundation of digital electronics and computer architecture. By using Boolean expressions and truth tables, engineers can design logic circuits that process binary data efficiently. These circuits are the fundamental building blocks used to create complex digital systems such as microprocessors, memory units, and computer hardware.