The fundamental building blocks of digital logic and computer hardware
Series: Digital Electronics
Post: 02 / 15
Difficulty: Beginner → Intermediate
Reading time: 18–25 minutes
Prerequisites: Number systems, binary representation, basic understanding of digital signals
What You’ll Learn
By the end of this tutorial, you’ll understand:
- What a logic gate is
- How digital circuits represent logical states
- The difference between HIGH/LOW and 1/0
- Boolean logic and Boolean expressions
- AND, OR, and NOT gates
- NAND, NOR, XOR, and XNOR gates
- Truth tables and how to read them
- Logic-gate symbols and circuit behavior
- Universal gates and why NAND and NOR are important
- How to build basic logic functions from other gates
- XOR and its importance in arithmetic circuits
- How logic gates are implemented using transistors
- Propagation delay and real-world gate behavior
- Active-high and active-low signals
- Practical examples from microcontrollers and digital systems
- Common mistakes when learning logic gates
1. Introduction: How Do Digital Circuits Make Decisions?
In the previous tutorial, we learned how digital systems represent numbers using binary, decimal, octal, and hexadecimal.
But simply representing information is not enough.
A digital system must also process information.
Consider a simple example.
Imagine a security system that should activate an alarm only when:
- The system is armed, AND
- The door is open.
Or consider a machine that should start when:
- the Start button is pressed OR
- an automatic control signal is active,
provided that an emergency-stop signal is not active.
These are logical decisions.
Digital electronics performs these decisions using circuits called logic gates.

At their simplest level, logic gates take one or more digital inputs and produce a digital output according to a defined logical rule.
For example:
A = 1
B = 1
AND Gate
A ───┐
├── AND ─── Y
B ───┘
The AND gate produces:
Y = 1
because both inputs are 1.
If either input becomes 0, the output becomes 0.
This simple behavior is the foundation of enormous amounts of digital hardware.
Modern processors, memory systems, microcontrollers, communication hardware, and digital controllers are ultimately built from combinations of logic operations.
2. What Is a Logic Gate?
A logic gate is a digital circuit that performs a Boolean logic operation on one or more input signals and produces an output signal.
A logic gate can be described using three things:
- Inputs
- Logical operation
- Output
For example, an AND gate with two inputs has:
Inputs:
A
B
Operation:
AND
Output:
Y
Its Boolean expression is:
Y = A · B
The dot means logical AND.
Another common notation is:
Y = AB
Both represent the same Boolean operation.
3. Digital Logic: 0 and 1
Logic gates work with digital states.
We usually represent them as:
0 → LOW
1 → HIGH
However, there is an important engineering distinction:
Logical 0 and logical 1 are not necessarily exact voltage values.
For example, a particular digital device may operate with a 3.3 V supply, while another may use 5 V.
The actual voltage ranges recognized as LOW and HIGH depend on the device’s electrical specifications.
For this reason, it is better to think of:
0 → logical LOW
1 → logical HIGH
rather than assuming:
0 = exactly 0 V
1 = exactly 5 V
Digital electronics uses voltage ranges and noise margins to determine whether a signal is interpreted as LOW or HIGH.
We’ll explore the electrical side later.
For now, we’ll work with ideal Boolean values:
0
1
4. Boolean Logic
Logic gates are closely connected to Boolean algebra, named after mathematician George Boole.
Boolean logic operates on variables that have two possible states:
0 or 1
The three fundamental Boolean operations are:
AND
OR
NOT
From these, we can construct other important operations such as:
NAND
NOR
XOR
XNOR
A Boolean expression describes the relationship between inputs and outputs.
For example:
Y = A · B
means:
Y is 1 only when both A and B are 1.
Similarly:
Y = A + B
represents logical OR.
This is important:
In Boolean algebra,
+represents OR and·represents AND.
They are not ordinary arithmetic operations.
For example:
1 + 1 = 1
in Boolean OR.
But:
1 + 1 = 2
in ordinary arithmetic.
Never confuse the two.

5. Truth Tables
One of the most important tools in digital logic is the truth table.
A truth table lists every possible combination of input states and shows the corresponding output.
For two inputs:
A
B
there are:
2² = 4
possible combinations.
They are:
00
01
10
11
For three inputs:
2³ = 8
possible combinations exist.
For n binary inputs:
Number of combinations = 2ⁿ
This relationship is fundamental to digital logic.
6. AND Gate
The AND gate produces HIGH only when all inputs are HIGH.
For a two-input AND gate:
Y = A · B
Truth Table
| A | B | Y = A·B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The easiest way to remember an AND gate is:
All conditions must be true.
Example
Suppose a motor should run only when:
A = Safety switch active
B = Start button pressed
Then:
Motor = A · B
The motor runs only when:
A = 1
B = 1
If either condition is false:
Motor = 0
AND Gate With More Than Two Inputs
An AND gate can have three, four, or more inputs.
For a three-input AND gate:
Y = A · B · C
The output is HIGH only when:
A = 1
B = 1
C = 1
Truth table:
| A | B | C | Y |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Only one combination produces a 1.
7. OR Gate
An OR gate produces HIGH when at least one input is HIGH.
The Boolean expression is:
Y = A + B
Truth Table
| A | B | Y = A+B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
The easiest way to remember OR is:
At least one condition must be true.
Example
Suppose a warning light should activate when either:
A = Temperature too high
B = Pressure too high
Then:
Warning = A + B
The warning activates if:
A = 1
or:
B = 1
or both.
8. AND vs OR
Beginners frequently confuse these two gates.
Remember:
AND
All inputs must be 1.
For two inputs:
1 AND 1 = 1
but:
1 AND 0 = 0
OR
At least one input must be 1.
Therefore:
1 OR 0 = 1
and:
1 OR 1 = 1
A useful mental model is:
AND → "both"
OR → "either"
9. NOT Gate
The NOT gate is different because it has only one input.
It reverses the input.
The Boolean expression is:
Y = ¬A
or:
Y = A̅
The output is the complement of the input.
Truth Table
| A | Y = NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
Therefore:
NOT 0 = 1
NOT 1 = 0
A NOT gate is also called an inverter.
Example
Suppose:
A = Door closed
Then:
NOT A = Door open
If:
A = 1
meaning the door is closed, then:
NOT A = 0
If:
A = 0
then:
NOT A = 1
10. NAND Gate
NAND means:
NOT + AND
It is an AND gate followed by a NOT operation.
Therefore:
Y = ¬(A · B)
The NAND output is the inverse of the AND output.
Truth Table
| A | B | AND | NAND |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
The easiest way to remember NAND is:
NAND is 0 only when all inputs are 1.
For two inputs:
1 NAND 1 = 0
Every other input combination produces 1.
11. NOR Gate
NOR means:
NOT + OR
Its Boolean expression is:
Y = ¬(A + B)
It is an OR gate followed by a NOT operation.
Truth Table
| A | B | OR | NOR |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 |
The easiest way to remember NOR is:
NOR is 1 only when all inputs are 0.
12. XOR Gate
XOR means:
Exclusive OR
Unlike a normal OR gate, XOR produces 1 when the inputs are different.
Its Boolean expression is:
Y = A ⊕ B
Truth Table
| A | B | XOR |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Notice the difference between OR and XOR:
OR
1 OR 1 = 1
XOR
1 XOR 1 = 0
Therefore:
OR means at least one is 1. XOR means exactly one of the two inputs is 1.
13. Why XOR Is So Important
XOR appears throughout digital electronics.
It is especially important in:
- Adders
- Arithmetic logic units
- Parity generation
- Error detection
- Comparators
- Data processing
- Bit manipulation
- Communication systems
Consider the least significant bit of binary addition:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 with carry 1
The sum bit behaves exactly like XOR.
Therefore:
Sum = A ⊕ B
This is one of the reasons XOR becomes extremely important when we study binary adders.
14. XNOR Gate
XNOR means:
Exclusive NOR
It is the inverse of XOR.
Its Boolean expression is:
Y = ¬(A ⊕ B)
Truth Table
| A | B | XOR | XNOR |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Therefore:
XNOR produces 1 when the inputs are equal.
So:
0 XNOR 0 = 1
1 XNOR 1 = 1
while:
0 XNOR 1 = 0
1 XNOR 0 = 0
This makes XNOR particularly useful for equality detection.
15. Complete Logic Gate Comparison
| Gate | Boolean Expression | Output = 1 When |
|---|---|---|
| AND | A·B | Both inputs are 1 |
| OR | A+B | At least one input is 1 |
| NOT | ¬A | Input is 0 |
| NAND | ¬(A·B) | At least one input is 0 |
| NOR | ¬(A+B) | Both inputs are 0 |
| XOR | A⊕B | Inputs are different |
| XNOR | ¬(A⊕B) | Inputs are equal |
For two-input gates, this table is worth memorizing.
16. Complete Truth Table
Here is a useful reference for the seven fundamental gates.
| A | B | AND | OR | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
The NOT gate is handled separately because it has only one input.
17. Understanding Logic Gate Symbols
Logic gates are represented using standardized schematic symbols.
Conceptually:
AND:
A ───┐
├── AND ─── Y
B ───┘
OR:
A ───┐
├── OR ─── Y
B ───┘
NOT:
A ─── NOT ─── Y
The most important visual feature to understand is the small circle, often called a bubble.
A bubble indicates inversion.
For example:
AND + inversion = NAND
OR + inversion = NOR
Similarly, an inverted output indicates that the signal is active-low or logically complemented.
When reading circuit diagrams, learning to recognize these bubbles quickly becomes extremely useful.
18. NAND and NOR: Universal Gates
One of the most important concepts in digital logic is that NAND and NOR are universal gates.
A universal gate is a gate from which we can construct the basic Boolean operations.
That means you can build:
NOT
AND
OR
using only NAND gates.
The same is true for NOR gates.
19. Building NOT Using NAND
Connect both NAND inputs to the same signal:
A ───┐
├── NAND ─── Y
A ───┘
The Boolean expression becomes:
Y = ¬(A · A)
Since:
A · A = A
we get:
Y = ¬A
Therefore:
NAND + tied inputs = NOT
20. Building AND Using NAND
First create a NAND:
X = ¬(A · B)
Then invert the result using another NAND configured as a NOT gate:
Y = ¬X
Therefore:
Y = ¬[¬(A · B)]
which simplifies to:
Y = A · B
So an AND gate can be constructed using NAND gates alone.
21. Building OR Using NAND
Using De Morgan’s law:
A + B = ¬(¬A · ¬B)
We can therefore:
- Invert A using a NAND
- Invert B using a NAND
- NAND the two inverted signals
Result:
Y = A + B
This demonstrates the power of universal gates.
22. NOR as a Universal Gate
NOR can also implement the fundamental operations.
NOT Using NOR
Tie both inputs together:
Y = ¬(A + A)
Since:
A + A = A
we get:
Y = ¬A
Therefore:
NOR + tied inputs = NOT
From this, AND and OR can also be constructed using NOR gates.
23. Why Are Universal Gates Important?
NAND and NOR are important not simply because they are mathematically interesting.
They are useful because complex digital systems can be constructed from a small set of primitive building blocks.
At the architectural level, designers can implement complex Boolean functions using networks of logic gates.
At the physical level, digital integrated circuits contain enormous numbers of transistor-based logic elements.
For example, a modern processor contains billions of transistors organized into structures that perform computation, storage, control, and communication.
Logic gates are one of the conceptual layers connecting Boolean mathematics to physical semiconductor hardware.
24. From Boolean Expression to Circuit
Suppose we have:
Y = A · B + C
According to Boolean precedence, the AND operation is performed before OR.
Therefore:
A · B
is calculated first.
Then the result is ORed with C.
Conceptually:
A ───┐
AND ───┐
B ───┘ │
OR ─── Y
C ──────────┘
The intermediate signal can be named:
X = A · B
Then:
Y = X + C
This method of breaking complex expressions into intermediate signals is extremely useful when designing or analyzing digital circuits.
25. Example: A Real Logic Function
Consider a system where an output should activate when:
- Sensor A is active AND Sensor B is active
- OR Sensor C is active.
The Boolean expression is:
Y = A·B + C
We can implement this using:
1 × AND gate
1 × OR gate
Circuit:
A ───┐
AND ───┐
B ───┘ │
OR ─── Y
C ──────────┘
Now test a few conditions.
Case 1
A = 1
B = 1
C = 0
Then:
A·B = 1
and:
Y = 1 + 0 = 1
Output is HIGH.
Case 2
A = 1
B = 0
C = 0
Then:
A·B = 0
and:
Y = 0 + 0 = 0
Output is LOW.
Case 3
A = 0
B = 0
C = 1
Then:
A·B = 0
but:
Y = 0 + 1 = 1
Output is HIGH.
This is how Boolean expressions translate directly into circuit behavior.
26. De Morgan’s Laws
Two extremely important Boolean identities are De Morgan’s laws.
They are:
¬(A · B) = ¬A + ¬B
and:
¬(A + B) = ¬A · ¬B
These identities are especially useful when simplifying circuits and converting between NAND/NOR implementations.
A useful memory rule is:
When the inversion moves across an AND or OR operation, the operation changes.
So:
NOT(AND) → OR of NOTs
and:
NOT(OR) → AND of NOTs
De Morgan’s laws become increasingly important as we move into Boolean algebra and logic simplification.
27. Active-High and Active-Low Signals
Digital systems often use signals whose meaning depends on whether they are asserted HIGH or LOW.
Active-high
A signal is active when:
Signal = 1
For example:
ENABLE = 1
means the device is enabled.
Active-low
A signal is active when:
Signal = 0
Active-low signals are commonly indicated by:
- A bar over the signal name
- A slash
_Nsuffix_Bsuffix- A bubble on a schematic symbol
For example:
RESET_N
often means:
RESET is active when LOW
This is a convention rather than a universal naming rule, so always check the relevant schematic or datasheet.
Active-low logic is extremely common in practical digital systems.
28. Logic Gates Are Not Perfect in Real Hardware
So far, we’ve treated gates as ideal mathematical objects.
Real electronic circuits behave differently.
A real logic gate has characteristics such as:
- Propagation delay
- Rise time
- Fall time
- Power consumption
- Input capacitance
- Output drive capability
- Noise margins
- Fan-in
- Fan-out
These characteristics become important when designing real digital hardware.
29. Propagation Delay
When an input changes, the output does not change instantaneously.
There is a small delay between:
Input changes
↓
Circuit responds
↓
Output changes
This is called propagation delay.
For example:
Input:
0 ─────────── 1
↓
delay
Output:
0 ─────────────── 1
The delay may be measured in units such as:
nanoseconds (ns)
or smaller depending on the technology.
In a simple low-speed circuit, this delay may not matter.
In high-speed processors and communication systems, timing becomes critical.
30. Rise Time and Fall Time
Digital signals are often simplified as:
LOW ─────── HIGH
But real signals transition over a finite amount of time.
Rise time
The time required for a signal to transition from LOW toward HIGH.
Fall time
The time required for a signal to transition from HIGH toward LOW.
Conceptually:
Voltage
│
│ ______ HIGH
│ /
│ /
│____/
│
└──────────── Time
Digital systems therefore operate with analog electrical behavior underneath their logical abstraction.
This is an important concept:
Digital electronics is built from analog electrical phenomena, but uses discrete logical interpretations of those signals.
31. Noise Margins
Real circuits are exposed to electrical noise.
Suppose a circuit expects a HIGH signal to be above a certain voltage range.
Small disturbances should not cause the circuit to randomly interpret the signal as LOW.
The difference between guaranteed output levels and required input levels contributes to the circuit’s noise margin.
Noise margins are essential for reliable digital communication and computation.
This is one reason digital systems can be robust even though real-world signals are never perfectly clean.
32. Logic Gates Inside a Microcontroller
When you program a microcontroller, you may write something as simple as:
if (button_pressed && safety_ok) {
motor_on();
}
At the programming level, this looks like software logic.
The expression:
button_pressed && safety_ok
is conceptually equivalent to:
A AND B
At a lower level, the processor executes instructions that operate on binary data using hardware structures built from digital logic.
Similarly:
if (a || b)
corresponds conceptually to:
A OR B
and:
if (a ^ b)
corresponds to:
A XOR B
The programming language is operating at a higher abstraction level, while the hardware ultimately performs operations on binary states.
33. Logic Gates and Bitwise Operations
Logic gates are also closely related to bitwise operations.
Consider:
A = 1010
B = 1100
A bitwise AND performs the AND operation independently on corresponding bits:
1010
& 1100
------
1000
Therefore:
1010 AND 1100 = 1000
Bitwise OR:
1010
| 1100
------
1110
Bitwise XOR:
1010
^ 1100
------
0110
Bitwise NOT:
~1010
inverts every bit.
This is why understanding logic gates is directly useful when programming:
- Microcontrollers
- Embedded systems
- Device drivers
- Operating systems
- Networking software
- Low-level firmware
34. Logic Gates and Digital Arithmetic
Logic gates are not only used for simple conditions.
They can be combined to create arithmetic circuits.
For example:
XOR → Sum
AND → Carry
This leads directly to the design of a half adder.
For two input bits:
A
B
the outputs are:
Sum = A ⊕ B
Carry = A · B
Truth table:
| A | B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
This tiny circuit is an important stepping stone toward:
- Full adders
- Binary adders
- Arithmetic logic units
- Processor datapaths
We will explore these circuits in greater depth later in the series.
35. Logic Gates and Memory
Logic gates can also be combined to create circuits that store information.
This is where digital electronics moves from combinational logic into sequential logic.
Combinations of gates can form:
- Latches
- Flip-flops
- Registers
- Counters
- Memory elements
These circuits introduce the concept of state.
A combinational circuit’s output depends on its current inputs.
A sequential circuit can depend on:
Current inputs + previous state
This distinction is fundamental to digital system design.
36. Combinational vs Sequential Logic

Combinational Logic
Output depends only on the current inputs.
Examples:
AND gates
OR gates
Multiplexers
Decoders
Adders
Comparators
Conceptually:
Inputs
↓
Logic
↓
Output
Sequential Logic
Output depends on current inputs and stored state.
Examples:
Flip-flops
Registers
Counters
State machines
Conceptually:
┌──────────┐
Inputs →│ Logic │→ Outputs
└────┬─────┘
│
↓
Memory
│
└──────→ back into logic
Understanding basic logic gates is therefore the foundation for both categories.
37. Common Mistakes
Mistake 1: Thinking OR Means Exactly One
This is false.
OR gives:
1 OR 1 = 1
XOR gives:
1 XOR 1 = 0
So:
OR → one or more
XOR → exactly one, for two inputs
Mistake 2: Confusing NAND and NOR
Remember:
NAND = NOT AND
NOR = NOT OR
Therefore:
NAND = 0 only when all inputs are 1
NOR = 1 only when all inputs are 0
Mistake 3: Treating Boolean + Like Arithmetic +
In Boolean algebra:
1 + 1 = 1
because + represents OR.
Do not interpret Boolean expressions as ordinary arithmetic.
Mistake 4: Forgetting That NOT Has One Input
AND, OR, NAND, NOR, XOR, and XNOR are commonly introduced with two inputs.
NOT is different:
One input → one output
It simply inverts the signal.
Mistake 5: Assuming Digital Signals Are Perfect 0 V and 5 V
Real digital circuits use voltage ranges.
Always consult the device’s electrical specifications when dealing with actual hardware.
38. A Practical Example: Automatic Fan Controller
Let’s design a simple logical system.
Suppose a cooling fan should turn ON when:
Temperature is high
AND
System is enabled
Define:
T = Temperature high
E = System enabled
F = Fan
The Boolean expression is:
F = T · E
Truth table:
| T | E | F |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
The system therefore requires an AND operation.
Now suppose we add an emergency override:
Override = O
and the fan should turn on when:
Temperature is high AND system enabled
OR
Emergency override is active
The expression becomes:
F = T·E + O
Now our circuit requires:
1 AND gate
1 OR gate
This is how practical control requirements can be translated into Boolean logic and then into hardware.
39. A Second Example: Equality Detection
Suppose two binary signals must be compared.
For two individual bits:
A
B
we want:
Output = 1
when:
A = B
XNOR does exactly this.
Truth table:
| A | B | XNOR |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Therefore:
A XNOR B = 1
means:
A = B
For multi-bit equality comparison, XNOR gates can be combined with AND logic.
For example:
A = 1011
B = 1011
Each corresponding bit is compared.
If every bit matches, the overall equality output is HIGH.
This principle is used in digital comparators and processor logic.
40. From Gates to a Computer
At this point, you might wonder:
How can seven basic logic gates eventually lead to a computer?
The answer is hierarchical design.
A simplified conceptual hierarchy looks like:
Transistors
↓
Logic Gates
↓
Combinational Circuits
↓
Adders / Multiplexers / Decoders
↓
Registers / ALUs / Control Logic
↓
Processor Datapath
↓
CPU / Microcontroller
↓
Computer System
This is one of the most important ideas in digital electronics.
Complex systems are constructed by combining simpler building blocks.
41. Quick Reference
Fundamental Gates
AND
→ Output is 1 when all inputs are 1
OR
→ Output is 1 when at least one input is 1
NOT
→ Output is the inverse of the input
Derived Gates
NAND
→ NOT AND
NOR
→ NOT OR
XOR
→ 1 when inputs differ
XNOR
→ 1 when inputs are equal
Essential Boolean Expressions
AND:
Y = A·B
OR:
Y = A+B
NOT:
Y = ¬A
NAND:
Y = ¬(A·B)
NOR:
Y = ¬(A+B)
XOR:
Y = A⊕B
XNOR:
Y = ¬(A⊕B)
42. Practice Problems
Try solving these without looking at the answers.
Problem 1
What is the output of an AND gate when:
A = 1
B = 0
Problem 2
What is the output of:
1 OR 0
Problem 3
What is:
NOT 1
Problem 4
What is:
1 NAND 1
Problem 5
What is:
0 NOR 0
Problem 6
What is:
1 XOR 1
Problem 7
What is:
0 XNOR 0
Problem 8
Evaluate:
Y = A·B + C
when:
A = 1
B = 0
C = 1
Problem 9
Evaluate:
Y = A·B + C
when:
A = 1
B = 1
C = 0
Problem 10
For two inputs, how many rows are required in a complete truth table?
Answers
1.
1 AND 0 = 0
2.
1 OR 0 = 1
3.
NOT 1 = 0
4.
1 NAND 1 = 0
5.
0 NOR 0 = 1
6.
1 XOR 1 = 0
7.
0 XNOR 0 = 1
8.
Y = A·B + C
= 1·0 + 1
= 0 + 1
= 1
9.
Y = A·B + C
= 1·1 + 0
= 1 + 0
= 1
10.
For two inputs:
2² = 4
Therefore, the truth table requires 4 rows.
43. Frequently Asked Questions
What is a logic gate?
A logic gate is a digital circuit that performs a Boolean operation on one or more input signals and produces an output.
What are the basic logic gates?
The fundamental gates commonly introduced in digital electronics are:
- AND
- OR
- NOT
- NAND
- NOR
- XOR
- XNOR
What is the difference between OR and XOR?
OR produces 1 when at least one input is 1.
XOR produces 1 when the inputs are different.
For two inputs:
1 OR 1 = 1
1 XOR 1 = 0
Why are NAND and NOR called universal gates?
NAND and NOR are called universal gates because any Boolean function can be constructed using only NAND gates or only NOR gates.
They can be used to construct NOT, AND, and OR operations.
Which logic gate is used for equality comparison?
XNOR is commonly used for equality comparison because it produces 1 when its two inputs are equal.
Why is XOR used in adders?
For a half adder, the sum bit of two input bits is:
Sum = A ⊕ B
The carry is:
Carry = A·B
Therefore XOR and AND form the core logic of a half-adder.
Are logic gates made from transistors?
Yes. In modern digital integrated circuits, logic functions are implemented using transistor-based circuitry, commonly using CMOS technology.
Are logic gates used inside microcontrollers?
Yes. Microcontrollers contain extensive digital logic for processing instructions, manipulating data, controlling peripherals, handling registers, and performing other operations.
44. What You Should Know Now
After completing this tutorial, you should be comfortable with the following:
AND → all inputs must be 1
OR → at least one input must be 1
NOT → reverses the input
NAND → NOT AND
NOR → NOT OR
XOR → inputs are different
XNOR → inputs are equal
You should also understand:
Truth tables
Boolean expressions
Universal gates
De Morgan's laws
Active-high / active-low
Propagation delay
Bitwise logic
Combinational logic
Sequential logic
Most importantly, you should now see the connection between mathematical Boolean logic and physical digital hardware.
45. The Bigger Picture
Digital electronics can initially seem like a collection of unrelated topics:
Binary
Logic gates
Boolean algebra
Adders
Multiplexers
Flip-flops
Registers
Counters
Processors
But these topics form a hierarchy.
We started with number systems.
Then we introduced logic gates.
Logic gates can be combined into larger circuits.
Those circuits can perform arithmetic, select data, compare values, and store state.
Eventually, these structures become the building blocks of processors and complete digital systems.
The progression looks like:
Number Systems
↓
Binary Data
↓
Logic Gates
↓
Boolean Algebra
↓
Combinational Circuits
↓
Sequential Circuits
↓
Registers & Memory
↓
Processor Architecture
↓
Embedded & Digital Systems
Understanding this hierarchy will make the later topics in digital electronics much easier.
What’s Next?
We’ve learned how individual logic gates make decisions.
But real digital systems rarely contain just one gate.
The next step is to learn how multiple logic gates are combined to create useful digital circuits.
In the next tutorial, we’ll study Boolean Algebra and Logic Simplification.
You’ll learn:
- Boolean laws
- Identity and null laws
- Idempotent laws
- Complement laws
- Absorption laws
- De Morgan’s laws
- Simplifying Boolean expressions
- SOP and POS forms
- Minterms and maxterms
- Truth-table-based simplification
- Why simplification reduces hardware
- How Boolean expressions translate into practical circuits
Next: Boolean Algebra & Logic Simplification — The Mathematics Behind Digital Circuits


