What is the sigmoid function?
The sigmoid, or logistic, function squashes any real number into the open interval (0, 1) with a smooth S-shaped curve. Defined as \(\sigma(x) = \frac{1}{1 + e^{-\text{a}\,x}}\), it is one of the most widely used activation functions in neural networks and a staple of logistic regression, probability modeling and growth curves. The gain parameter \(\text{a}\) controls how steep the transition is: with \(\text{a} = 1\) you get the classic textbook sigmoid, while larger \(\text{a}\) values compress the transition toward a step function.
How to use this calculator
Enter the gain \(\text{a}\), then the range over which you want to evaluate the function: x minimum, x maximum and the x step (increment). The tool builds a table of \(\sigma(x)\), its first derivative \(\sigma^{\prime}(x)\) and second derivative \(\sigma^{\prime\prime}(x)\) at each step, and reports the single-point values at the optional x you supply. Make sure the step is greater than zero and that x maximum is at least x minimum, otherwise no rows are produced.
The formulas explained
The derivatives have especially clean forms when written in terms of \(\sigma\) itself. Differentiating gives $$\sigma^{\prime}(x) = \text{a}\,\sigma(x)\bigl(1 - \sigma(x)\bigr)$$ which is always positive (the curve is monotonically increasing) and reaches its maximum value of \(\frac{\text{a}}{4}\) at the inflection point \(x = 0\). The second derivative, $$\sigma^{\prime\prime}(x) = \text{a}^{2}\,\sigma(x)\bigl(1 - \sigma(x)\bigr)\bigl(1 - 2\,\sigma(x)\bigr)$$ changes sign at \(x = 0\) where \(\sigma = 0.5\), confirming the inflection point.
Worked example
Take \(\text{a} = 1\) and \(x = 2\). Then \(e^{-2} = 0.135335\), so $$\sigma(2) = \frac{1}{1.135335} = 0.880797$$ The first derivative is $$0.880797 \times (1 - 0.880797) = 0.104994$$ The second derivative is $$0.104994 \times (1 - 2 \times 0.880797) = 0.104994 \times (-0.761594) = -0.079963$$ At \(x = 0\) the values are \(\sigma = 0.5\), \(\sigma^{\prime} = 0.25\) and \(\sigma^{\prime\prime} = 0\).
Reference Values of the Sigmoid and Its Derivatives (a = 1)
For the standard logistic function \(\sigma(x)=\frac{1}{1+e^{-x}}\), the derivatives are \(\sigma'(x)=\sigma(x)\,(1-\sigma(x))\) and \(\sigma''(x)=\sigma(x)\,(1-\sigma(x))\,(1-2\sigma(x))\). Values are rounded to 6 decimals.
| x | σ(x) | σ′(x) | σ″(x) |
|---|---|---|---|
| -6 | 0.002473 | 0.002467 | 0.002454 |
| -4 | 0.017986 | 0.017663 | 0.017028 |
| -3 | 0.047426 | 0.045177 | 0.040892 |
| -2 | 0.119203 | 0.104994 | 0.079963 |
| -1 | 0.268941 | 0.196612 | 0.090858 |
| 0 | 0.500000 | 0.250000 | 0.000000 |
| 1 | 0.731059 | 0.196612 | -0.090858 |
| 2 | 0.880797 | 0.104994 | -0.079963 |
| 3 | 0.952574 | 0.045177 | -0.040892 |
| 4 | 0.982014 | 0.017663 | -0.017028 |
| 6 | 0.997527 | 0.002467 | -0.002454 |
Symmetry
- \(\sigma(-x)=1-\sigma(x)\): the curve is point-symmetric about (0, 0.5).
- \(\sigma'(-x)=\sigma'(x)\): the first derivative is an even function (a bell-shaped curve).
- \(\sigma''(-x)=-\sigma''(x)\): the second derivative is an odd function.
Effect of the Gain a on the Curve
The gain \(a\) scales the input: \(\sigma(x)=\frac{1}{1+e^{-ax}}\), \(\sigma'(x)=a\,\sigma(1-\sigma)\), \(\sigma''(x)=a^2\,\sigma(1-\sigma)(1-2\sigma)\). The table evaluates each gain at x = 1.
| Gain a | σ(1) | σ′(1) | σ″(1) | Max slope a/4 (at x = 0) | σ between 0.1 and 0.9 |
|---|---|---|---|---|---|
| 0.5 | 0.622459 | 0.117502 | -0.014389 | 0.125 | |x| < 4.394 |
| 1 | 0.731059 | 0.196612 | -0.090858 | 0.25 | |x| < 2.197 |
| 2 | 0.880797 | 0.209987 | -0.319851 | 0.5 | |x| < 1.099 |
| 5 | 0.993307 | 0.033240 | -0.163975 | 1.25 | |x| < 0.439 |
The maximum slope is \(\sigma'(0)=a/4\). Since \(\sigma=0.1\) and \(\sigma=0.9\) occur where \(ax=\mp\ln 9\), the transition band is roughly \(|x|<\frac{\ln 9}{a}\approx\frac{2.197}{a}\). A larger gain gives a steeper, narrower transition; a smaller gain gives a gentler, wider one. Note that at x = 1 the second derivative for a = 5 is smaller in magnitude than for a = 2 because the curve has already begun to saturate there.
Interpreting the Sigmoid and Derivative Values
σ(x): a bounded, probability-like output
The sigmoid maps any real input to the open interval (0, 1), with σ(0) = 0.5. This is why it is used for logistic regression, neural-network activations and growth or saturation models. A value such as 0.88 can be read as a probability-like score, though it is only a true calibrated probability if the model was fitted that way.
σ′(x): sensitivity or gradient
The first derivative tells how fast the output changes per unit change in x. It is always positive, peaks at \(a/4\) when x = 0, and falls toward 0 in both tails. When \(|a\,x|\) exceeds about 5, σ′ is below roughly 0.0066·a, so the function is saturated: large changes in the input barely change the output. In gradient-based training this is the vanishing-gradient effect, because very small derivatives make weight updates tiny.
σ″(x): curvature
- For x < 0, σ″ > 0: the curve is convex (bending upward), and the slope is still increasing.
- At x = 0, σ″ = 0: this is the inflection point, where the slope is at its maximum.
- For x > 0, σ″ < 0: the curve is concave (bending downward), and the slope is decreasing.
The extreme values of σ″ occur where \(\sigma=\frac{1}{2}\pm\frac{1}{2\sqrt{3}}\), i.e. at \(x=\pm\frac{\ln(2+\sqrt{3})}{a}\approx\pm\frac{1.317}{a}\). These are the points where the slope changes fastest.
FAQ
What does the gain a do? It scales the input. A larger \(\text{a}\) makes the curve rise faster around \(x = 0\); as \(\text{a}\) grows the sigmoid approaches a hard step, while \(\text{a} = 0\) gives a flat line at 0.5.
Where is the steepest point? Always at \(x = 0\), where the slope equals \(\frac{\text{a}}{4}\) and the second derivative is zero.
Why is the output never exactly 0 or 1? The exponential never reaches zero for finite x, so \(\sigma\) stays strictly inside (0, 1). For extremely large \(|\text{a}\,x|\) the value rounds to 0 or 1 numerically, which this calculator handles safely.