# Solve the equation $2^x=1-x$

Solve the equation: $$2^x=1-x$$

I know this is extremely easy and I know the solution using graphical approach. Basically, I can see the solution, but I can't work it out algebraically.

-
You can use the iterative formula: $$x_{n+1}=1-2^{x_{n}}$$ for a numerical approach, which eventually converges to $0$. –  Shaktal Sep 11 '12 at 18:05
I would not classify an algebraic solution to this as "extremely easy"! However, Ross Millikan shows that if you keep your eyes open, a convincing solution presents itself. –  rschwieb Sep 11 '12 at 18:37
Well, this community has much greater mathematical knowledge than I do, thus what I deem to be medium-hard or hard, you guys find to be easy or medium. That is why I wrote extremely easy because I though it is a medium-level exercise for me. –  David Hoffman Sep 11 '12 at 18:41
Are there nonzero complex solutions? –  Ben Crowell Sep 11 '12 at 23:03

A different perspective on an algebraic solution: you know that for negative $x$, $2^x\lt 1$ but $1-x \gt 1$ (since the latter is $1+(-x)$ and $-x \gt 0$); contrariwise, for positive $x$, $2^x\gt 1$ but $1-x \lt 1$. This means that the only possibility for a solution is $x=0$, and of course by quick algebra that does in fact work.

-

By inspection $0$ is a solution. As the left side is increasing with $x$ and the right decreasing, that is the only solution. Equations that mix exponentials and polynomials usually need the Lambert W function for a "closed form" solution.

-
"By inspection" should be taken to mean: think about what the two graphs, of $y=1-x$ and $y=2^x$, look like. –  Michael Hardy Sep 11 '12 at 18:25
@MichaelHardy "By inspection" could mean that I look at the equation, whether there is any graph involved or not, and I try a few easy values in my head and find one that works. You could also inspect it by looking at (thinking about) the graphs. That would be a different type of inspection, but they are both inspection. –  Graphth Sep 11 '12 at 18:30
Equations that mix exponentials and polynomials usually have no closed form solution. Some (in particular, those of the form $a^x + b x + c = 0$) can be solved using the Lambert W function. But change the $b x$ to $b x^2$, for example, and Lambert doesn't help. –  Robert Israel Sep 11 '12 at 18:36
Well f(x)=2^x intersects the y-axis at y=1, and so does f(x)=1-x. So it is fairly obvious I know. –  David Hoffman Sep 11 '12 at 18:37
I meant that in this case, that's what "by insepction" should mean, since when you do that, you get the answer instantly. –  Michael Hardy Sep 11 '12 at 22:32

Solution is $1-W(2\log(2))/\log(2) = 0$, using the Lambert W function. [added Mhenni's answer shows the steps to derive this.]

And for the non-real solutions, use the other branches of the Lambert W function. \begin{align} &\dots\\&5.430858450 + 42.90897219 i\\ &5.090239758 + 33.81905797 i\\ &4.642925846 + 24.71686730 i\\ &3.988583083 + 15.59001288 i\\ &2.732900763 + 6.418080468 i\\ &0.000000000 + 0.000000000 i\\ &2.732900763 - 6.418080468 i\\ &3.988583083 - 15.59001288 i\\ &4.642925846 - 24.71686730 i\\ &5.090239758 - 33.81905797 i\\ &5.430858450 - 42.90897219 i\\ &\dots \end{align}

-

I posted a solution to a problem related to this where I used the Lambert W function which is the solution of $y {\rm e}^{y}=x$. A solution to a more general form $a^x=bx+c$ is here.

Let $1-x = y$, then we have

$$2^x = 1-x \Rightarrow 2^{1-y} = y \Rightarrow y \,2^y = 2 \Rightarrow y\,{\rm e}^{y\, \ln(2)}=2 \Rightarrow \frac{z}{\ln(2)} {\rm e}^{z} = 2 \Rightarrow z {\rm e}^{z}= 2\,\ln(2)$$ $$\Rightarrow z = W( 2 \,\ln (2) ) \Rightarrow y = \frac{W(2\,\ln(2))}{\ln(2)} \Rightarrow 1-x=\frac{W(2\,\ln(2))}{\ln(2)} \Rightarrow x = 1-\frac{W(2\,\ln(2))}{\ln(2)} = 0\,,$$

since $W(2\,\ln(2))=\ln(2)$.

-
$W(2 \log(2)) = \log(2)$. Your solution is actually the same as $x = 0$. –  Ayman Hourieh Sep 11 '12 at 19:29
@AymanHourieh: Thanks. Of course you can look for the other solutions by considering the other branches of the Lambert W function. Here I showed the techniques of solving such equation. –  Mhenni Benghorbal Sep 11 '12 at 19:34
Here is a method for finding complex roots that should be understandable to those of us who didn't learn the Lambert W function at our father's knee. $2^{i\phi}=e^{i\phi\ln 2}$ is on the unit circle in the complex plane. Say we put in some fairly large value of $\phi$. Then $1-x=1-i\phi$ is going to be pretty close to the negative imaginary axis. To make the l.h.s. and r.h.s. of the equation have about the same complex phase, we can just pick a value of $\phi$ such that $2^{i\phi}$ is on the imaginary axis. Suppose we try $\phi=(3\pi/2+10\pi)/\ln 2\approx 52.1$. Now the two sides of the equation match pretty well, except that their magnitudes are mismatched. To fix this, tack on $\ln 52/\ln 2\approx 5.7$ as a real part, giving $x=5.7+52.1i$. This is pretty nearly a solution. Now play around with the real and imaginary parts to minimize the error, and you can converge to a pretty good numerical approximation, about $5.7061+51.99191i$. By replacing the $10\pi$ with other multiples of $2\pi$, it should be clear that you can get as many solutions as you want.