# How to Solve the Logistic Regression Equation for the Probability p.

As discussed previously, in logistic regression the log odds is modeled as a linear function of the -variables. That is

To solve this equation for , we first apply the exponential function to both sides of the equation:

Recall that so that the right hand side of the above equation is

Also remember that “log” is the natural logarithm, so the exponential function is its inverse (i.e., ). Thus, the left hand side is

Thus, after exponentiating both sides, logistic regression equation becomes:

Next multiply both sides by ,

and then “break up” the term,

Now move the term (the last term on the right-hand side) over to the left-hand side by adding it to both sides:

Next, factor out the ,

Finally, divide both sides by to get :

This is the equation for that you will see in multiple articles on this website.

There is one other form of this equation that is commonly used. It is obtained by multiplying the top and bottom of the right hand side of the equation for by . Since , this gives

The terms in the denominator are customarily written in the opposite order. So the second form of the equation for is

I have probably put in too many steps in the derivation above, but I wanted it to be accessible to almost everyone, even if your algebra skills are a little rusty.