TITLE: For which $a$ does the equation $a^x=x+2$ have two solutions?
QUESTION [5 upvotes]: I need to find values of $a$ for the following equation to have two real solutions.
$$a^x=x+2$$

$(1,\infty)$
$(0,1)$
$1/e,e$
$(1/(e^e), e^e)$
$(e^{1/e}, \infty)$

This is how I solved this exercise, but I don't understand some things.

I would like to know if there's another way to solve this kind of exercise. I would be happy if I would get some ideas.
Also, from my solution, I don't understand why from that table results just one solution and from the graphic results two solutions. Usually, to see the number of solutions I use this kind of table.
For $a>1$, $f$ decreases from infinity to -1, then increase from -1 to infinity. I'm really confused. Need some suggestions here.
Thank you!

REPLY [10 votes]: Your attempt is wrong, sorry: you cannot just use particular cases. And the case $a=-e$ is impossible, because $a^x$ is only defined for $a>0$. The answer should be in terms of $a$, and using a single value is not enough.
Consider the function $f(x)=a^x-x-2$. Then
$$
f'(x)=a^x\log a-1
$$
(with $\log$ being the natural logarithm).
This doesn't vanish for $0<a\le 1$, so the function can have two zeros only for $a>1$.
In this case the point of minimum is at
$$
x=-\frac{\log\log a}{\log a}
$$
Set $b=\log a$, for simplicity. Then $a=e^b$ and $a^x=e^{bx}$; we want to evaluate
$$
f\left(-\frac{\log b}{b}\right)=e^{-\log b}+\frac{\log b}{b}-2=\frac{-1+\log b-2b}{b}
$$
Consider $g(t)=-1+\log t-2t$, for $t>0$; then $g'(t)=\frac{1}{t}-2$, which vanishes for $t=1/2$; since
$$
g(1/2)=-1-\log2-1<0
$$
you have the desired answer, because this implies $g(b)<0$.