9
$\begingroup$

I was wondering if there was a general way to solve an equation like this: $$2^x-3^x+4=0.$$ Can this be done using logarithms? If not, then is there a way to solve it that doesn't involve "guessing" and approximations? The Desmos graphing calculator gives me an answer that is about $1.8453$, but I'm sure the calculator is using Newton's method or something similar to find the zero. I would like to know if logs can be used here.

$\endgroup$
  • $\begingroup$ i think a numerical method is a good choice $\endgroup$ – Dr. Sonnhard Graubner Aug 20 '17 at 15:06
  • $\begingroup$ we find $$x\approx 1.84529214059027988615$$ $\endgroup$ – Dr. Sonnhard Graubner Aug 20 '17 at 15:10
  • $\begingroup$ @Dr.SonnhardGraubner Are numerical methods the only way? $\endgroup$ – name Aug 20 '17 at 15:12
  • $\begingroup$ yes i think so it is the only way $\endgroup$ – Dr. Sonnhard Graubner Aug 20 '17 at 15:14
7
$\begingroup$

Only numerical method will do the job.

The simplest way would be to write $$f(x)=\log(3^x)-\log(4+2^x)=0$$ that is to say $$f(x)=x\log(3)-\log(4+2^x)=0$$ for which Newton method would converge very fast even (being lazy) starting using $x_0=0$) $$\left( \begin{array}{cc} n & x_n \\ 0 & 0 \\ 1 & 1.6765277714583058979 \\ 2 & 1.8431477981442746026 \\ 3 & 1.8452917833976451640 \\ 4 & 1.8452921405902699713 \\ 5 & 1.8452921405902798862 \end{array} \right)$$

Edit

Just for the fun of it, let us consider the case of $$a^x-(a+1)^x+(a+2)=0$$ what, as before, we can write as $$f(x)=x \log(a+1)-\log(a+2+a^x)=0$$

From a numerical point of view, it is amazing to notice that, for all $a \geq 2$, the solution is $1.797 \leq x \leq 2.000$. So, let us use, for any $a$, $x_0=\frac 95$. This gives as first iterate of Newton method $$x_1=\frac{9}{5}-\frac{\frac{9}{5} \log (a+1)-\log \left(a^{9/5}+a+2\right)}{\log (a+1)-\frac{a^{9/5} \log (a)}{a^{9/5}+a+2}} $$

The following table gives, for a few values of $a$, the first iterate of Newton method as well as the exact solution (which is reached using a couple of Newton iterations). $$\left( \begin{array}{ccc} a & x_1 & \text{solution} \\ 2 & 1.84513 & 1.84529 \\ 3 & 1.81103 & 1.81105 \\ 4 & 1.80050 & 1.80050 \\ 5 & 1.79759 & 1.79759 \\ 6 & 1.79768 & 1.79768 \\ 7 & 1.79908 & 1.79908 \\ 8 & 1.80105 & 1.80105 \\ 9 & 1.80325 & 1.80326 \\ 10 & 1.80551 & 1.80553 \end{array} \right)$$ which does not seem to be too bad !

$\endgroup$
  • $\begingroup$ Is there a reason why taking the $\log$ makes Newton method converge faster? $\endgroup$ – anderstood Aug 20 '17 at 15:49
  • 3
    $\begingroup$ @anderstood. Yes, it makes the function much more linear. Just plot the two functions and compare. Cheers. $\endgroup$ – Claude Leibovici Aug 20 '17 at 16:05
  • $\begingroup$ Very nice. Plot available here. $\endgroup$ – anderstood Aug 20 '17 at 16:37
  • 3
    $\begingroup$ @anderstood. This is the trick when you have nonlinear equations : find a transform which make them almost linear. Just for the fun of it, tomorrow, I shall do it for $a^x-(a+1)^x+(a+2)=0$ $\endgroup$ – Claude Leibovici Aug 20 '17 at 16:43
  • $\begingroup$ Not only makes it converge faster, but I suppose it also makes Newton method less sensitive to the initial guess (it it less likely to jump to another root), right? $\endgroup$ – anderstood Aug 20 '17 at 16:56
6
$\begingroup$

We can rewrite our equation in the following form. $$\left(\frac{2}{3}\right)^x+\frac{4}{3^x}=1$$ and since $f(x)=\left(\frac{2}{3}\right)^x+\frac{4}{3^x}$ decreases, we see that our equation has maximum one root.

But $f(0)>1$, $f(2)<1$ and $f$ is a continuous function,

which says that our equation has an unique root on $(0,2)$.

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