A function $f: X\subset \mathbb{R} \rightarrow \mathbb{R}$ is periodic when exist $p \in (0, \infty)$ such that $f(x+p) = f(x)$ for all $x \in X$. Prove that all continuous and periodic functions $f: X\subset \mathbb{R} \rightarrow \mathbb{R}$ are bounded and reach the maximum and minimum values. The result is valid if $f: X\subset \mathbb{R} \rightarrow \mathbb{R}$ is countinuous and periodic?
I really don't know where I can start. The hint of the book tells me: Take $x_0, x_1 \in [0,p]$ points where $f|_{\{0,p\}}$ reach the maximum and minimum values. And the answer of question is satisfied with the proof of this?
Hint. If $X=\mathbb{R}$ then the property is true. Since $f$ is continuous and the interval $[0,p]$ is closed and bounded, it follows that $f$ attains in $[0,p]$ a maximum and a minimum value, by the Extreme value theorem. Moreover, for $x\in \mathbb{R}$ let $k:=\lfloor x/p \rfloor\in\mathbb{Z}$, then $t:=x-kp\in [0,p]$ and $$f(x)=f(x-kp)=f(t).$$ Can you take it from here?
Note that $f(x)=\tan(x)$ is a periodic and continuous function in $X=\mathbb{R}\setminus\{\pi/2+k\pi:k\in\mathbb{Z}\}\subsetneq\mathbb{R}$, which is NOT bounded.