Overview
5. Logic Gates & Boolean Algebra Basic Logic Gates (AND, OR, NOT), Universal Gates (NAND, NOR), Truth Tables, Boolean Expressions, Logic Circuits,
Topic Content
5. Logic Gates & Boolean Algebra
Introduction to Logic Gates and Boolean Algebra
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
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:
- AND Gate
- OR Gate
- NOT Gate
These gates form the basis for all digital circuit design.
AND Gate
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.
Boolean Expression
The Boolean expression for an AND gate is:
A · B
Truth Table
| A | B | Output (A · B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Practical Example
A security system may allow access only when two conditions are true, such as:
- Password is correct
- Fingerprint is verified
Only when both inputs are true does the system grant access.
OR Gate
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.
Boolean Expression
The Boolean expression for an OR gate is:
A + B
Truth Table
| A | B | Output (A + B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
Practical Example
An alarm system may activate if any one of multiple sensors detects movement.
For example:
- Door sensor
- Window sensor
If either sensor detects intrusion, the alarm is triggered.
NOT Gate
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.
Boolean Expression
The Boolean expression for a NOT gate is:
A'
or
¬A
Truth Table
| A | Output (A') |
|---|---|
| 0 | 1 |
| 1 | 0 |
Practical Example
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
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:
- NAND Gate
- NOR Gate
Because of their flexibility, these gates are widely used in digital circuit design and integrated circuits.
NAND Gate
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.
Boolean Expression
The Boolean expression for a NAND gate is:
(A · B)'
Truth Table
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Importance
The NAND gate is widely used in digital electronics because any digital circuit can be constructed using only NAND gates.
NOR Gate
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.
Boolean Expression
The Boolean expression for a NOR gate is:
(A + B)'
Truth Table
| A | B | Output |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Importance
Like the NAND gate, the NOR gate is also a universal gate, meaning all other logic gates can be constructed using only NOR gates.
Truth Tables
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:
- 1 input → 2 combinations
- 2 inputs → 4 combinations
- 3 inputs → 8 combinations
Truth tables help engineers understand how a logic circuit will behave before physically building it.
Boolean Expressions
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:
- 0 (False)
- 1 (True)
Common Boolean Operators
AND Operator (·)
Represents logical multiplication.
Example:
A · B
Output is true only when both A and B are true.
OR Operator (+)
Represents logical addition.
Example:
A + B
Output is true if at least one input is true.
NOT Operator (')
Represents logical negation or inversion.
Example:
A'
Output is the opposite of A.
Example Boolean Expression
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.
Logic Circuits
Definition
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.
Types of Logic Circuits
Combinational Circuits
In combinational circuits, the output depends only on the current inputs.
There is no memory element involved.
Examples include:
- Adders
- Subtractors
- Multiplexers
- Encoders
- Decoders
These circuits are commonly used in arithmetic operations and data processing.
Sequential Circuits
Sequential circuits depend on both the current inputs and previous outputs.
These circuits include memory elements such as flip-flops and registers.
Examples include:
- Counters
- Shift registers
- Memory units
Sequential circuits are used in systems that require storing information.
Importance of Logic Circuits
Logic circuits are essential in modern digital systems because they are used in:
- Computer processors (CPUs)
- Memory devices
- Control systems
- Communication systems
- Embedded systems
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.