For exponential equations in the form of:

$$f(x) = a^x + b^x ,$$

is it possible to solve for a and b if you have a certain number of points?

The answers to the similar question here pertain to equations in the form of $f(x)=ae^{bx}$, and this question pertains to $f(x) = ab^x$, but it's not clear to me whether similar techniques can be used on $f(x) = a^x + b^x$.

  • 2
    $\begingroup$ Unless you are in a degenerate case, two points are enough. $\endgroup$ – Yves Daoust Jul 27 '15 at 16:15
  • $\begingroup$ How many points to you have ? $\endgroup$ – callculus Jul 27 '15 at 16:22
  • $\begingroup$ @YvesDaoust Are the degenerate cases the ones mentioned in the comments below or something else? $\endgroup$ – user124384 Jul 27 '15 at 16:23
  • $\begingroup$ @calculus I guess my question is how many points are necessary, which the above comment and the answer below seem to have answered. $\endgroup$ – user124384 Jul 27 '15 at 16:25
  • 1
    $\begingroup$ Yes, they are. In general you have enough with $n$ equations to retrieve $n$ parameters, but nonlinearities can make things more complex. $\endgroup$ – Yves Daoust Jul 27 '15 at 16:26

$$f(x) = a^x + b^x $$

You need two equations to solve for both $a$ and $b$.




Of course, there are some obvious restrictions on what points can be used to yield unique solutions.

$$x_1 \not = x_2 \not =0 $$

Of course, in all likelihood, you'll end up having to solve these equations using numerical methods.

  • $\begingroup$ Is it clear that this system always has a unique solution (up to symmetry)? If, say $x_1 =1$ and $x_2=2$ then it is certainly true, but if, say $x_1=0$ then you get no information at all from the first equation. $\endgroup$ – lulu Jul 27 '15 at 16:03
  • $\begingroup$ @lulu fixed, but it's pretty obvious that is the case... $\endgroup$ – Zach466920 Jul 27 '15 at 16:06
  • $\begingroup$ Not obvious to me...if $a=-b$ then $f(2n+1)=0$ for any integer n. So you also need to assume $a,b >0$...well, maybe I am just missing something. $\endgroup$ – lulu Jul 27 '15 at 16:15
  • $\begingroup$ @lulu you solve for $a$ and $b$...I have no comment on your objection, just extend the equations to the complex plane. $\endgroup$ – Zach466920 Jul 27 '15 at 16:21
  • $\begingroup$ If you take $x_1=1$ and $x_2=3$ we quickly get that we want $a(a^2-1) = b(1-b^2)$. Fixing some value for a we see that we want to look at the function $g(x)=x - x^3$. That function has three real zeroes and there are plenty of non-zero values y for which $y = g(x)$ has three solutions. $\endgroup$ – lulu Jul 27 '15 at 16:22

In special cases, an exact solution is possible.

Suppose the $x$ values are $x$ and $2x$. Then you have $u = a^x + b^x$ and $v = a^{2x}+b^{2x}$.

Squaring, $u^2 = a^{2x}+2a^xb^x+b^{2x} = v+2a^xb^x $, so $a^xb^x =(u^2-v)/2 $.

Since $a^x + b^x =u $, $a^x$ and $b^x$ are the roots of $0 =(z-a^x)(z-b^x) =z^2-z(a^x+b^x)+a^xb^x =z^2-uz+(u^2-v)/2 $.

Setting $d = u^2-2(u^2-v) =2v-u^2 $, the roots are $a^x, b^x =\dfrac{u \pm \sqrt{d}}{2} =\dfrac{u \pm \sqrt{2v-u^2}}{2} $.

Similar calculations can be done if the points are at $x$ and $nx$ for small $n$, such as $3$.


A straightforward method (not iterative, no initial guessed values required) is described with a numerical example in the paper : https://fr.scribd.com/doc/14674814/Regressions-et-equations-integrales , in chapter "Double exponential regression - Double power regression", pages 71-73. The method (addapted to the present case) is shown below with in addition a numerical example.

The form of the equation is slightly different, so a minor change is necessary.

In the case where the coefficients should be $b=c=1$ , the values are found slightly different. In the example below the computed values are : $b_1\simeq 1.06$ and $c_1\simeq 0.98$. This is due to the scatter of the data.

enter image description here

enter image description here

  • $\begingroup$ Holy cow, thanks for the detail. $\endgroup$ – user124384 Jul 28 '15 at 18:02
  • 1
    $\begingroup$ Holy cow, I like that language ! $\endgroup$ – JJacquelin Jul 29 '15 at 9:05
  • $\begingroup$ Just to show how fantastic is JJacquelin's approach : a standard least-square fit leads to $$y=0.976881\times 0.0669914^x+1.06316 \times1.45236^x$$ with a lot of trouble for getting good estimates. $\endgroup$ – Claude Leibovici Jul 29 '15 at 9:47

Assuming that you have $n$ data points $(x_i,y_i)$, the fit of the model $$y=a^x+b^x$$ (which is nonlinear) requires reasonable estimates of parameters $a$ and $b$ to start the nonlinear regression.

Suppose that the data are not in too much error. You can probably find among the data points two of them $(x_1,y_1)$, $(x_2,y_2)$ such that $x_2\approx 2x_1$. So, we can look at two equations $$y_1=a^{x_1}+b^{x_1}$$ $$y_2=a^{x_2}+b^{x_2}\approx a^{2x_1}+b^{2x_1}$$ Defining $A=a^{x_1}$, $B=b^{x_1}$, this give as equations $$y_1=A+B$$ $$y_2=A^2+B^2$$ Elimintaing $A$ for the first equation and replacing in the second equation leads to a quadratic in $B$ $$2 B^2-2 B {y_1}+(y_1^2-y_2)=0 $$ and then the solutions are $$A=\frac{1}{2} \left({y_1}-\sqrt{2 {y_2}-{y_1}^2}\right)$$ $$B=\frac{1}{2} \left({y_1}+\sqrt{2 {y_2}-{y_1}^2}\right)$$ from which $a=A^{1/x_1}$, $b=B^{1/x_1}$.

Let us try with JJacquelin's data points; using the $10^{th}$ and $20^{th}$ data points, we obtain $a=0.122$ and $b=1.488$. Starting the nonlinear regression with these initial values should be reasonable.

Using the whole set of data points, the iterative process converge in a small number of iterations and leads to $$y=0.100644^x+1.50081^x$$ to which corresponds $R^2=0.999828$ which shows an almost perfect fit of the data.


As marty cohen suggested, if $x_2\approx 3x_1$, doing the same as above, the equation in $B$ remains a quadratic (since the $B^3$ terms has the good idea to disappear) $$3 {y_1}B^2-3 {y_1^2}B+({y_1^3}-{y_2})=0$$ and gives $$B=\frac{ \sqrt{3y_1(4 y_2-y_1^3)}+3 y_1^2}{6 y_1}$$ Using the $5^{th}$ and $15^{th}$ data points, we obtain $a=0.083$ and $b=1.516$


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.