XOR problem- how it is solved using multi layer perceptron
πΉ What is the XOR Problem?
1. π§ Definition
The XOR (Exclusive OR) function outputs:
- 1 when inputs are different
- 0 when inputs are same
Truth Table:
| x₁ | x₂ | XOR Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
2. ❌ Why is XOR a Problem for Perceptron?
A single-layer perceptron can only learn linear decision boundaries (straight lines).
XOR is not linearly separable:
-
No single straight line can separate:
- (0,1) and (1,0) → class 1
- (0,0) and (1,1) → class 0
➡️ This limitation is called the XOR problem.
3. π Geometric Intuition
-
Points lie diagonally:
- Class 1 → opposite corners
- Class 0 → opposite corners
➡️ Requires non-linear separation
πΉ Solution: Multi-Layer Perceptron (MLP)
4. π§© Key Idea
Add a hidden layer to:
- Transform input space
- Create non-linear decision boundaries
5. π️ Network Architecture
A simple MLP for XOR:
- Input layer: 2 neurons (x₁, x₂)
- Hidden layer: 2 neurons
- Output layer: 1 neuron
6. ⚙️ How It Works
Step 1: Hidden Layer creates intermediate features
Each hidden neuron acts like a linear classifier.
Example:
- Hidden neuron 1 → detects (x₁ OR x₂)
- Hidden neuron 2 → detects (x₁ AND x₂)
Step 2: Output Layer combines them
Final output:
XOR=(x1∨x2)∧¬(x1∧x2)➡️ Produces correct XOR behavior.
7. π’ Mathematical View
Hidden layer:
Output layer:
8. π― Key Insight
The hidden layer transforms the data into a space where it becomes linearly separable.
9. π§ Why This Matters
-
Solving XOR showed that:
- Single-layer networks are limited
- Multi-layer networks are powerful
➡️ This led to the development of multi layer neural netwok and deep learning
πΉ One-Line Summary
The XOR problem shows that single-layer perceptrons cannot model non-linear patterns, but multi-layer perceptrons solve it by introducing hidden layers that enable non-linear decision boundaries.




Comments
Post a Comment