Question: Let $f,g: X \rightarrow \mathbb{R}$ continous (over $X$, and $X$ is a metric space). If $\overline{Y}\subset X $, and $f(y)=g(y)$ for every $y\in Y $, prove that $\left.f\right|_\overline{Y}= \left.g\right|_\overline{Y}$.
Attempt:
Since $\overline{Y} \subset X$, it follows that $\left.f\right|_\overline{Y}$ and $\left.g\right|_\overline{Y}$ are continuous functions. Given $\epsilon>0$, let $a\in \overline{Y}$. Since $\overline{Y}=Y\cup Y'$, assume that $a \in Y'$.
$\left.f\right|_\overline{Y}$ and $\left.g\right|_\overline{Y}$ are continuous, so there exists $\delta_1,\delta_2>0$ such that for $x\in \overline{Y}$, $|x-a|<\delta_1$ and $|x-a|<\delta_2$ we have:
$|f(x)-f(a)|<\epsilon/2$ and $|g(x)-g(a)|<\epsilon/2$, respectively.
Since we are supposing that $a\in Y'$, the continuity of $\left.f\right|_\overline{Y}$ and $\left.g\right|_\overline{Y}$ also gives us that $\lim_{x \to a} f(x) = f(a)$ and $\lim_{x \to a} g(x) = g(a)$. Using the hyphothesis, we conclude that, in particular, $f(a)=g(a)$.
Hence, taking $\delta_0$=min$\{\delta_1,\delta_2\}$, $x \in \overline{Y}$ and $x\in(a-\delta_0,a+\delta_0)$ implies that :
$|f(x)-g(x)|\leq |f(x)-f(a)|+|f(a)-g(x)|<\epsilon/2+\epsilon/2=\epsilon.$
Since $\epsilon$ is arbitrary, it proves that $f(x)=g(x)$ for every $x\in \overline{Y}$.
Doing the same, supposing that $a\in Y$, we still get that $f(x)=g(x)$ for every $x\in \overline{Y}$.
In either case, we coclude that $\left.f\right|_\overline{Y}= \left.g\right|_\overline{Y}$.
Is it correct?