Existence of a continuous function which does not achieve a maximum.

Your argument is correct and is probably the most straightforward. The result does not even hold in all $T_3$ spaces: in this answer I give a general method, due to Eric van Douwen, for starting with a $T_3$ space having two points that cannot be separated by a continuous real-valued function and producing from it a $T_3$ space on which all continuous real-valued functions are constant. The other answer to that question gives references to two $T_3$ spaces having two points that cannot be separated by a continuous real-valued function, and this answer expands on one of those spaces and gives yet another example of such a space.


Here is an explicit and elementary construction, using only the fact that a metric space is compact iff every sequence has an accumulation point. Let $(x_n)$ be a sequence in $X$ with no accumulation point, and define $g(x)=\inf_n d(x,x_n)+1/n$ and $f(x)=1/g(x)$. It is easy to see that $g(x)=0$ iff $x$ is an accumulation point of $(x_n)$, so $g$ is never $0$ and $f$ is defined on all of $X$. Moreover, $f(x_n)\geq n$, so $f$ is unbounded. Finally, it is straightforward to check that $g$ is continuous, and hence so is $f$.


The proof seems fine but Tietze needs to have the function continuous on a closed subset, but as it has no limit points this is given. If your function Needs to be continuous I can tell you the third question to have a negative answer.

In fact there is a non compact Hausdorff space such that the continuous functions are exactly the constant ones. Take $\mathbb{Z}^+$ with the relatively prime integer topology, here it is the case that for every non empty open sets $U,V$ the intersection $\overline{U}\cap \overline{V}\neq \varnothing$ hence every continuous function to $\mathbb{R}$ must be constant and so surely attains a Maximum. To see it is not compact is a bit more difficult, here you use that if it is compact it needs to be $T_3$ and $T_4$ (as it is Hausdorff), but with $T_4$ we would have Urysohn-Lemma which grants you more continuous mappings.