# continuous and bounded function without maximum or minimum

Give an example that contradicts this sentence :

$f:(0,1]\to\Bbb R$ is a continuous and bounded function in $(0,1]$ then : $f$ has maximum or minimum.

I have understood that $\sin(1/x)$ could be a right contradiction but I can't understand why this works ?

Could anyone here explain me ? Thanks :)

Your example of $\sin \frac{1}{x}$ doesn't work because it has a maximum value of $1$ and a minimum value of $-1$. But $\sin \frac{1}{x}$ oscillates near $0$, which is good; in order to get the behaviour you want you should multiply $\sin \frac{1}{x}$ by a function defined on $[0,1]$ which takes a maximum value at $0$, such as $e^{-x}$ or $1-x$.
In other words, any function like $e^{-x}\sin \frac{1}{x}$ or $(1-x)\sin \frac{1}{x}$ will do, or more generally any $g(x)\sin \frac{1}{x}$ for $g : [0,1] \to \mathbb{R}$ where $|g|$ takes a maximum value at $0$.