Skip to content
AriadneTechnology

The Outer Ring · Chamber 3 of 8

The Artificial Neuron

Weighted sums, activation functions and the line that divides the world, plus the problem that froze a field.

25 min 50 XP + 4 questions + 2 challengesMathLabHistory

In this chamber you will

  • Compute a neuron's output by hand
  • Connect weights and bias to the geometry of the decision boundary
  • Compare common activation functions and their derivatives
  • Explain why a single neuron cannot learn XOR

From biology to arithmetic

A biological neuron receives signals through its dendrites, adds up the excitation in its cell body, and, if the total crosses a threshold, fires a signal down its axon to other neurons.

The artificial neuron keeps only the arithmetic of that story: weigh the inputs, sum them, squash the result. It's a loose inspiration, not a model of the brain, and modern networks owe far more to mathematics than to biology.

The math of one neuron

x₁w₁x₂w₂x₃w₃bias bΣzaweighted sumactivation σ
Multiply each input by its weight, add them up with the bias, then squash: a = σ(w₁x₁ + w₂x₂ + w₃x₃ + b).

A neuron with inputs x=(x1,…,xd)\mathbf{x} = (x_1, \dots, x_d), weights w\mathbf{w} and bias bb computes two things:

z=∑j=1dwjxj+b=w⊤x+b,a=σ(z)z = \sum_{j=1}^{d} w_j x_j + b = \mathbf{w}^\top \mathbf{x} + b, \qquad a = \sigma(z)

The pre-activation zz is a weighted sum: each weight says how much its input matters, and in which direction. The bias shifts the threshold. The activation function σ\sigma then turns zz into the neuron's output aa.

For example, with x=(1,2)\mathbf{x} = (1, 2), w=(0.5,−1)\mathbf{w} = (0.5, -1) and b=2b = 2:

z=0.5⋅1+(−1)⋅2+2=0.5,ReLU(0.5)=0.5,σ(0.5)≈0.62z = 0.5 \cdot 1 + (-1) \cdot 2 + 2 = 0.5, \qquad \mathrm{ReLU}(0.5) = 0.5, \qquad \sigma(0.5) \approx 0.62
Quick check +20 XP

A neuron has weights w=(2,−1)\mathbf{w} = (2, -1), bias b=0.5b = 0.5 and a ReLU activation. What does it output for x=(1,3)\mathbf{x} = (1, 3)?

The geometry: a line through the data

Here is the insight that makes neurons click. Suppose the neuron answers "class 1" when z>0z > 0. Then the points where it is exactly undecided satisfy

w⊤x+b=0\mathbf{w}^\top\mathbf{x} + b = 0

In two dimensions that's the equation of a straight line. In three, it's a plane, and in general it's a hyperplane. This is the neuron's decision boundary, and its geometry is governed by the parameters:

  • The weight vector w\mathbf{w} is perpendicular to the boundary and points towards the positive side.
  • The bias bb slides the boundary back and forth without rotating it.
  • Scaling w\mathbf{w} and bb together doesn't move the line, but it makes a sigmoid neuron more confident: its transition gets sharper.

Try it. Rotate the line with the weights, slide it with the bias, and separate the blue points from the gold ones.

Interactive lab

One neuron, one line

A neuron computes z = w₁x₁ + w₂x₂ + b and says gold when z > 0. Its decision boundary is the line where z = 0. The arrow is the weight vector w: it always points at the gold side, perpendicular to the line.
Activation
z = 1·x₁ − 0.5·x₂ + 0.5
a = σ(z)output at origin: 0.62

Accuracy

17/24

Challenge: Draw the lineClassify every point correctly with a single neuron.+40 XP

Activation functions

Why not skip the activation and use zz directly? Because stacking linear layers gets you nowhere:

W2(W1x+b1)+b2=(W2W1)⏟one matrixx+(W2b1+b2)⏟one biasW_2\big(W_1\mathbf{x} + \mathbf{b}_1\big) + \mathbf{b}_2 = \underbrace{(W_2 W_1)}_{\text{one matrix}}\mathbf{x} + \underbrace{(W_2\mathbf{b}_1 + \mathbf{b}_2)}_{\text{one bias}}

Any stack of linear layers collapses into a single linear layer. The nonlinearity is what lets depth add expressive power. Explore the classic choices, and watch their slopes, because backpropagation (next chamber) multiplies by exactly those slopes.

Interactive lab

Activation function explorer

Pick a nonlinearity, then move across the plot to read its value and its slope. The slope is what backpropagation multiplies by, so flat regions mean vanishing gradients.
-4-202401
σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}
σ′(z)=σ(z)(1−σ(z))\sigma'(z) = \sigma(z)\big(1 - \sigma(z)\big)

z

1

f(z)

0.731

f′(z)

0.197

Squashes any number into (0, 1), which is handy for probabilities. But it saturates: for large |z| the derivative is nearly 0, and it never exceeds 0.25.

Explored 1/6

Challenge: Activation tourInspect all six activation functions.+15 XP

The sigmoid has an especially neat derivative, σ′(z)=σ(z)(1−σ(z))\sigma'(z) = \sigma(z)\big(1 - \sigma(z)\big), which never exceeds 0.250.25. Hold on to that fact. It's the seed of the vanishing gradient problem.

Derive σ′(z) yourself (try it first!)

Write σ(z)=(1+e−z)−1\sigma(z) = (1 + e^{-z})^{-1} and apply the chain rule:

σ′(z)=e−z(1+e−z)2=11+e−z⏟σ(z)⋅e−z1+e−z⏟1−σ(z)\sigma'(z) = \frac{e^{-z}}{(1 + e^{-z})^2} = \underbrace{\frac{1}{1 + e^{-z}}}_{\sigma(z)} \cdot \underbrace{\frac{e^{-z}}{1 + e^{-z}}}_{1 - \sigma(z)}

The second factor equals 1−σ(z)1 - \sigma(z) because e−z1+e−z=(1+e−z)−11+e−z\frac{e^{-z}}{1 + e^{-z}} = \frac{(1 + e^{-z}) - 1}{1 + e^{-z}}.

The problem that froze a field: XOR

XOR ("exclusive or") outputs 1 when exactly one of its inputs is 1:

x1x_1x2x_2XOR
000
011
101
110

Plot those four points and try to draw one straight line with both 1s on one side and both 0s on the other. You can't: the classes sit on opposite corners. XOR is not linearly separable, so no single neuron can compute it. Switch the lab above to XOR mode and see for yourself: 75% is the ceiling.

Key takeaways

  • A neuron computes a weighted sum z=w⊤x+bz = \mathbf{w}^\top\mathbf{x} + b, then applies an activation a=σ(z)a = \sigma(z).
  • Its decision boundary w⊤x+b=0\mathbf{w}^\top\mathbf{x} + b = 0 is a hyperplane: w\mathbf{w} sets the orientation, bb the offset.
  • Nonlinear activations are essential; without them, depth collapses to a single linear map.
  • A single neuron can only solve linearly separable problems. XOR is the classic counterexample.

Checkpoint

Prove it to the labyrinth

Answer every question to clear this chamber. First-try answers earn the most XP.

0/3
Question 1 of 3 +20 XP

Why do neural networks need nonlinear activation functions?

Question 2 of 3 +20 XP

What does the decision boundary of a single neuron look like in a 2D input space?

Question 3 of 3 +20 XP

The sigmoid's derivative is σ′(z)=σ(z)(1−σ(z))\sigma'(z) = \sigma(z)\big(1-\sigma(z)\big). What is its maximum value?

End of the chamber

Clear this chamber

  • Questions in this chamber (0/4 solved)Next unsolved
  • Bonus: Draw the line (+40 XP)
  • Bonus: Activation tour (+15 XP)
+50 XPArtificial NeuronActivation FunctionDecision BoundaryThe XOR Problem