How to Find the Inverse of a Sigmoid Equation
At a glance
- 1. Name the sigmoid
For the standard logistic sigmoid, write y = 1 / (1 + e^(-x)).
- 2. Isolate the exponential
Rearrange to get e^(-x) = (1 - y) / y.
- 3. Take logarithms
Apply the natural logarithm and solve for x.
- 4. Check the range
A finite inverse exists only when the output y is strictly between 0 and 1.
The word “sigmoid” can describe several S-shaped functions, but it most often means the standard logistic function
To find its inverse, solve for the input in terms of the output . The result is the logit function. The steps below also show how to invert a shifted or rescaled logistic sigmoid.
Derive the inverse of the standard sigmoid
Set the sigmoid equal to and rearrange:
Take the natural logarithm of both sides. Since , solving for gives
Thus the inverse function is
The expression is the odds associated with probability ; the logit is the logarithm of those odds.
Check the domain
The standard sigmoid takes every real input to a value strictly between 0 and 1. Therefore its inverse accepts only and returns a real number. The endpoints are approached but never reached for finite :
So and do not have finite inverse values. In the extended limiting sense, their corresponding inputs tend to and respectively. Values outside cannot be outputs of this sigmoid.
Worked example
Find the input whose sigmoid output is . Substitute into the inverse:
Check by putting this value back into the original sigmoid:
The positive input makes sense: the standard sigmoid is above when , and is above .
Invert a shifted or scaled sigmoid
A common generalized form is
where sets the upper output limit, is the midpoint, and controls the steepness and direction. For and , its output must satisfy . Rearranging gives
For example, suppose and you want the input that gives . Here , , and :
If the sigmoid is applied to a linear expression, such as , first use the standard inverse to obtain . If , then
Common mistakes
- Reversing the odds: The numerator in the logit is , and the denominator is . Reversing them changes the sign of the answer.
- Using the formula at an endpoint: The logarithm is not finite at or . Do not substitute either endpoint into the formula as though it returned a real number.
- Ignoring the sigmoid’s parameters: For a scaled sigmoid, use or the generalized formula; the unscaled logit alone will give the wrong input.
- Assuming every sigmoid has a logit inverse: Some functions called sigmoid functions, such as the normal cumulative distribution function, have different inverse functions. The formula here applies to the logistic sigmoid and its stated variants.
For values extremely close to 0 or 1, the logit can have a very large magnitude. In numerical work, check that the output is valid and account for rounding before evaluating the logarithm.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.