$a=b^x+c^x$, How to solve for $x$?

274 Views Asked by At

If $a=b^x$, then $x$ could be written in terms of $a$ and $b$; $x=\dfrac{\log(a)}{\log(b)}$.

What about $a=b^x+c^x$?

Could $x$ be written in terms of $a, b$ and $c$? $x={}$?

3

There are 3 best solutions below

7
On

The best we can do (in terms of algebraic solutions) is as follows: rewrite the equation as $$ a = \left(e^x\right)^{\ln(b)} + \left(e^x\right)^{\ln(c)} $$ setting $y = e^x$, this becomes an equation on $y$: $$ a = y^{\ln(b)} + y^{\ln(c)} $$ Or, rearranging, $$ y^{\ln(b)} + y^{\ln(c)} - a = 0 $$ In other words, we're looking for $x > 0$ that satisfy $$ x^\beta + x^\gamma - a = 0 $$ There is no general way to solve for $x$ if $\beta,\gamma$ are integers, let alone if $\beta$ and $\gamma$ can be arbitrary real numbers.

1
On

If $b>1$ then $b^x\to\infty$ as $x\to\infty$ and $b\to 0$ as $x\to-\infty$.

If $b>1$ then $b^x\to\infty$ as $x\to-\infty$ and $b\to\infty$ as $x\to-\infty$.

Either way, $b^x$ runs through all of the interval $(0,\infty)$.

Similarly for $c^x$.

If $b>1$ and $c>1$ then $b^x+c^x\to\infty$ as $x\to\infty$ and $b^x+c^x\to0$ as $x\to-\infty$.

If $b<1$ and $c<1$ then $b^x+c^x\to\infty$ as $x\to-\infty$ and $b^x+c^x\to0$ as $x\to\infty$.

Either way $b^x+c^x$ runs through the whole of $(0,\infty)$, and by the intermediate value theorem, a solution exists if $a>0$.

In those cases, you can tell whether $x$ is too big or too small, and after narrowing it down a bit, use Newton's method.

If $b>0$ and $c<0$ or vice-versa, then it's more complicated: there is a positive number that is an absolute minimum and a solution exists if, but only if, $a\ge\text{the minumum}$.

The minimum occurs at a value of $x$ for which $\dfrac d{dx}(b^x+c^x)=0$, so $$ b^x\log_e b + c^x \log_e c =0. $$ $$ \left( \frac b c \right)^x = \frac{-\log_e c}{\log_e b} = -\log_b c. $$ $$ x = \log_{b/c} (-\log_b c) = \log_{c/b}(-\log_c b). \tag 1 $$ (Notice that if either $b<1<c$ or $c<1<b$ then $\log_b c<0$ so $-\log_b c>0$ and we can take its logarithm.) The phrase "$x=$" in $(1)$ does not mean that that is a solution. Rather it mean if you plug that value of $x$ into $b^x+c^x$ you get the smallest value of $a$ for which a solution exists.

2
On

As Omnomnomnom answered, in general, there will not be explicit solutions and numerical methods, such as Newton, would be used.

Considering $$f(x)=b^x+c^x-a$$ we know that the function is such bracketted by $2 b^x-a$ and $2c^x-a$ which allows to define an approximate range for the solution.

But the function $f(x)$ can be very stiff and so the convergence could be rather slow. If instead we consider $$g(x)=\log(b^x+c^x)-\log(a)$$ the function would probably look like a straight line and convergence could be very fast.

Just in case you need it, starting with a "reasonable" guess of the solution $x_0$, Newton method will update it according to $$x_{n+1}=x_n-\frac{F(x_n)}{F'(x_n)}$$

For illustration purposes, let us choose $b=2$, $c=3$, $a=10^6$. Using the bounding functions, we know that the solution $x$ will be more or less between $12$ and $19$. So, let us start with $x_0=15$.

With $f(x)$, the successive iterates will then be $14.1523$, $13.4017$, $12.8562$, $12.6105$, $12.5708$, $12.5699$ which is the solution for six significant figures.

Doing the same with $g(x)$ and the same starting point, the successive iterates will then be $12.5713$, $12.5699$. Quite faster, isn't it ?

Edit

For the initial guess of the solution, we can do much better :

  • use the bounding functions to get the upper and lower bounds of the solution
  • compute the value of function $g(x)$ at these two points
  • assume that these two points are along a straight line ($g(x)\approx A x+B$ in the interval)
  • compute parameters $A$ and $B$ and $x=-\frac BA$. This gives as an estimate $x_0$ of the solution.

The two points having coordinates $$x_b=\frac{\log \left(\frac{a}{2}\right)}{\log (b)}~~~~\,~~~~ y_b=\log(b^{x_b}+c^{x_b})-\log(a) $$ $$x_c=\frac{\log \left(\frac{a}{2}\right)}{\log (c)}~~~~\,~~~~ y_c=\log(b^{x_c}+c^{x_c})-\log(a)$$ $$A=\frac{{x_c} {y_b}-{x_b} {y_c}}{{x_c}-{x_b}}~~~~\,~~~~ B= \frac{{y_c}-{y_b}}{{x_c}-{x_b}}$$ $$x_0=\frac {x_c y_b-x_b y_c}{y_b-y_c}$$ For the worked example, this gives $x_0\approx 12.5689$ and one single Newton iteration should suffice.

Edit

By the way, you could use the same procedure for finding the root of $$f(x)=\sum_{i=1}^n a_i^x-b=0$$ rewriting it as $$g(x)=\log\Big(\sum_{i=1}^n a_i^x\Big)-\log(b)=0$$ Admitting $a_1>a_2>a_3>\cdots>a_n>1$, the solution will be such that $$\frac{\log \left(\frac{b}{n}\right)}{\log (a_1)}<x<\frac{\log \left(\frac{b}{n}\right)}{\log (a_n)}$$

If you are lazy and do not want to perform these preliminary calculations, develop $g(x)$ as a Taylor series at $x=0$ and use as estimate $$x_0=\frac{n \log \left(\frac{b}{n}\right)}{\log \left(\prod _{i=1}^n a_i\right)}$$