Let be $\left(X,\Vert \cdot \Vert \right)$ a normed space and $\emptyset \neq M\subseteq X$.
Consider the function: $dist(\cdot,M):X\to \mathbb{R}$, where $dist(x,M)=\inf\limits_{y\in M}\Vert x-y\Vert$.
If $M$ is compact show that there exists a $y\in M$ for every $x \in X$ such that: $dist(x,M) = \Vert x-y\Vert$.
My approach:
Let $x\in X$ be arbitrary but fixed. We know that for every $\epsilon>0$ there exists a $y\in M$ with: $dist(x,M)+\epsilon>\Vert x-y\Vert$ and that $dist(x,M)$ is a lower bound for $\Vert x-y\Vert$ with $y\in M$. This allows me to construct a sequence $\left(y_n\right)_{n\in\mathbb{N}}$. Every sequence on a compact set contains a convergent subsequence. Let be $\left(y_{n_j}\right)_{j\in\mathbb{N}}$ a convergent subsequence. I define $\epsilon:=\frac{1}{j}$ and get: $0\leq\Vert x- y_{n_j}\Vert -dist(x,M) <\frac{1}{j}$. (I can omit the absolute value bars as $dist(x,M)$ is a lower boound and hence always smaller). Further, as $M$ is compact, the limit of each convergent sequence lies within $M$, so $\lim\limits_{j\to\infty} y_{n_j}=y \in M$. Applying the squeeze theorem, we can finally conclude $dist(x,M)= \Vert x-y\Vert$.
Is this o.k. or are there any gaps/flaws?
Any thoughts are welcome :)
Your proof looks both correct and reasonably well-presented to me. (If anything, I'd point out that instead of "lower boundary" people usually say "lower bound".)
Let me sketch an alternative proof I personally find simpler: For a fixed $x\in X$, consider the continuous function $f\colon M\to \mathbb{R}$ given by $f(y)= \|x-y\|$, which by compactness of $M$ must attain its minimum at some $y\in M$. This $y$ then fulfils $\|x-y\|=\operatorname{dist}(x,M)$ as required.