# How do I solve an exponential equation like $2^x-3^x+4=0$?

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.

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

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 !

• Is there a reason why taking the $\log$ makes Newton method converge faster? – anderstood Aug 20 '17 at 15:49
• @anderstood. Yes, it makes the function much more linear. Just plot the two functions and compare. Cheers. – Claude Leibovici Aug 20 '17 at 16:05
• Very nice. Plot available here. – anderstood Aug 20 '17 at 16:37
• @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$ – Claude Leibovici Aug 20 '17 at 16:43
• 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? – anderstood Aug 20 '17 at 16:56

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)$.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://math.stackexchange.com/questions/2400271/how-do-i-solve-an-exponential-equation-like-2x-3x4-0", "fetch_time": 1566483839000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2019-35/segments/1566027317130.77/warc/CC-MAIN-20190822130553-20190822152553-00335.warc.gz", "warc_record_offset": 542635973, "warc_record_length": 32265, "token_count": 1214, "char_count": 3400, "score": 4.28125, "int_score": 4, "crawl": "CC-MAIN-2019-35", "snapshot_type": "latest", "language": "en", "language_score": 0.7994044423103333, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00059-of-00064.parquet"}