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.


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.


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.


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)$. More on Lambert W function.