η = 0
p
0.5.
The logistic function maps any real to a probability between 0 and 1. Its derivative is , and its inverse is the logit .
This page is easier if you are comfortable with:
The curve is S-shaped, passing through at . By the chain rule, . The slope is greatest (0.25) at and tends to 0 for large . For : and slope . The exponential is described in the derivative of e to the power kx.
Solving for gives the logit: corresponds to , the log of the odds. Logistic regression models the log-odds as a linear function of predictors and fits it by maximum likelihood; the formula makes the derivatives simple. The logistic equation also models growth that levels off, see exponential growth and decay and growth models.
For several classes the logistic function generalises to the softmax function. The shape resembles the hyperbolic tangent: . Probabilities from it add to 1 in the binary case, see the sum of probabilities.
The logistic function squashes any number into a probability and has a very simple derivative.
The slope peaks at 0.25 where p = 0.5 and fades away in both directions.
These examples are worked by hand, step by step, so you can compare your own working.
Find and at .
Find and the slope at .
Find when .
A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.
p
0.5.
p
0.8808.
p(1 − p)
0.1050.
logit ln(p/(1−p))
1.3863.
p = 1/(1 + e^(−η)), dp/dη = p(1 − p) and the inverse is the logit η = ln(p/(1 − p)).
e⁰ = 1.
e⁻² = 0.1353.
p(1 − p).
p = 0.8.
p ✗
p(1 − p) ✓
Chain rule.
unbounded ✗
between 0 and 1 ✓
Probability.
wrong ✗
ln(p/(1 − p)) ✓
Odds.
large η ✗
η = 0 gives 0.25 ✓
Symmetry.
Try each one on paper, then open the answer. Use the solver above to see the full working.
0.7311
0.2689
0.25
2.1972
0.09
0.9526
Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.
Solve: …
1/(1 + e^(−η)).
p(1 − p).
ln(p/(1 − p)), the inverse function.
0.5.
softmax and cross-entropy.
maximum likelihood estimation.
More in Advanced statistics and stochastic processes and the formula sheets.