We have 3 subquestions (Q83–Q85) based on the same neural network. Let's solve them in order, starting with the forward pass.

Step 1: Understand the network

Given:

Initial weights:

w11=1,w12=0,w21=1,w22=1

The forward pass is:

x→a11,a12→h11,h12→a2→y^

Here, a means the value before activation, and h means the value after activation.

Hidden layer:

a11=w11x=x

a12=w12x=0

Apply ReLU, where ReLU⁡(z)=max(0,z):

h11=max(0,x)

h12=max(0,0)=0

Output layer:

a2=w21h11+w22h12

Since both output weights are 1:

a2=h11+h12=max(0,x)

Finally:

y^=ReLU⁡(a2)

So the network's output is:

y^=max(0,x)

Now let's use this for each question.

Q83. Choose the options representing the loss

The loss function is:

L(y,y^)=(y−y^)2

We need to understand what happens in two cases.

Case 1: a2<0

ReLU converts a negative number into zero:

y^=ReLU⁡(a2)=0

Substitute into the loss:

L=(y−0)2

Therefore, option 1 is correct.

Case 2: a2>0

ReLU leaves a positive number unchanged:

y^=ReLU⁡(a2)=a2

Substitute:

L=(y−a2)2

Therefore, option 3 is correct.

Correct answers: Option 1 and Option 3

Why is option 2 wrong? Because the output is a2, not necessarily 1.

Q84. Find the gradient of loss with respect to w12

We need to calculate:

∂L∂w12

This is a backpropagation question. We use the chain rule: multiply the derivatives along the path from the loss back to the weight.

The path is:

w12→a12→h12→a2→y^→L

So:

∂L∂w12=∂L∂y^⋅∂y^∂a2⋅∂a2∂h12⋅∂h12∂a12⋅∂a12∂w12

Let's calculate each part.

1. Derivative of loss

L=(y−y^)2

Differentiating with respect to y^:

∂L∂y^=−2(y−y^)

2. Derivative of output ReLU

y^=ReLU⁡(a2)

Its derivative is:

∂y^∂a2=1(a2>0)

Here, 1(condition) is the indicator function:

3. Derivative of output preactivation

a2=w21h11+w22h12

Therefore:

∂a2∂h12=w22

4. Derivative of hidden ReLU

h12=ReLU⁡(a12)

Therefore:

∂h12∂a12=1(a12>0)

5. Derivative of hidden preactivation

a12=w12x

Therefore:

∂a12∂w12=x

Now multiply all five terms:

∂L∂w12=−2(y−y^)⋅1(a2>0)⋅w22⋅1(a12>0)⋅x

Correct answer: Option 2 (the second listed formula)

Remember: Each indicator function comes from a ReLU derivative. One belongs to the output layer and the other to the hidden layer.

Q85. Calculate the updated w12 using ELU

This question changes the activation functions:

Initial weights remain:

w11=1,w12=0,w21=1,w22=1

We need to find the new value of w12 after one gradient descent step.

Step 1: Calculate the hidden layer values

First hidden neuron:

a11=w11x=1×1=1

Second hidden neuron:

a12=w12x=0×1=0

ELU is defined as:

f(z)={zz>0ez−1z≤0

For the first neuron, a11=1>0:

h11=1

For the second neuron, a12=0:

h12=e0−1=1−1=0

Therefore:

h11=1,h12=0

Step 2: Calculate the output

a2=w21h11+w22h12

Substitute the values:

a2=(1×1)+(1×0)=1

Output activation is ReLU:

y^=ReLU⁡(1)=1

Step 3: Calculate the loss

L=(y−y^)2

L=(0−1)2=1

Step 4: Calculate the gradient

We need:

∂L∂w12

Using the chain rule:

∂L∂w12=∂L∂y^⋅∂y^∂a2⋅∂a2∂h12⋅∂h12∂a12⋅∂a12∂w12

Calculate each term:

DerivativeValueReason
∂L∂y^2 −2(y−y^)=−2(0−1)
∂y^∂a21ReLU derivative, since a2=1>0
∂a2∂h121Equals w22
∂h12∂a121ELU derivative at zero is e0=1
∂a12∂w121Equals x

Multiply:

∂L∂w12=2×1×1×1×1

Gradient=2

Step 5: Update the weight

Gradient descent formula:

wnew=wold−η×Gradient

Substitute:

w12,new=0−0.2×2

w12,new=−0.4

Final answer: -0.4

Final revision: What these three questions test

QuestionConceptAnswer
Q83ReLU and piecewise lossOptions 1 and 3
Q84Chain rule and ReLU derivativesOption 2
Q85ELU derivative and gradient descent−0.4

Important distinction for your exam: ReLU's derivative at a positive input is 1. ELU's derivative at zero, with α=1, is also 1. That's why the gradient in Q85 becomes 2.