# R23 Q1e

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/16/tee-c16-s4

Canonical: https://deep-learning-study-room.vercel.app/read/dl/tee/section/tee-c16-s4/

## Question

**Question (4 marks).** Design a perceptron network for inputs 00 → 0,10 → 0,01 → 0,11 → 1; choose suitable weights.

## Answer — step by step

### Given

Truth table: 00→0,10→0,01→0,11→1.

Weights and bias are to be designed.

### To find

Choose a perceptron that implements AND and show its four outputs.

### Formula — which one and why

**Threshold logic.** Compute the weighted sum for every binary input combination and apply the threshold rule exactly. Hidden neurons can provide separate threshold decisions before the output combines them.

step(z) returns 1 at or above zero unless the question specifies a strict inequality; otherwise it returns 0.



$$
z=\sum_iw_ix_i+b
$$





$$
\operatorname{step}(z)=\begin{cases}1&z\ge0\\0&z<0\end{cases}
$$



**Yaad rakhne ka cue:** Har input row ka sum nikalo, phir threshold lagao.

### Solution — step by step

Choose weights w₁ = w₂ = 1 and bias −1.5. Use output 1 for z ≥ 0.

### Input (0, 0)

**Step 1: multiply input 1 by its weight.**



$$
1(0)=0
$$



**Step 2: multiply input 2 by its weight.**



$$
1(0)=0
$$



**Step 3: add the two products.**



$$
s=0+0=0
$$



**Step 4: add the bias once.**



$$
z=0+(-1.5)=-1.5
$$



**Step 5: apply the stated threshold.**

z = -1.5; output = 0 because output is 1 exactly when z ≥ 0.

### Input (0, 1)

**Step 1: multiply input 1 by its weight.**



$$
1(0)=0
$$



**Step 2: multiply input 2 by its weight.**



$$
1(1)=1
$$



**Step 3: add the two products.**



$$
s=0+1=1
$$



**Step 4: add the bias once.**



$$
z=1+(-1.5)=-0.5
$$



**Step 5: apply the stated threshold.**

z = -0.5; output = 0 because output is 1 exactly when z ≥ 0.

### Input (1, 0)

**Step 1: multiply input 1 by its weight.**



$$
1(1)=1
$$



**Step 2: multiply input 2 by its weight.**



$$
1(0)=0
$$



**Step 3: add the two products.**



$$
s=1+0=1
$$



**Step 4: add the bias once.**



$$
z=1+(-1.5)=-0.5
$$



**Step 5: apply the stated threshold.**

z = -0.5; output = 0 because output is 1 exactly when z ≥ 0.

### Input (1, 1)

**Step 1: multiply input 1 by its weight.**



$$
1(1)=1
$$



**Step 2: multiply input 2 by its weight.**



$$
1(1)=1
$$



**Step 3: add the two products.**



$$
s=1+1=2
$$



**Step 4: add the bias once.**



$$
z=2+(-1.5)=0.5
$$



**Step 5: apply the stated threshold.**

z = 0.5; output = 1 because output is 1 exactly when z ≥ 0.

**Final answer:** outputs are [0, 0, 0, 1] for inputs 00, 01, 10, 11: exactly AND.

A hidden layer is unnecessary for this linearly separable truth table.

![Two inputs with weights one and bias minus one point five implement AND](https://deep-learning-study-room.vercel.app/assets/figures/and_perceptron.svg)

Diagram: Two inputs with weights one and bias minus one point five implement AND. Labels: INPUTS | WEIGHTED SUM | DECISION | x1 | x2 | w1 = 1 | w2 = 1 | z = x1 + x2 − 1.5 | step(z) | 1 when z ≥ 0 | 0 otherwise | Bias b = −1.5. Only input [1, 1] crosses the threshold.

Two inputs with weights one and bias minus one point five implement AND Tap the diagram to enlarge.
