Solving $\ln\left(\frac{1}{x-2}\right)=\frac{1+2e^x}{e^x}$

122 Views Asked by At

Here's the question I came across, they're inverses in this case, but I imagine that there is a way to do that without them being inverses.

$$\ln\left(\frac{1}{x-2}\right)=\frac{1+2e^x}{e^x}$$

1

There are 1 best solutions below

0
On

We're trying to solve the following equation for x: $$\log\left(\frac{1}{x-2}\right) = \frac{1+2e^x}{e^x}$$ As you pointed out, these expressions are inverses of each other. By substituting one side into the other, we can observe that $$x = \log\left(\frac{1}{x-2}\right)$$ (i.e. $x$ equals $y$ at the intersection of the graphs of these functions). From this position we can take the exponential of both sides and multiply by the denominator to get: $$(x-2)e^{x}=1$$ Unless you have some prior experience with these sorts of problems, this looks equally hopeless. The key is to introduce the Lambert W-Function also known as Product Log (ProductLog in Mathematica). The key property of this function is that: $$W(x)e^{W(x)} = x$$ We can get our prior equation into this form by multiplying both sides by $e^{-2}$ $$(x-2)e^{x-2}=\frac{1}{e^2}$$ Implying, using our new function, $$x-2 = W\left(\frac{1}{e^2}\right)$$ Giving us our final expression for $x$: $$x = 2 + W\left(\frac{1}{e^2}\right)$$ WolframAlpha is happy to evaluate this for you and yields the result $x\approx 2.12003$, or you can use infinite series available at the previously linked resources to compute it on your own with some code. For example: $$x = 2+\sum_{n=1}^{\infty}\frac{(-n)^{n-1}}{n!}e^{-2n}$$

import math

def W(x):
    return sum( [ x**n * (-n)**(n-1) / (math.factorial(n)) for n in range(1,100)] )

x = 2 + W(math.e ** -2)
print(x)

Which will print 2.1200282389876413