Stumped by equation that contains both exponential and logarithm

I can handle most equations I have seen which have only an exponential or only a logarithm, but I am stumped by an equation/expression that contains both. How do I solve for x here:

$$e^{-x^2} = \ln(x)$$

My calculator says the answer is approx 1.23 but I don't know the steps to get there. Even Wolfram Alpha does not show the steps.

• This can only be solved numerically. Look up Newton's Method amongst others.
– Paul
Dec 7 '17 at 19:04
• Numerical methods. Dec 7 '17 at 19:04
• Welcome to stackexchange. Check out the mathjax formatting for future reference. Dec 7 '17 at 19:07
• by a numerical method we get $$x\approx 1.23983938579896511012$$ Dec 7 '17 at 19:12

This is one of many, many equations where we can't solve for $x$ analytically. This frequently happens when we combine two different types of functions in an equation, from among the basic types: exponential, trigonometric, polynomial, inverse trigonometric, logarithmic.

In some cases, when certain combinations come up often enough in practice, we have invented special functions that we can use to write down solutions, such as sometimes when Wolfram Alpha gives you a solution in terms of the Lambert W-function, or something like that.

In this case, you could rewrite your equation as either $-x^2=\ln\ln x$, or $e^{e^{-x^2}}=x$, but neither of these is helpful. We're either mixing exponentials with logs, exponentials with polynomials, or logs with polynomials. This is the sort of situation for which numerical methods exist. At the simplest level, there is the bisection method; much faster methods exist, including Newton's and others.

Even with just a pocket calculator to hand, you can perform your own iteration and see the solution converging.

To solve any equation of the form $f(x)=0$, one can first rearrange it into the form $x = g(x)$, and then use the iterative formula, $$x_{n+1} = g(x_n),$$ with some suitable starting value of $x_0$. In this case, $e^{-x^2} = \ln x$ rearranges to $$x = e^{e^{-x^2}}$$ where $x_0 = 1$ is a suitable starting value. Then the ensuing values are: $$x_1 = 1.4446...$$ $$x_2 = 1.1320...$$ $$x_3 = 1.3199...$$ $$x_4 = 1.1913...$$ By about $x_{10}$ the solution is approximately $1.24$ to three significant figures. This iterative method is fairly standard in the final years of most high school courses, and can be found here.

Solving the equation is the same as finding the zero of function $$f(x)=e^{-x^2} - \ln(x)$$ The first derivative is $$f'(x)=-2xe^{-x^2} -\frac 1x$$ and it is always negative; so, if there is a root, it is unique.

Graphing (or by inspection) we know that the root is between $1$ and $2$ since $f(1)=\frac{1}{e} >0$ and $f(2)=\frac{1}{e^4}-\log (2)<0$.

Newton method is a very simple solution. Starting from a guess $x_0$, the method will update it according to $$x_{n+1}=x_n-\frac{f(x_n)} {f'(x_n) }$$ So, for your problem, let us select $x_0=1.5$ (the midpoint of the interval which contains the root). Newton method will then generate the following iterates $$\left( \begin{array}{cc} n & x_n \\ 0 & \color{red}{1.}5000000000000000000 \\ 1 & \color{red}{1.}1947026448850956405 \\ 2 & \color{red}{1.23}87017791635914691 \\ 3 & \color{red}{1.23983}86413261924637 \\ 4 & \color{red}{1.239839385798}6460372 \\ 5 & \color{red}{1.2398393857989651101} \end{array} \right)$$