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.
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.
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.