I want to show the following:
Let $X$ be a metric space. Show that every compact subset $Y$ of $X$ is closed.
The idea is to show that $X\setminus Y$ is open. So, for any $x \in X\setminus Y$, I cover up the compact set $Y$ with balls defined as $B_{\epsilon}(y_0):=\{y\in Y \mid d(y,y_0)<\frac{d(x,y_0)}{2}\}$. Then $\bigcup_{i\in I}B_{\epsilon}(y_0^i)=Y$. Due the compactness of $Y$ there exists finitely many balls such that: $\bigcup_{i = 1}^n B_{\epsilon}(y_0^i)$. Now it is clear that $B_{\epsilon}(x)\subseteq X\setminus Y$.
Is this correct? And I don't like the style of the notations. Maybe someone can give me some advice?
Well, the notation isn't formally correct. It's ok to take $B_ε(y_0) := \{y ∈ Y \mid d(y, y_0) < \frac{d(x, y_0)}{2} \}$. But then $ε$ stands for nothing and is just part of the name so it doesn't make sense when you take the final $ε$ in the last step. On the other hand the definition corresponds to the definition of open ball with radius of $\frac{d(x, y_0)}{2}$ so probably for each $y ∈ Y$ you choose radius $ε_y := \frac{d(x, y)}{2}$ and then take open ball $B_{ε_y}(y)$.
Also $I$ doesn't cover anything, it is just index set, which in our case has no well-defined meaning. What is $y_0^i$? You can actually index by the points of $Y$ so your cover is $\{B_{ε_y}(y): y ∈ Y\}$. Then there is finite $F ⊆ Y$ such that $\{B_{ε_y}(y): y ∈ F\}$ still covers $Y$. Then we take $ε := \min\{ε_y: y ∈ F\}$ and now $B_ε(x) ⊆ X \setminus Y$.