I am trying to solve the following equation.

$$ \frac{d}{dx}\left[\frac{b}{x}\left({n+2^x}\right)\right]=0 $$

My trial: \begin{align} \frac{d}{dx}\left[\frac{b}{x}\left({n+2^x}\right)\right] &={b}\cdot\frac{2^x x \ln{2} - \left({n+2^x}\right)}{x^2}\\ &=0\\ \end{align}

$$ \therefore 2^x x \ln{2} - \left( n+2^x \right)=0\\ 2^x\left(x\ln2-1\right)=n\\ x=??? $$

I failed to find vale of $x$. Please let me know next step. Thank you.

  • 1
    $\begingroup$ Well, the equation is monotonic, so it should have a unique solution. Numerical methods such as newton's method would probably work. Not sure if there's an analytic approach $\endgroup$ – Alan Oct 30 '15 at 5:47

The equation $$2^x\left(x\ln(2)-1\right)=n$$ does not show solution in terms of elementary function and, in principle, only numerical methods (such as Newton) would need to be used.

However, for your curiosity, there is a solution in terms of Lambert function which is such that $z=W(z)\, e^{W(z)}$. In the case of the considered equation, the solution would be $$x=\frac{W\left(\frac{n}{e}\right)+1}{\log (2)}$$ In the Wikipedia page, they give approximate expressions which allow quite accurate evaluation of the function.

In practice, any equation which can write $$A+Bx+C\log(D+Ex)=0$$ has solutions which can express in terms of Lambert function.

For illustration purposes, let us consider a large value such as $n=123456789$ and let us use $$W(z)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\cdots$$ where $L_1=\log(z)$ and $L_2=\log(L_1)$. We shall then have $z \approx 4.54172\times 10^7$, $L_1\approx 17.6314$, $L_2\approx 2.86968$ and then $W\left(\frac{n}{e}\right)\approx 14.9285$ and $x\approx 22.9800$ which is the solution for six significant figures.


If you cannot use Lambert function, you need to apply some numerical method for finding the root of an equation $F(x)=0$. There are many of them but, at least to me, the simplest is Newton. Starting from a "reasonable" guess $x_0$, the method updates it according to $$x_{n+1}=x_n-\frac{F(x_n)}{F'(x_n)}$$ In the case of the equation you posted, you certainly noticed that it is extremely stiff and this is not very convinient. However, if you plot its logarithm, it look much better (for $x>5$, it really looks like a straight line). So, let us consider $$F(x)=\log\left(2^x\left(x\ln(2)-1\right)\right)-\log(n)$$ If $n$ is large, you easily percieve that the equation is $\approx \log(2^x)-\log(n)=x\log(2)-\log(n)$; so, a "reasonable" guess could be $x_0=\frac{\log(n)}{\log(2)}$. Let us apply it with $n=123456789$; so the successive iterates will be $$x_0=26.8794$$ $$x_1=22.9616$$ $$x_3=22.9795$$ which is the solution for six significant figures.

If we had worked without the logarithmic transform, the iterates would have been $$x_0=26.8794$$ $$x_1=25.5916$$ $$x_3=24.4288$$ $$x_4=24.4288$$ $$x_5=23.5371$$ $$x_6=23.0797$$ $$x_7=22.9831$$ $$x_8=22.9795$$ which is much slower than the previous case.

For sure, plotting the function would give a closer starting point.

If I may suggest, have a look at the Wikipedia page about Lambert function; it is a really interesting function witha lot of practical applications. If you search on this site, you will find a lot of questions the answers of which being ... Lambert !

I hope and wish this heps you. If this is not the case, just post.

  • $\begingroup$ Hmm, I am sorry that I don't understand this answer. I am frustrated because of my ignorance. :( $\endgroup$ – Danny_Kim Nov 1 '15 at 10:05
  • $\begingroup$ Are you familiar with Newton method for solving equations ? I you are, I shall add to my answer. Cheers :-) $\endgroup$ – Claude Leibovici Nov 1 '15 at 10:08
  • $\begingroup$ Newton method is more familiar for me. However, I am trying to understand Lambert function. I am now reading wikipedia which is hard for me(newbie) to understand, but I can borrow books tomorrow. My school's library will be open tomorrow :) $\endgroup$ – Danny_Kim Nov 1 '15 at 10:10
  • $\begingroup$ Sorry, but I have to go now. I shall try to be back in a couple of hours. $\endgroup$ – Claude Leibovici Nov 1 '15 at 10:43
  • $\begingroup$ Wow, I appreciate and I'm impressed for your good answer. I totally understand the means of Newton method, and I kind of understand the Lambert. Thank you~ $\endgroup$ – Danny_Kim Nov 3 '15 at 12:45

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.