9
$\begingroup$

Consider the equality

$$a^x = bx + c$$

For simplicity and to avoid trivial cases, I would like to limit $a,b,c$ to be positive real numbers where $a \ne 1$ and $b \ne 0$. (Solving those two cases is easy.) I can't really see a way to manipulate this using logarithm and exponent properties.

How might one solve for $x$? Moreover, what if I have an inequality instead and want to solve for $x$ then?


(There is a bit of context in me asking this question and posting my own answer. Namely, I often see a fair number of questions in this vein on the site, albeit with specified constants or perhaps an inequality thrown in. This answer handles a lot of these through its generality, so I think there is merit in posting and answering this question, as it could serve as a useful place to direct more specific questions.)

$\endgroup$
1
  • 2
    $\begingroup$ This is indeed a very good idea ! So $2 \times (+1)$ $\endgroup$ – Claude Leibovici Aug 14 '20 at 9:52
15
$\begingroup$

Opening:

To begin, whenever one finds an equation of this form to solve, they almost always have to resort to use of the Lambert W function - though a deceptively simple equation, it's actually very difficult to solve for $x$ when it is in these two different positions (as a linear term and in an exponent). Some simpler cases (such as $2^x = x+2$) can often be solved by guess-and-check, but otherwise the W function will be as close one gets to a closed form solution.

The Lambert W function $W(x)$ is the function which is the inverse to $f(x)=xe^x$. That is,

$$W(x)e^{W(x)} = x = W(xe^x)$$

Luckily this function is fairly well studied, and thus can be approximated, so you might have numerical solutions; I suggest looking at the linked Wikipedia article or elsewhere for ideas on doing so.

Note that the Lambert W function can be defined for complex numbers as well; throughout the below derivations, assume $W=W_0$, i.e. we are working on the principle branch.


General Case:

For now, however, we focus on handling the equality in its full generality as stated:

$$a^x = bx + c \tag 1$$

To start with, we'll make things easier for us: let $u := bx+c$, which gives $x = (u-c)/b$. Then $(1)$ becomes

$$a^{(u-c)/b} = u \tag 2$$

Our goal for now is to get $u$; we'll want to create something of the form $we^w$ on one side of the equation (where $w$ contains our variable of concern, $u$, and the variable only appears on that side). We'll divide both sides by the left-hand side; the negative exponent that results can be used to reverse the subtraction in the numerator. Then we get

$$ua^{(c-u)/b} = 1 \tag 3$$

We'll use some exponent properties next: note that

$$a^{(c-u)/b} = a^{c/b - u/b} = a^{c/b} a^{-u/b}$$

We apply this to $(3)$ and then divide both sides by $a^{c/b}$ to achieve this:

$$ua^{-u/b} = a^{-c/b} \tag 4$$

We want to continue making the form $we^w$ appear; at this point, it would be prudent to note the familiar property

$$x^y = e^{\log(x^y)} = e^{ y \log(x)}$$

We apply this in the case of the $a^{-u/b}$ term in $(4)$ to obtain

$$u \exp \left( -\frac u b \log(a) \right) = a^{-c/b} \tag 5$$

Now, clearly, if we multiply both sides by $-\log(a)/b$, we'll attain the desired form, so we do so:

$$-\frac u b \log(a) \exp \left(- \frac u b \log(a) \right) = -\frac{\log(a) a^{-c/b}}{b} \tag 6$$

Next, we apply the W function to both sides of $(6)$. Recall that $W(we^w) = w$; in our case, $w = u \log(a) / b$. The right-hand side won't be able to be simplified however. Regardless, we obtain

$$-\frac u b \log(a) = W \left( -\frac{\log(a) a^{-c/b}}{b} \right) \tag 7$$

Multiply both sides by $-b/\log(a)$; this lets us solve for $u$, and then we can bring $x$ back into the picture:

$$u = bx + c = -\frac{b}{\log(a)} W \left( -\frac{\log(a) a^{-c/b}}{b} \right) \tag 8$$

Solve for $x$ by subtracting $c$ and dividing by $b$ (note the latter gets rid of the $b$ in the coefficient of the W function):

$$x = - \frac c b -\frac{1}{\log(a)} W \left( -\frac{\log(a) a^{-c/b}}{b} \right) \tag 9$$

It would be prudent to use this general solution in a few equations alongside properties of the W function to show the use of the general solution above.


Example $\#1$:

Consider the equation

$$e^x = x + 1$$

On inspection, clearly $x=0$ is a solution, but we can verify this. Notice that, here, $a=e$ and $b=c=1$. Then, using the general form,

$$x = - \frac{1}{1} - \frac{1}{\log(e)} W \left( - \frac{\log(e)e^{-1/1}}{1} \right)$$

Thankfully, $\log(e) = 1$ and other simplifications occur, yielding

$$x = - 1 - W(-1/e)$$

This is a special value of the Lambert W function: $W(-1/e) = -1$. Thus, from this, we conclude $x=0$. If one would rather follow the same process as when we derived the general form, this is how it would go:

$$\begin{align} e^x = x + 1 &\implies e^{u-1} = u \\ &\implies ue^{1-u} = 1 \\ &\implies ue^1e^{-u} = 1 \\ &\implies ue^{-u} = 1/e \\ &\implies -ue^{-u} = - 1/e \\ &\implies W(-ue^{-u}) = W(-1/e) = -1 \\ &\implies -u = -1 \\ &\implies u = 1 \\ &\implies x+1 = 1 \\ &\implies x = 0 \end{align}$$


Example $\#2$:

Consider the equation

$$2^x = 2x$$

In this case, $a=b=2$ and $c=0$. $x=1$ is a clear solution on inspection, but let's verify. Then, per the general solution in $(9)$,

$$x = - \frac{0}{2} - \frac{1}{\log(2)} W \left( - \frac{\log(2)2^{0/2}}{2} \right) = - \frac{1}{\log(2)} W \left( - \frac{\log(2)}{2} \right)$$

Another useful property of the W function is that $W(-\log(a)/a) = -\log(a)$ (whenever $a \in [1/e,e]$). This lets us simplify the expression and negate the factor of $-1/\log(2)$, to conclude indeed $x=1$.

If one preferred to follow the more standard derivation without appealing to the general form:

$$\begin{align} 2^x = 2x &\implies 2^{u/2} = u \\ &\implies u2^{-u/2} = 1 \\ &\implies u\exp \left( - \frac u 2 \log(2) \right) = 1 \\ &\implies -\frac u 2 \log(2) \exp \left( - \frac u 2 \log(2) \right) = -\frac{\log(2)}{2} \\ &\implies W \left( -\frac u 2 \log(2) \exp \left( - \frac u 2 \log(2) \right) \right) = W \left( -\frac{\log(2)}{2} \right) \\ &\implies - \frac u 2 \log(2) = - \log(2) \\ &\implies \frac u 2 = 1 \\ &\implies \frac{2x}{2} = 1 \\ &\implies x = 1 \end{align}$$


Example $\#3$:

Consider the final example equation of

$$2^x = 3x + 4$$

We can only really appeal to the general form or process here, and not any special properties or values. Substitution of $a=2,b=3,c=4$ gives us

$$x = - \frac{4}{3} - \frac{1}{\log(2)} W \left( - \frac{\log(2)2^{-4/3}}{3} \right)$$

Wolfram gives an exact answer of $x=4$ (which would be for the principal branch), and an approximation of $x \approx -1.18692$ for the lower branch $W_{-1}$. (This is because the principal branch only covers $x \ge -1$; the $W_{-1}$ branch covers the remainder of the reals.) To derive the exact answer in the more typical manner,

$$\begin{align} 2^x = 3x + 4 &\implies 2^{(u-4)/3} = u \\ &\implies 2^{u/3} 2^{-4/3} = u \\ &\implies u2^{-u/3} = 2^{-4/3} \\ &\implies u \exp \left( - \frac u 3 \log(2) \right) = 2^{-4/3} \\ &\implies - \frac u 3 \log(2) \exp \left( - \frac u 3 \log(2) \right) = - \frac{\log(2)2^{-4/3}}{3} \\ &\implies - \frac u 3 \log(2) = W \left( - \frac{\log(2)2^{-4/3}}{3} \right) \\ &\implies u = - \frac{3}{\log(2)} W \left( - \frac{\log(2)2^{-4/3}}{3} \right) \\ &\implies 3x + 4 = - \frac{3}{\log(2)} W \left( - \frac{\log(2)2^{-4/3}}{3} \right) \\ &\implies x = - \frac 4 3 - \frac{1}{\log(2)} W \left( - \frac{\log(2)2^{-4/3}}{3} \right) \end{align}$$

(I'm honestly not sure how to manipulate this into $x=4$, however.)


Some Final Notes:

To handle the case of inequalities, at least on the principle branch, note that $W(x)$ is a monotonic-increasing function. Thus, if $x < y$, then $W(x)<W(y)$. Accordingly, for instance, if our equation in Example $\#3$ was instead $2^x > 3x+4$, we could claim, at the end,

$$x < - \frac 4 3 - \frac{1}{\log(2)} W \left( - \frac{\log(2)2^{-4/3}}{3} \right)$$

(Bear in mind two multiplications by $-1$ happen throughout the solving process, at $(6)$ and $(8)$ in the general form. At one point we also flip the order of equality, at $(3)$, since that's how these are normally displayed. Thus, there's a change in the inequality.)

Thus, to solve inequalities of the form $a^x > bx +c$ (or any other desired order), solve $a^x = bx + c$, and, once you have your solution of $x = f(a,b,c)$, then you can replace that equality with the opposite order (here, $x < f(a,b,c)$).

Finally, while not strictly the purpose of this question, I think it might be important to cover the exempted cases of $b= 0$ and $a=1$ as well...


Special Case $(b = 0)$:

If $b=0$, the previous process doesn't work; let's start at the beginning:

$$a^x = c$$

Take the logarithm of both sides, and you can solve for $x$ easily:

$$\log(a^x) = x \log(a) = \log(c) \implies x = \frac{\log(c)}{\log(a)}$$


Special Case $(a = 1)$:

In this case, our equation is

$$1^x = bx + c$$

Since $1^x = 1$ for all $x$, this is a trivial equation to solve, for which

$$x = \frac{1-c}b$$


Special Case $(b = 0 \land a = 1)$:

In this case our equation is $1^x = 0x + c$ - equivalent to $1=c$ - which is true for no $x$, unless $c=1$. Then it is true for all $x$.

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