Logistic function

From Calculus
Revision as of 20:39, 14 September 2014 by Vipul (talk | contribs)

Definition

The logistic function is a function with domain R and range the open interval (0,1), defined as:

x↦11+e−x

Equivalently, it can be written as:

x↦exex+1

Yet another form that is sometimes used, because it makes some aspects of the symmetry more evident, is:

x↦ex/2ex/2+e−x/2

For this page, we will denote the function by the letter g.

We may extend the logistic function to a function [−∞,∞]→[0,1], where g(−∞)=0 and g(∞)=1.

Probabilistic interpretation

The logistic function transforms the logarithm of the odds to the actual probability. Explicitly, given a probability p (strictly between 0 and 1)of an event occurring, the odds in favor of p are given as:

p1−p

This could take any value in (0,∞)

The logarithm of odds is the expression:

ln(p1−p)

If x equals the above expression, then the function describing p in terms of x is the logistic function.

Key data

Item Value
default domain all of R, i.e., all reals
range the open interval (0,1), i.e., the set {x∣0≤x≤1}
derivative the derivative is −e−x(1+e−x)2.
If we denote the logistic function by the letter g, then we can also write the derivative as g′(x)=g(x)g(−x)=g(x)(1−g(x))
second derivative If we denote the logistic function by the letter g, then we can also write the derivative as g′(x)=g(x)g(−x)=g(x)(1−g(x))(1−2g(x))
logarithmic derivative the logarithmic derivative is e−x1+e−x
If we denote the logistic function by g, the logarithmic derivative is g(−x)
antiderivative the function x↦ln(ex+1)+C=−ln(g(−x))+C
critical points none
critical points for the derivative (correspond to points of inflection for the function) x=0; the corresponding point on the graph of the function is (0,1/2).
local maximal values and points of attainment none
local minimum values and points of attainment none
intervals of interest increasing and concave up on (−∞,0)
increasing and concave down on (0,∞)
horizontal asymptotes asymptote at y=0 corresponding to the limit for x→−∞
asymptote at y=1 corresponding to the limit for x→∞
inverse function inverse logistic function or log-odds function given by x↦ln(x1−x)

Differentiation

First derivative

Consider the expression for g(x):

g(x)=11+e−x=(1+e−x)−1

We can differentiate this using the chain rule for differentiation (the inner function being x↦1+e−x and the outer function being the reciprocal function t↦1/t. We get:

g′(x)=−(1+e−x)−2(−e−x)

Simplifying, we get:

g′(x)=e−x(1+e−x)2

We can write this in an alternate way that is sometimes more useful. We split the expression as a product:

g′(x)=(11+e−x)(e−x1+e−x)

The first factor on the right is g(x), and the second factor is 1−g(x), so this simplifies to:

g′(x)=g(x)(1−g(x))

Functional equations

Symmetry equation

The logistic function g has the property that its graph y=g(x) has symmetry about the point (0,1/2). Explicitly, it satisfies the functional equation:

g(x)+g(−x)=1

We can see this algebraically:

g(−x)=11+e−(−x)=11+ex

Multiply numerator and denominator by e−x, and get:

g(−x)=e−xe−x+1=1−11+e−x=1−g(x)

Differential equation

As discussed in the #First derivative section, the logistic function satisfies the condition:

g′(x)=g(x)(1−g(x))

Therefore, y=g(x) is a solution to the autonomous differential equation:

dydx=y(1−y)

The general solution to that equation is the function y=g(x+C) where C∈R. The initial condition y=1/2 at x=0 pinpoints the logistic function uniquely.

Integration

First antiderivative

Direct computation

We have:

∫g(x)dx=∫1dx1+e−x=∫exdxex+1=ln(ex+1)+C

=Computation in terms of functional equations for the logistic function

We have:

g′(x)=g(x)(1−g(x))

We also have that 1−g(x)=g(−x), so we get:

g′(x)=g(x)g(−x)

This can be rewritten as:

ddx(ln(g(x))=g(−x)

By the chain rule for differentiation, we get:

ddx(ln(g(−x))=−g(x)

Thus:

∫g(x)dx=−ln(g(−x))+C

This can be simplified and verified to be the same as the answer obtained by direct computation.