Weierstrass Extreme Value Theorem

From Efe Ok: (no proof?)
IfX is a compact metric space and f \in \reals^{X} is a continuous function, then there exists x, y \in X with f(x) = \sup f(X) and f(y) = \inf f(X).
From micro lecture notes: (also no proof)
Let (X, d_{x}) and (Y, d_{Y}) be two metric spaces. If f: X \to Y is a continuous function and S a compact set in (X, d_{X}), then f attains a maximum and a minimum in S: \arg \max_{x \in S} f(x) = \varnothing and \arg \min_{x \in S} f(x) = \varnothing.