Let $X$ be a subset of a metric space M. Prove that $X$ is a closed subset of M if and only if whenever x is a point in M such that $B_{\varepsilon} \cap X \ne \varnothing$ for every $\varepsilon > 0$ , then x $\in X$.
I've been working on this question for awhile. I understand that intuitively it makes sense. However, I can't quite figure out how to go about it. I have tried using the fact that $X'$ will be closed. And thus for all x' $\in X'$ there is an $\varepsilon$ > 0 such that $B_{\varepsilon} \subset X'$.
Conversely, I figure since x $\in X$ whenever the ball intersects with $X$, then it must be closed.
Am I on the right track here?