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)$
Prove that $\sup f((0,1]) = 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$.
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).