# Supremum of a function

I stumbled upon this question from a previous exam in my Real analysis course.

Let $f \colon (0, 1] \to [0, 2]$ defined by $f (x) = 1 + (1 − x) \sin (1 /x)$

1. Prove that $\sup f((0,1]) = 2$.

2. Prove that $\sup f ((0, 1]) = 2$ is not reached.

I was able to prove that $2$ is an upper bound for the function but I was not able to continue further. Part 2 was easy:

Assume by contradiction that there exists $x$ such that $f(x)=2$. that would mean that $\sin(1/x)= 1/(1-x)$ which is a contradiction because that would imply that $\sin(1/x)>1$.

Suggestion :When $x \to 0$ put $x=a_{n}=\frac{1}{2n\pi+\frac{\pi}{2}}$ $$f(a_n)=1+(1-a_n)sin(\frac{1}{a_n})=\\1+(1-\frac{1}{2n\pi+\frac{\pi}{2}})sin(2n\pi+\frac{\pi}{2})=\\1+(1-\frac{1}{2n\pi+\frac{\pi}{2}})\times 1=\\2-\frac{1}{2n\pi+\frac{\pi}{2}}<2$$ and,when $x\to 1\\f(x)=1+(1-x)sin(\frac{1}{x}) \to 1+(1-1)sin(\frac{1}{1})=1$
To prove part 1 it is enough to prove that $2$ can be obtained as a limit of your function. And there is a single evenutal point where the limit can possibly not be a value of the function (since the function is continuous).