Solving an equation including $e^{-x}$ with the Lambert W function

350 Views Asked by At

Given two functions of $x$, namely $f(x)$ and $g(x)$, where $$f(x)=x^2-4x+8$$$$g(x)=3xe^{-x}$$ the shortest distance between the graphs of the functions is sought.

I begin by defining a function $h(x)$ which returns the vertical distance between the functions, $h(x)=f(x)-g(x)$.

Then I locate the global minimum by solving $h'(x)=0$, which I solve numerically and get $x\approx 1.802$, which is what I wanted.

However, I wish to solve this algebraically. The equation $h'(x)=0$ is $$3xe^{-x}-3e^{-x}+2x-4=0$$

My first instinct is to isolate the equation in the form $a=be^b$, with $a$ as a constant term, and then use the Lambert W function to solve for $x$.

Is it possible to isolate the terms in such a way, or do I have a transcendental equation? What does this mean in terms of the number of real solutions and how should I go about approximating the solution from this point?

2

There are 2 best solutions below

0
On

$h(x) = f(x)-g(x) = x^2-4x+8-3xe^{-x}$

$y=min\{h(x) , x \in \mathbb{R} \}$

Now note that $h'(x)=2x-4-3e^{-x}+3xe^{-x}=2(x-2)+3e^{-x}(x-1)$

$h'(x) = 2(x-2)+3(x-1)*e^{-x}=0$ gives $2*e^{x}(x-2)+3(x-1)=0$, cause $ e^{x}\not=0$. Solving this equation is not easy, but if you want to do this I would also suggest using the Lambert equation.

0
On

$$h'(x)=3xe^{-x}-3e^{-x}+2x-4=0\implies e^{-x}=-\frac 23\,\frac{ x-2}{ x-1} $$ and the solution is given in terms of the generalized Lambert function (have a look at equation $(4)$).