cd /news/neural-networks/i-finally-understood-why-neural-netw… · home topics neural-networks article
[ARTICLE · art-67165] src=dev.to ↗ pub= topic=neural-networks verified=true sentiment=↑ positive

I Finally Understood Why Neural Networks Need Activation Functions

A developer implemented Sigmoid, Tanh, ReLU, Leaky ReLU, and Softmax from scratch in Python and realized that the derivative of an activation function is what actually teaches the neural network how to learn. The activation function determines the output during the forward pass, while its derivative computes gradients during backpropagation to update weights. The developer noted that ReLU's derivative (0 for negative inputs, 1 for positive) explains why it trains deep networks faster than Sigmoid, which suffers from vanishing gradients.

read2 min views1 publishedJul 21, 2026

When I started learning Deep Learning, I thought activation functions were just mathematical equations we had to memorize.

Today, while implementing Sigmoid, Tanh, ReLU, Leaky ReLU, and Softmax from scratch in Python, I realized something much more interesting.

The activation function itself is only half of the story.

The derivative is what actually teaches the neural network how to learn.

I generated 100 equally spaced values between -10 and 10:

z = np.linspace(-10, 10, 100)

Then I implemented:

For the first four, I plotted both the activation function and its derivative.

Initially, I wondered:

Why am I plotting the derivative? Isn't the activation function enough?

After learning about backpropagation, the answer became clear.

The activation function answers:

"What output should this neuron produce?"

For example, Sigmoid compresses any input into a value between 0 and 1.

ReLU outputs 0 for negative inputs and passes positive inputs unchanged.

This is what happens during the forward pass.

Input
   ↓
Weighted Sum
   ↓
Activation Function
   ↓
Prediction

The derivative answers a completely different question:

"How much should this neuron change to reduce the error?"

During the backward pass, the neural network computes gradients.

Those gradients come directly from the derivatives of the activation functions.

Without derivatives, the model wouldn't know how to update its weights.

Prediction
     ↓
Calculate Error
     ↓
Compute Derivatives
     ↓
Update Weights

That was the moment when the plots finally made sense to me.

Beautiful S-shaped curve.

But its derivative almost becomes zero for very large positive or negative inputs.

That means learning slows down because the gradients almost disappear.

This is called the vanishing gradient problem.

At first glance, it looked almost identical to Sigmoid.

But I noticed something important:

Its output is centered around zero.

That small difference helps optimization because the gradients are more balanced around the origin.

The simplest graph was also the most surprising.

f(x)=max(0,x)

Its derivative is

0   (negative inputs)

1   (positive inputs)

This explains why ReLU trains deep neural networks much faster than Sigmoid.

ReLU has one weakness.

Negative neurons completely stop learning because the derivative becomes zero.

Leaky ReLU fixes that with a tiny negative slope.

Instead of

Gradient = 0

it becomes

Gradient = 0.01

A small change mathematically—but an important one during training.

Softmax was different from the others.

It doesn't transform a single value.

It transforms an entire vector into probabilities.

Example:

Input

[2,4,1]

↓

Output

[0.114
 0.844
 0.042]

Every probability depends on every other input.

That explains why we usually don't visualize Softmax as a simple curve.

Today I stopped thinking of activation functions as just formulas.

Now I see them as two complementary ideas:

The graph explains the prediction.

The derivative explains the learning.

My next goal is to implement:

I want to understand the mathematics before relying on deep learning frameworks.

When you first learned neural networks, what concept changed your understanding the most—activation functions, backpropagation, or gradient descent?

── more in #neural-networks 4 stories · sorted by recency
── more on @python 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-finally-understood…] indexed:0 read:2min 2026-07-21 ·