# How do I find $x$ if I know $y$

I have the equation for a sigmoid with the following

$$y = \frac{1}{1+e^{-x}}$$

How do I find what the value of $x$ is if I know $y$?

For example:

if $y = 0.5$ then what is $x$?

(The answer for the example, I believe, is $0$)

Edit: If you are please going to downvote, please explain why, otherwise I cannot improve my questions in the future

• Could you format your answer in LaTeX? Jun 26, 2017 at 18:25
• What is that @ZeroXLR
– Rlz
Jun 26, 2017 at 18:26
• A way to format formulas so that they look nice. Jun 26, 2017 at 18:28
• Actually the format which is most helpful is called MathJAX and there are many tutorials available. You can take a look at how your question was edited to see what it looks like. Jun 26, 2017 at 18:29
• Thanks @abiessu I will learn how to do that for future
– Rlz
Jun 26, 2017 at 18:30

All you need to do is solve for $x$: $$y=\frac{1}{1+e^{-x}}$$ $$\frac{1}{y}=1+e^{-x}$$ $$\frac{1}{y}-1=e^{-x}$$ $$\ln\bigg(\frac{1}{y}-1\bigg)=-x$$ $$x=-\ln\bigg(\frac{1}{y}-1\bigg)$$ As for the case $y=0.5$, we have $$x=-\ln\bigg(\frac{1}{0.5}-1\bigg)$$ $$x=-\ln(2-1)$$ $$x=-\ln(1)$$ $$x=0$$ So your guess was correct.

$$y=\frac{1}{1+e^{-x}} \implies 1+e^{-x}=\frac 1y \implies e^{-x}=\frac 1y-1$$

$$e^{-x}=\frac{1-y}{y}\implies e^x=\frac{y}{y-1}$$$$\implies \boxed{x=\ln \left(\frac{y}{1-y}\right)}$$

Now plug-in $y=0.5$.

$$\implies x=\ln \left(\frac{0.5}{1-0.5}\right)=\ln (1)=0$$

• You were fast XD, actually it isn't easy to type an answer on phone. +1 :-P Jun 26, 2017 at 18:33

solving $$y=\frac{1}{1+e^{-x}}$$ for $$x$$: $$1+e^{-x}=\frac{1}{y}$$ and we get $$-x=\ln\left(\frac{1}{y}-1\right)$$ and now you can insert $$y=0.5$$ in this equation

$$0.5 = \frac{1}{1+e^{-x}}$$

$$\frac{1}{0.5} = 1 + e^{-x}$$

$$ln\ [\frac{1}{0.5} - 1] = ln\ [e^{-x}]$$

$$ln\ [1] = -x$$

$$x = 0$$

We wish to solve

$$0.5 = \frac{1}{1+e^{-x}}$$

Okay, sure. Cross-multiply/butterfly/whatever you want to call it first.

$$0.5(1 + e^{-x} ) = 1$$

Divide by $0.5$.

$$1 + e^{-x} = 2$$

Subtract $1$, take logs.

$$-x = 0$$

Hence $x = 0$.

$0.5=\frac{1}{1+e^{-x}} \implies 1=e^{-x}\implies -x\ln e=\ln 1$ which yields $x=0$.

I let you conclude what is happening there, which is easy enough if you know a bit about logarithms.