3
$\begingroup$

I tried every way imaginable to solve the function $2^x + x = 4$, but I can't figure it out. I know it's not an easy one. I spend my free time helping people out with their math questions online, and I came across this. My guess is the guy made a typo and meant $x^2 + x = 4$, but I would still like to know how one would solve $2^x + x = 4$. Thanks.

$\endgroup$
  • $\begingroup$ wolframalpha.com/input/?i=solve+2%5Ex%2Bx%3D4&t=crmtb01 $\endgroup$ – saulspatz May 18 '19 at 20:59
  • $\begingroup$ By inspection, you should able to convince yourself that any real answer is between $1$ and $2$. And in general, functions like this are very hard, if not impossible, to solve exactly. $\endgroup$ – The Count May 18 '19 at 21:03
  • $\begingroup$ In case you are interested, Wolfram|Alpha or Mathematica can solve the equation using ProductLog (=LambertW). $\endgroup$ – Somos May 18 '19 at 22:50
5
$\begingroup$

You're right that it's hard. The solution involves the unusual "Lambert W" function, which is not an elementary function (you can't express it in terms of arithmetic, trig functions, exponentials and logarithms, polynomial roots, etc.)

The Lambert W function is defined as the inverse of the function $f(x) = x e^x$. So if $y \equiv x e^x$, then $W(y) = x$.

  • Starting from $2^x + x = 4$, subtract $x$ from both sides. $2^x = 4-x$.
  • Divide by $2^x$. $1 = (4-x)2^{-x}$
  • To make the coefficient of the $2^{-x}$ term match the exponent, multiply both sides by $2^4$: $$2^4 = (4-x)2^{4-x}$$
  • Rewrite $2^{4-x}$ in terms of base $e$... $$2^4 = (4-x)e^{\ln(2)(4-x)}$$ ...then multiply both sides by $\ln(2)$ to ensure that the coefficient and exponent continue matching. $$2^4 \ln(2) = \ln(2)(4-x)e^{\ln(2)(4-x)}$$

  • The right hand side matches the form "$ye^y$" needed for the Lambert W function. Apply the Lambert W function to both sides.

    $W[2^4\ln(2)] = \ln(2)(4-x)$

  • Solve for $x$. $$x = 4-\frac{W[\ln(2)2^4]}{\ln(2)} \approx 1.386$$

$\endgroup$
  • $\begingroup$ Perfect, this is exactly what I was looking for. Thanks :) $\endgroup$ – John May 18 '19 at 21:38
2
$\begingroup$

You can use Newton's method, to solve this numerically. There is no algebraic solution for equations like that. Newton's method is a pretty basic numerical method and goes like this:

We search the root of the function $f(x)=2^x+x-4$. It is $f'(x)=\ln(2)2^x+1$.

The iteration is as follows:

$x_{k+1}=x_k-\dfrac{f(x_k)}{f'(x_k)}$

We have to guess our $x_0$. As The Count has pointed out, a good guess it $x\in (1,2)$. So we take $x_0=\frac32$.

Then $x_1=\frac32-\dfrac{f(\frac32)}{f'(\frac32)}\approx 1.38906424$

This converges rapidly. Already after two steps the digits do not change and I get 1.38616698 on my display.

Wolframalpha gives $1.38617$

$\endgroup$
  • $\begingroup$ Hi, I wasn't the one who downvoted it, but thanks for your solution. I was wondering if there was a way to solve it algebraically, either some algebraic manipulation that I was missing, but obviously that wasn't the case. Thanks. $\endgroup$ – John May 18 '19 at 21:26
  • $\begingroup$ @John Yes, it is not possible, because there is no way you can isolate $x$, because you have it in the exponent as $2^x$ and as $x$. There are advanced tricks, like the shown Lambert-W-function, which is a numerical function. Newton's method is taught in school (at least sometimes). $\endgroup$ – Cornman May 18 '19 at 21:44
1
$\begingroup$

We have
\begin{align} 2^x+x=&4\\ x=&4-2^x\\ 4x-3x=&4-2^x\\ 4x=&4-2^x+3x\\ x=&\frac{1}{4}\left(4-2^x+3x\right) \end{align} Define the function $f:\mathbb{R}\to \mathbb{R}$ by $f(x)=\frac{1}{4}\left(4-2^x+3x\right)$. It is easy to see that $ x $ is the solution of the equation $2^x+x=4$ if, and only if, $ x $ is the fixed point of the function $f$, that is, $f(x)=x$.

Use the derivatives $$ f^{\prime}(x)=\dfrac{3-\ln\left(2\right){\cdot}2^x}{4} \quad \mbox{ and } \quad f^{\prime\prime}(x)= -\ln^2\left(2\right){\cdot}2^{x-2} $$ to prove that $ f $ is a $ \lambda $ -contraction in interval $[0,2]$ and that $f([0,+2])\subseteq [0,+2]$.Then, by Banach's contraction theorem, the sequence $ x_n = f^n (x) $ converges to the single fixed point of $ f $ in the interval $ [0,2] $ which is the only solution of the equation $2^x+x=4$ in the interval $ [0,2] $.

$\endgroup$
0
$\begingroup$

Using Newton-raphson Method $$y=2^x+x-4$$ $$y'=2^x\log 2+1$$ $$x_{i+1}=x_i-\frac{y_i}{y'_i}$$ so $$x_{i+1}=x_i-\frac{2^{x_i}+x_i-4}{2^{x_i}\log 2+1}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.