# Solving equation with exponential, not numerically

Doing a homework of a related course, I reached to the following equation:

$$1 + 2x = e^x$$

By inspection, $x$ can be zero, but plotting $f(x) = 1 + 2x - e^x$, I can see that it has another root near 2. For my problem (It is a physics problem), due to dimension constraints, $x$ cannot be zero, nor can it be negative, so that solution around 1.25 is the solution I am looking for, however I don't want a numerical approximation. Is there a way of approximating this, more theoretically? (I mean using taylor series or something?, or getting the exact solution if it is possible?)

• Why is a numerical solution not desired here? It might be possible to use the Lambert W function otherwise, as a Taylor series would also lead to numerical approximation Commented Jun 13, 2017 at 0:18
• Why is a Taylor series approximation acceptable but a numeric approximation not? Alpha finds the root to be about $1.25$ Commented Jun 13, 2017 at 0:19
• I don't want a raw number, because I simplified it, x in reality is: physical constants multiplied by a variable, so I need an expression using these physical constants Commented Jun 13, 2017 at 0:19
• Well, I guess it can't be helped, but using newton raphson or something to find the solution... Commented Jun 13, 2017 at 0:22
• Yeah the best you can do is use as much pricision as is allowed, as I said before there is an answer in terms of the Lambert W function but it still yields a large decimal answer Commented Jun 13, 2017 at 0:23

One might exploit the Lambert W function to find that

$$x=-\frac12-W_k\left(-\frac12e^{-1/2}\right),~k=-1,0$$

Where we have

$$W_0\left(-\frac12e^{-1/2}\right)=-\frac12$$

$$W_{-1}\left(-\frac12e^{-1/2}\right)\approx-1.756431208626169677$$

Thus, the solutions are given by

$$x=0,~\color{red}{1.25}6431208626169677$$

One might wish to exploit different approximations of the Lambert W function here. For example,

\begin{align}_0W_{-1}(x)&=\ln(-x)\\_1W_{-1}(x)&=\ln(-x)-\ln(-\ln(-x))\\_2W_{-1}(x)&=\ln(-x)-\ln(-\ln(-x)+\ln(-\ln(-x)))\\_3W_{-1}(x)&=\ln(-x)-\ln(-\ln(-x)+\ln(-\ln(-x)+\ln(-\ln(-x))))\\\vdots\\W_{-1}(x)&=\lim_{n\to\infty}~_nW_{-1}(x)\end{align}

Given that we know the solution is about $1.25$ we can use the Taylor series very well. Let $y=x-\frac 54$ and your equation becomes $2y+\frac 72=e^{\frac 54}e^y$ with $y$ rather small (about $0.0064$). Use as many terms of the Taylor series as you feel like. If we use the quadratic, we get $2y+\frac 72=e^{\frac 54}(1+y+\frac {y^2}2)$ or $$\frac 12e^{\frac 54}y^2 +(e^{\frac 54}-2)y+e^{\frac 54}-\frac 72=0$$ which you can solve with the quadratic formula. It will be quite accurate because we expanded near the root. It would be even more accurate to use $y=x-1.2564$ to make $y$ small and the neglected terms of the Taylor series smaller. I don't understand why this is better than a numeric approach, but it meets the request.

There is a natural way to solve this theoretically. Let $a$ be the solution you're looking for. Then, an exact description of $a$ is given by

• $a > 0$ and $1 + 2a = e^a$.

I can understand being uncomfortable with this; we spend years of being drilled on what solutions to homework problems are "supposed" to look like, and the above solution doesn't look like that.

But this isn't a homework question — what matters is how well this description satisfies your needs.

This formulation is already good enough to do a fair amount of symbolic calculation. For example:

• In any formula containing $e^a$, you could replace it with $1 + 2a$
• In any formula containing $a$, you could replace it with $\frac{1}{2}(e^a - 1)$
• If you multiply an inequality by $a$, you know the inequalities stay the same (i.e. they aren't reversed)

Also, you've already identified that $1.25 < a < 1.26$, so in a situation where you need a numerical value to make estimates, you already have one. If you need more precision than that, the formula lends itself to a variety of ways of getting that.

In summary, you should see if the description of $a$ that you already have is good enough for your purposes, before you go through a lot of effort to produce a more complicated and cumbersome description of $a$.

And if you do have a specific need that does not appear to be satisfied, ask a question specifically about that need.

You can use Newton's method:

$f(x) = 1 + 2x - e^{x}$ so $f'(x) = 2 - e^{x}$.

Start with a reasonable approximation to the unknown root and substitute it into $x_2 = x_1 - \frac{f(x_1)}{f'(x_1)}$ and repeat until the answer converges.

Beside the analytical solution in terms of Lambert function (as Simply Beautiful Art used in his/her answer), only numerical methods (as shown in many other answers) can be used.

Similar to Taylor expansions, we also could use Padé approximants. Built around $x=\frac 54$, the simplest one would write $$2x+1-e^x \approx \frac{\frac{7-2 e^{5/4}}{2} +\frac{\left(-16+9 e^{5/4}-2 e^{5/2}\right) }{4 \left(e^{5/4}-2\right)} \left(x-\frac{5}{4}\right)}{1-\frac{e^{5/4} }{2 \left(e^{5/4}-2\right)}\left(x-\frac{5}{4}\right)}$$ Set the umerator equal to $0$ to get $$x=\frac 54-\frac{2 \left(e^{5/4}-2\right) \left(2 e^{5/4}-7\right)}{16-9 e^{5/4}+2 e^{5/2}}\approx 1.256430949$$ while the exact solution, already given by Simply Beautiful Art, is $x\approx 1.256431209$.

We could continue using $[1,n]$ Padé approximants and get the following results just solving a linear equation. What is given below are decimal representations of analytical formulae. $$\left( \begin{array}{cc} n & x_n \\ 0 & 1.256479745 \\ 1 & 1.256430949 \\ 2 & 1.256431210 \\ 3 & 1.256431209 \end{array} \right)$$