AND Gate using Perceptron
๐น AND Gate using Perceptron
1. ๐ง Problem Definition
The AND gate outputs 1 only when both inputs are 1.
Truth Table:
| x₁ | x₂ | Output (y) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
2. ⚙️ Perceptron Model
A perceptron computes:
Where:
- : weights
- : bias
- step(): activation function (0 or 1)
3. ๐ข Choosing Weights and Bias
To implement AND, we need:
- Output = 1 only when both inputs are 1
A valid choice:
4. ๐งฎ Verification
Let’s test all inputs:
Case 1: (0, 0)
Case 2: (0, 1)
Case 3: (1, 0)
Case 4: (1, 1)
✅ Matches the AND truth table perfectly.
5. ๐ Geometric Interpretation
- The perceptron creates a decision boundary (line):
-
Points:
- (0,0), (0,1), (1,0) → below the line → class 0
- (1,1) → above the line → class 1
➡️ This shows AND is linearly separable.
6. ๐ฏ Key Insight
The perceptron works for the AND gate because the data can be separated by a straight line.
๐น Summary
A single-layer perceptron implements an AND gate by choosing weights and bias such that only the input (1,1) produces an output above the threshold.


Comments
Post a Comment