Show that a continuous periodic function on $\mathbb{R}$ attains its maximum and minimum. - Proof Verification Let $f$ be a continuous periodic function on $\mathbb{R}$, that is $\exists\ d > 0$ s.t $f(x+d) = f(x)\  \forall x \in \mathbb{R}$.
I believe I have the whole idea of how to prove this, but I'm not sure if there is anything more I can do to make it more "formal".
Attempt:
If our function $f$ is constant then its minimum and maximum are attained trivially, so suppose that our function is not constant.
Choose any arbitrary $x \in \mathbb{R}$. Consider the compact interval $[x, x+d]$. Given that $f$ is continuous on a compact set, then by the Extreme Value Theorem our function $f$ will attain its max and min. 
Since $x$ was arbitrary we can write $\mathbb{R}$ as $\mathbb{R} = \cup_{i=1}^{\infty}[x,x+d]_{i}$.
Since the function $f$ attains its maximum and minimum over each individual compact set the function will attain both of these over the union of the sets. Matter of fact the same max and min will be repeated infinitely. 
Thought: 
This doesn't feel complete to me. But I can't see what could be missing. 
 A: Actually, for this question, there is no need to consider separately the cases where the function is constant vs when it isn't.
By the way, your indexing for the union is weird. It might be easier to just write it out explicitly:
\begin{equation}
\Bbb{R} = \dots \cup [x-2d, x-d] \cup [x-d, x] \cup [x, x+d] \cup [x+d, x+2d] \dots
\end{equation}
This, although tedious, gives a clear meaning of what you intend to say (and I'm sure most people will be fine with the use of $\dots$ because the intended meaning is clear). This is better than giving an incorrect statement, because currently what you have written does not make sense. 
However, if you really want to write $\Bbb{R}$ as an infinite union, you could do something like: 
\begin{equation}
\Bbb{R} = \bigcup_{n \in \Bbb{Z}} \left[x+nd, x+(n+1)d \right]
\end{equation}

Added Remarks:
The idea of your proof is certainly correct (and if you make the notational change I suggested above, it will certainly constitute a rigorous proof), but you should note that there is no need to consider an arbitrary $x$, simply pick $x=0$.
