# Intermediate value theorem question with regards to cosine function

In my assignment I have to prove the following:

Prove that for the function $$f(x) = e^{-x} +\cos x$$ there is a solution for every $-1<c<2$ in the halfopen interval $[0, \infty)$, such that $f(x) =c$.

From the IVT I know that if $f$ is continues then I can prove it, but I'm not sure about the definition of a function in a closed interval. The function's image should be in the closed interval?

If I understand it right then here's my solution and I ask you please to let me know if it's wrong.

$\cos x$ is continuous always, and so is $e^x$. Therefore the whole function is continuous.

I also prove in my solution that $-1=\inf f$ and $1=\sup f$. Therefore I can define the closed interval $[-1,1]$ and say that according to IVT there for every c in the interval, there is some $f(t) =c$.

Did I get it right?

Thanks,

Alan

• I would add that $f(x)=-x$ is continuous and that $e^{-x}=g(f(x))$ where $g(x)=e^x$. Since both $f$ and $g$ are continuous in $\mathbb{R}$ then $e^{-x}=g(f(x))$ is continuous. – Joaquin Liniado Jun 13 '15 at 15:29
• @JoaquinLiniado thank you. So you're saying that my solution is correct, with some additional words required? – Alan Jun 13 '15 at 15:38
• $-1$ is not attained – and that's why uou can use the plain IVT. – Bernard Jun 13 '15 at 15:45

I think $2$ would be $\sup(f)$ (for $x=0$) , the rest of your proof seems correct to me
Consider the points $x_n:=(2n+1)\pi$. One has $f(0)=2$ and $$f(x_n)=e^{-(2n+1)\pi}-1\searrow-1\qquad(n\to\infty)\ .$$ It follows that for any given $c\in\ ]{-1},2[\$ there is an $x_n$ with $f(0)>c>f(x_n)$, and therefore an $x\in\ ]0,x_n[\$ with $f(x)=c$.