Deep Learning · TEE · section

R26 Q2a

Re examination February 2026 fully solved

Question

Question (10 marks). Use the sigmoid network Input x = [0.25, 0.7]. Each row below lists the incoming weights of one receiving neuron. W₁ is shown below; b₁ = [1, 1]; W₂ is shown below; b₂ = [1, 1]. Hidden and output activations are sigmoid. Target y = [0.7, 0.3]. Learning rate η = 1. Here w₁ = x₁ → h₁, w₅ = h₁ → o₁ and w₇ = h₁ → o₂. Run forward and backward passes and update w₁, w₅, w₇. The paper gives no explicit loss formula.

Given matrices for this question Tap the diagram to enlarge.
R26 Q2a weights and both target outputs Tap the diagram to enlarge.

Answer — step by step

Given

Input x = [0.25,0.7]; W₁ and W₂ are printed with the question.

Hidden biases = [1,1]; output biases = [1,1]; all activations sigmoid.

Target = [0.7,0.3]; η = 1.

The paper omits the loss; this solution explicitly assumes half summed squared loss.

To find

Calculate forward values and update only w₁ = x₁→h₁, w₅ = h₁→o₁ and w₇ = h₁→o₂.

Formula — which one and why

Forward propagation. Evaluate one layer completely before supplying its activated outputs to the next layer. Each layer has its own weights and biases.

x = input vector; h = hidden outputs; W₁,b₁ = hidden parameters; W₂,b₂ = output parameters; f₁,f₂ = the stated activations.

z_h=W_1x+b_1LaTeX: z_h=W_1x+b_1
h=f_1(z_h)LaTeX: h=f_1(z_h)
z_o=W_2h+b_2LaTeX: z_o=W_2h+b_2
o=f_2(z_o)LaTeX: o=f_2(z_o)

Yaad rakhne ka cue: Pehli layer ka activated output hi agli layer ka input hai.

Half summed squared loss. This loss convention takes one-half of the sum of squared prediction errors. Use it when the question specifies it, or explicitly state it as an assumption when the paper omits the loss. Differentiating cancels the factor one-half against the square derivative.

oⱼ = output j; yⱼ = target j; L = half summed squared loss under the stated or explicitly assumed convention.

L=\frac12\sum_j(o_j-y_j)^2LaTeX: L=\frac12\sum_j(o_j-y_j)^2
\frac{\partial L}{\partial o_j}=o_j-y_jLaTeX: \frac{\partial L}{\partial o_j}=o_j-y_j

Yaad rakhne ka cue: Half aur square ka 2 cancel: output derivative = prediction − target.

Sigmoid and its slope. Use sigmoid when the neuron is specified to squash its preactivation into (0,1). Once its output is known, its derivative needs only output × (1−output).

z = preactivation; p = sigmoid output; e is the exponential base, not a prediction error in this formula.

p=\frac{1}{1+e^{-z}}LaTeX: p=\frac{1}{1+e^{-z}}
\frac{dp}{dz}=p(1-p)LaTeX: \frac{dp}{dz}=p(1-p)

Yaad rakhne ka cue: Sigmoid output p; uska slope p × (1−p).

Backpropagation. The loss tells us how each output must change. Multiply by that neuron’s activation slope to obtain its delta. A weight gradient is receiving delta × sending value. Hidden deltas must include every outgoing path.

δ (delta) = derivative of loss with respect to a neuron’s preactivation; f′ = activation derivative; aᵢ = sending activation; Wⱼᵢ = connection weight. Use the exact loss scaling in the question.

\delta_{o_j}=\frac{\partial L}{\partial o_j}f_o\prime(z_{o_j})LaTeX: \delta_{o_j}=\frac{\partial L}{\partial o_j}f_o\prime(z_{o_j})
\delta_{h_i}=f_h\prime(z_{h_i})\sum_jW_{ji}^{(2)}\delta_{o_j}LaTeX: \delta_{h_i}=f_h\prime(z_{h_i})\sum_jW_{ji}^{(2)}\delta_{o_j}
\frac{\partial L}{\partial W_{ji}}=\delta_ja_iLaTeX: \frac{\partial L}{\partial W_{ji}}=\delta_ja_i
\frac{\partial L}{\partial b_j}=\delta_jLaTeX: \frac{\partial L}{\partial b_j}=\delta_j
W_{ji,\mathrm{new}}=W_{ji}-\eta\frac{\partial L}{\partial W_{ji}}LaTeX: W_{ji,\mathrm{new}}=W_{ji}-\eta\frac{\partial L}{\partial W_{ji}}

Yaad rakhne ka cue: Receiving delta × sending value = us connection ka gradient.

Solution — step by step

Step 1 map the arrows. Each row of W₁ receives all inputs; each row of W₂ receives all hidden outputs. Bias is added once per receiving neuron. All gradients below use the OLD weights from this same forward pass.

Hidden neuron 1:

z_{h_1} = (0.2 \times  0.25) + (0.15 \times  0.7) + (1) = 1.155LaTeX: z_{h_1} = (0.2 \times 0.25) + (0.15 \times 0.7) + (1) = 1.155
h_{1}=\frac{1}{1+e^{-(1.155)}}=0.760423002LaTeX: h_{1}=\frac{1}{1+e^{-(1.155)}}=0.760423002

Hidden neuron 2:

z_{h_2} = (0.28 \times  0.25) + (0.3 \times  0.7) + (1) = 1.28LaTeX: z_{h_2} = (0.28 \times 0.25) + (0.3 \times 0.7) + (1) = 1.28
h_{2}=\frac{1}{1+e^{-(1.28)}}=0.782449776LaTeX: h_{2}=\frac{1}{1+e^{-(1.28)}}=0.782449776

Output neuron 1:

z_{o_1} = (0.1 \times  0.760423002) + (0.24 \times  0.782449776) + (1) = 1.263830247LaTeX: z_{o_1} = (0.1 \times 0.760423002) + (0.24 \times 0.782449776) + (1) = 1.263830247
o_{1}=\frac{1}{1+e^{-(1.263830247)}}=0.779684759LaTeX: o_{1}=\frac{1}{1+e^{-(1.263830247)}}=0.779684759

Output neuron 2:

z_{o_2} = (0.12 \times  0.760423002) + (0.21 \times  0.782449776) + (1) = 1.255565213LaTeX: z_{o_2} = (0.12 \times 0.760423002) + (0.21 \times 0.782449776) + (1) = 1.255565213
o_{2}=\frac{1}{1+e^{-(1.255565213)}}=0.778261739LaTeX: o_{2}=\frac{1}{1+e^{-(1.255565213)}}=0.778261739

Step 2 loss convention. This worked solution uses half summed squared loss, L = ½Σ(o − y)². Follow the loss specified in the question; where none is supplied, this is an explicit assumption.

Prediction minus target = [0.079684759, 0.478261739]. Squared errors = [0.006349661, 0.228734291]. Half-sum squared loss = 0.117541976; mean squared error = 0.117541976. These are different unless the number of output components makes the scale coincide.

Output delta 1:

\delta_{o_1} = 1 \times  (0.779684759-0.7) \times  0.171776436 = 0.013687964LaTeX: \delta_{o_1} = 1 \times (0.779684759-0.7) \times 0.171776436 = 0.013687964

The derivative is o(1−o).

Output delta 2:

\delta_{o_2} = 1 \times  (0.778261739-0.3) \times  0.172570404 = 0.082533822LaTeX: \delta_{o_2} = 1 \times (0.778261739-0.3) \times 0.172570404 = 0.082533822

The derivative is o(1−o).

Step 3 output weights. Gradient = receiving delta × sending activation. An output bias gradient equals its delta.

h1 → o1:

The calculation on h1 → o1
Sending activation0.760423002h1
Receiving delta0.013687964δ at o1
Connection gradient0.010408643h1 → o1
Now update this weight
Old weight0.1
New weight0.089591357

Subtract η × gradient = 0.010408643. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies its activation.

g_{1,1}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{1,1}}=\delta_{o_1}h_1LaTeX: g_{1,1}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{1,1}}=\delta_{o_1}h_1
g_{1,1}^{(2)}=(0.013687964)\times(0.760423002)\approx 0.010408643LaTeX: g_{1,1}^{(2)}=(0.013687964)\times(0.760423002)\approx 0.010408643

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(2)}_{1,1,\mathrm{new}}=0.1-1(0.010408643)\approx 0.089591357LaTeX: W^{(2)}_{1,1,\mathrm{new}}=0.1-1(0.010408643)\approx 0.089591357

h2 → o1:

The calculation on h2 → o1
Sending activation0.782449776h2
Receiving delta0.013687964δ at o1
Connection gradient0.010710144h2 → o1
Now update this weight
Old weight0.24
New weight0.229289856

Subtract η × gradient = 0.010710144. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies its activation.

g_{1,2}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{1,2}}=\delta_{o_1}h_2LaTeX: g_{1,2}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{1,2}}=\delta_{o_1}h_2
g_{1,2}^{(2)}=(0.013687964)\times(0.782449776)\approx 0.010710144LaTeX: g_{1,2}^{(2)}=(0.013687964)\times(0.782449776)\approx 0.010710144

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(2)}_{1,2,\mathrm{new}}=0.24-1(0.010710144)\approx 0.229289856LaTeX: W^{(2)}_{1,2,\mathrm{new}}=0.24-1(0.010710144)\approx 0.229289856

h1 → o2:

The calculation on h1 → o2
Sending activation0.760423002h1
Receiving delta0.082533822δ at o2
Connection gradient0.062760617h1 → o2
Now update this weight
Old weight0.12
New weight0.057239383

Subtract η × gradient = 0.062760617. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies its activation.

g_{2,1}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{2,1}}=\delta_{o_2}h_1LaTeX: g_{2,1}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{2,1}}=\delta_{o_2}h_1
g_{2,1}^{(2)}=(0.082533822)\times(0.760423002)\approx 0.062760617LaTeX: g_{2,1}^{(2)}=(0.082533822)\times(0.760423002)\approx 0.062760617

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(2)}_{2,1,\mathrm{new}}=0.12-1(0.062760617)\approx 0.057239383LaTeX: W^{(2)}_{2,1,\mathrm{new}}=0.12-1(0.062760617)\approx 0.057239383

h2 → o2:

The calculation on h2 → o2
Sending activation0.782449776h2
Receiving delta0.082533822δ at o2
Connection gradient0.06457857h2 → o2
Now update this weight
Old weight0.21
New weight0.14542143

Subtract η × gradient = 0.06457857. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies its activation.

g_{2,2}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{2,2}}=\delta_{o_2}h_2LaTeX: g_{2,2}^{(2)}=\frac{\partial L}{\partial W^{(2)}_{2,2}}=\delta_{o_2}h_2
g_{2,2}^{(2)}=(0.082533822)\times(0.782449776)\approx 0.06457857LaTeX: g_{2,2}^{(2)}=(0.082533822)\times(0.782449776)\approx 0.06457857

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(2)}_{2,2,\mathrm{new}}=0.21-1(0.06457857)\approx 0.14542143LaTeX: W^{(2)}_{2,2,\mathrm{new}}=0.21-1(0.06457857)\approx 0.14542143

Step 4 hidden deltas. A hidden unit can influence EVERY connected output, so add those paths BEFORE multiplying by the hidden activation derivative.

Hidden 1 downstream contribution:

Calculate each outgoing path using the old outgoing weight and that output's delta.

Several output paths meet at this hidden neuron
Output 1
Output delta0.013687964
Old outgoing weight0.1
Path contribution0.001368796
Output 2
Output delta0.082533822
Old outgoing weight0.12
Path contribution0.009904059
Add every path contribution0.011272855Then multiply by the hidden activation derivative.

Multiply within each path. Add the resulting contributions at the shared hidden neuron.

Contribution from output 1.

C_1=(0.1)\times(0.013687964)\approx 0.001368796LaTeX: C_1=(0.1)\times(0.013687964)\approx 0.001368796

Contribution from output 2.

C_2=(0.12)\times(0.082533822)\approx 0.009904059LaTeX: C_2=(0.12)\times(0.082533822)\approx 0.009904059

Accumulate the contributions, then apply the hidden activation derivative below.

\text{Sum}=C_1+C_2\approx 0.011272855LaTeX: \text{Sum}=C_1+C_2\approx 0.011272855
\delta_{h_1} = 0.011272855 \times  0.18217986 = 0.002053687LaTeX: \delta_{h_1} = 0.011272855 \times 0.18217986 = 0.002053687

Hidden 2 downstream contribution:

Calculate each outgoing path using the old outgoing weight and that output's delta.

Several output paths meet at this hidden neuron
Output 1
Output delta0.013687964
Old outgoing weight0.24
Path contribution0.003285111
Output 2
Output delta0.082533822
Old outgoing weight0.21
Path contribution0.017332103
Add every path contribution0.020617214Then multiply by the hidden activation derivative.

Multiply within each path. Add the resulting contributions at the shared hidden neuron.

Contribution from output 1.

C_1=(0.24)\times(0.013687964)\approx 0.003285111LaTeX: C_1=(0.24)\times(0.013687964)\approx 0.003285111

Contribution from output 2.

C_2=(0.21)\times(0.082533822)\approx 0.017332103LaTeX: C_2=(0.21)\times(0.082533822)\approx 0.017332103

Accumulate the contributions, then apply the hidden activation derivative below.

\text{Sum}=C_1+C_2\approx 0.020617214LaTeX: \text{Sum}=C_1+C_2\approx 0.020617214
\delta_{h_2} = 0.020617214 \times  0.170222124 = 0.003509506LaTeX: \delta_{h_2} = 0.020617214 \times 0.170222124 = 0.003509506

Step 5 input weights. Multiply the hidden delta by the corresponding raw input, not by the hidden output.

x1 → h1:

The calculation on x1 → h1
Sending input0.25x1
Receiving delta0.002053687δ at h1
Connection gradient0.000513422x1 → h1
Now update this weight
Old weight0.2
New weight0.199486578

Subtract η × gradient = 0.000513422. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies the input value.

g_{1,1}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{1,1}}=\delta_{h_1}x_1LaTeX: g_{1,1}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{1,1}}=\delta_{h_1}x_1
g_{1,1}^{(1)}=(0.002053687)\times(0.25)\approx 0.000513422LaTeX: g_{1,1}^{(1)}=(0.002053687)\times(0.25)\approx 0.000513422

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(1)}_{1,1,\mathrm{new}}=0.2-1(0.000513422)\approx 0.199486578LaTeX: W^{(1)}_{1,1,\mathrm{new}}=0.2-1(0.000513422)\approx 0.199486578

x2 → h1:

The calculation on x2 → h1
Sending input0.7x2
Receiving delta0.002053687δ at h1
Connection gradient0.001437581x2 → h1
Now update this weight
Old weight0.15
New weight0.148562419

Subtract η × gradient = 0.001437581. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies the input value.

g_{1,2}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{1,2}}=\delta_{h_1}x_2LaTeX: g_{1,2}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{1,2}}=\delta_{h_1}x_2
g_{1,2}^{(1)}=(0.002053687)\times(0.7)\approx 0.001437581LaTeX: g_{1,2}^{(1)}=(0.002053687)\times(0.7)\approx 0.001437581

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(1)}_{1,2,\mathrm{new}}=0.15-1(0.001437581)\approx 0.148562419LaTeX: W^{(1)}_{1,2,\mathrm{new}}=0.15-1(0.001437581)\approx 0.148562419

x1 → h2:

The calculation on x1 → h2
Sending input0.25x1
Receiving delta0.003509506δ at h2
Connection gradient0.000877376x1 → h2
Now update this weight
Old weight0.28
New weight0.279122624

Subtract η × gradient = 0.000877376. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies the input value.

g_{2,1}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{2,1}}=\delta_{h_2}x_1LaTeX: g_{2,1}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{2,1}}=\delta_{h_2}x_1
g_{2,1}^{(1)}=(0.003509506)\times(0.25)\approx 0.000877376LaTeX: g_{2,1}^{(1)}=(0.003509506)\times(0.25)\approx 0.000877376

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(1)}_{2,1,\mathrm{new}}=0.28-1(0.000877376)\approx 0.279122624LaTeX: W^{(1)}_{2,1,\mathrm{new}}=0.28-1(0.000877376)\approx 0.279122624

x2 → h2:

The calculation on x2 → h2
Sending input0.7x2
Receiving delta0.003509506δ at h2
Connection gradient0.002456654x2 → h2
Now update this weight
Old weight0.3
New weight0.297543346

Subtract η × gradient = 0.002456654. This weight decreases.

The sending value and receiving delta have different roles. All deltas still use the original forward-pass weights.

The receiving neuron supplies the delta; the sending neuron supplies the input value.

g_{2,2}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{2,2}}=\delta_{h_2}x_2LaTeX: g_{2,2}^{(1)}=\frac{\partial L}{\partial W^{(1)}_{2,2}}=\delta_{h_2}x_2
g_{2,2}^{(1)}=(0.003509506)\times(0.7)\approx 0.002456654LaTeX: g_{2,2}^{(1)}=(0.003509506)\times(0.7)\approx 0.002456654

Apply the learning rate to this gradient and subtract the result from the old weight.

W^{(1)}_{2,2,\mathrm{new}}=0.3-1(0.002456654)\approx 0.297543346LaTeX: W^{(1)}_{2,2,\mathrm{new}}=0.3-1(0.002456654)\approx 0.297543346

Step 6 bias updates. A bias receives a constant input 1, so its gradient equals the corresponding delta. Use the same old forward pass and learning rate as the weight updates.

b_{h_1,\mathrm{new}}=1-1(0.002053687)=0.997946313LaTeX: b_{h_1,\mathrm{new}}=1-1(0.002053687)=0.997946313
b_{h_2,\mathrm{new}}=1-1(0.003509506)=0.996490494LaTeX: b_{h_2,\mathrm{new}}=1-1(0.003509506)=0.996490494
b_{o_1,\mathrm{new}}=1-1(0.013687964)=0.986312036LaTeX: b_{o_1,\mathrm{new}}=1-1(0.013687964)=0.986312036
b_{o_2,\mathrm{new}}=1-1(0.082533822)=0.917466178LaTeX: b_{o_2,\mathrm{new}}=1-1(0.082533822)=0.917466178

These are independent per-neuron biases. If the question fixes biases, keep them fixed. If it specifies a single tied bias, add all deltas sharing that bias before updating it.

Requested updates: w₁ = 0.199486578, w₅ = 0.089591357, w₇ = 0.057239383. For two outputs, this chosen half-sum equals their MSE; an unaveraged unhalved sum would double the gradients.