# Show that $\{x \in \mathbb R : x^2 + e^x = 1\}$ is compact

Show that $\{x \in \mathbb R : x^2 + e^x = 1\}$ is compact

I was thinking that I can approach this using Heine-Borel, and say that the set is compact if it is both closed and bounded. The problem is that I'm not quite sure how to go about solving the actual equation $x^2 + e^x = 1$ or if I even need to solve it.

What I'm thinking is that if I can somehow prove $x^2 + e^x = 1$ has a finite solution set, then it's compact because a finite set is closed and bounded.

How can I prove $x^2 + e^x = 1$ has a finite number of solutions? Or is there a better way?

## 3 Answers

The function $x\mapsto x^2+e^x$ is continuous, hence your set (as inverse image of the closed set $\{1\}$) is closed. It is also bounded because $e^x>0$ and so $x^2<1$ (i.e., $-1<x<1$) for points in the set.

• Could you do a quick explanation of why the inverse image of a closed set is closed? May 22, 2017 at 11:35
• @AR7: by topological continuity. The inverse image of a closed set (like $\{0\}$) is closed. May 22, 2017 at 11:40

Since you also asked to prove that the set is finite (which is of course much stronger than compact):

If $f(x)=x^2+e^x-1$ has infinitely many roots, then by Rolle's theorem the same holds for $f'$ and thus also $f''$. But $f''(x)=2+e^x$ has no roots at all.

• your proof shows that $f$ is concave up (same as convex), and hence has a most two roots. A plot confirms that it indeed does have exactly two roots. Alternatively, use that $f(0)=0$, $f'(0)=1>0$, and $f(x)\to\infty$ when $x\to\pm\infty$, hence $f$ has at least two roots. May 24, 2017 at 3:00

Let's call your set $A$.

Being your $A\subseteq\Bbb R$, you know that it is compact iff it is closed and bounded.

Now $A$ is closed since it is counterimage of the singleton $\{1\}$ (which is closed) thru the continous function $f(x)=x^2+e^x$.

Finally, $A$ is bounded since

$$\lim_{x\to\pm\infty}f(x)=+\infty\;\;.$$