# MT1B Q2

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/10/tee-c10-s7

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

## Question

**Question (3 marks).** Show how a perceptron with w₁ = w₂ = 0.6 and bias −0.8 implements AND.

## Answer — step by step

### Given

Binary inputs 00,01,10,11.

w₁ = w₂ = 0.6; b = −0.8; output 1 when net ≥ 0.

### To find

Calculate all four net values and outputs to show AND.

### 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

### Input (0, 0)

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



$$
0.6(0)=0
$$



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



$$
0.6(0)=0
$$



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



$$
s=0+0=0
$$



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



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



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

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

### Input (0, 1)

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



$$
0.6(0)=0
$$



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



$$
0.6(1)=0.6
$$



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



$$
s=0+0.6=0.6
$$



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



$$
z=0.6+(-0.8)=-0.2
$$



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

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

### Input (1, 0)

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



$$
0.6(1)=0.6
$$



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



$$
0.6(0)=0
$$



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



$$
s=0.6+0=0.6
$$



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



$$
z=0.6+(-0.8)=-0.2
$$



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

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

### Input (1, 1)

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



$$
0.6(1)=0.6
$$



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



$$
0.6(1)=0.6
$$



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



$$
s=0.6+0.6=1.2
$$



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



$$
z=1.2+(-0.8)=0.4
$$



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

z = 0.4; 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.
