# Extreme value theorem: help with contradiction

I have a problem understanding the last part of the usual proof of the extreme value theorem (found for example here: Extreme Value Theorem proof help)

It is this part that I have trouble understanding:

Since $$g(x)=\dfrac1{M−f(x)}\leq K$$ is equivalent to $$f(x)\leq M−\dfrac1K$$, we have contradicted the fact that $$M$$ was assumed to be the least upper bound of $$f$$ on $$[a,b]$$. Hence, there must be a balue $$c\in[a,b]$$ such that $$f(c)=M$$.

Why is it that we are sure that there exist a c on the interval where the maximum is attained? I mean, don't we just know that the new sup is $$M-\dfrac1K$$, but that it necessarily will not attain a max on the interval? Or do we have to assume that the function $$g$$ that we create attains a maximum for $$f$$ to attain a maximum?

Because we don't have a new $$\sup f$$. By definition, $$M=\sup f$$ and that proof proves that if there was no such $$c$$, then we would have $$\bigl(\forall x\in[a,b]\bigr):f(x)\leqslant M-\frac1K$$, which is impossible, because it would follow from that that $$\sup f\leqslant M-\frac1K
We have $$M= \sup f([a,b])$$. If we assume that there is no $$c \in [a,b]$$ with $$f(c)=M$$, then we have $$f(x) for all $$x \in [a,b]$$ . In the above proof this leads to $$f(x) \le M- \frac{1}{K}$$ for all $$x \in [a,b]$$. Hence
$$M = \sup f([a,b]) \le M- \frac{1}{K}$$, a contradiction.