# How do we construct a continuous function on the interval $(0, 1]$ without a minimum or a maximum?

One of my Calculus lecture videos poses the following challenge (shortly after an exposition of the Extreme Value Theorem):

Construct a function $$f$$ such that

• $$f$$ is continuous on $$(0, 1]$$
• $$f$$ does not have a maximum on $$(0, 1]$$.
• $$f$$ does not have a minimum on $$(0, 1]$$.

After some thinking, I came up with the following function $$f$$, but on further thought I don't think it meets the requirements, because it's not continuous on its domain. Does anyone know how to do it?

Solution or hints are both welcome (I'm not being graded for this)

• how about $\dfrac1x \sin(\dfrac1x)?$ – J. W. Tanner May 31 at 18:31
• Do you mean absolute or relative max and min? – ajotatxe May 31 at 18:54
• @ajotatxe Absolute, I believe – Calculemus May 31 at 19:08

Your idea is right. You want a $$\sin$$ curve that oscillates with increasingly narrow high peaks and low valleys.
The question asks for the open end at $$0$$, which makes things easier. Just use $$\frac{\sin (1/x)}{x}.$$
The number $$1$$ does not belong to the domain of your function, but you can take$$\begin{array}{rccc}f\colon&(0,1]&\longrightarrow&\mathbb R\\&x&\mapsto&\frac1x\cos\left(\frac1x\right).\end{array}$$It is continuous. It has no maximum, because if $$x=\frac1{n\pi}$$, with $$n$$ even, then $$f(x)=n\pi$$. And it has no minimum, because if $$x=\frac1{n\pi}$$ with $$n$$ odd, then $$f(x)=-n\pi$$.