Ideal in $C(X)$

Note that we somehow need to use that $J$ is a closed ideal in $C(X)$.

Let $V$ be open with $Y\subset V$. For any $t\in X\setminus V$, there exists $g_t\in J$ with $g_t(t)\ne0$. Let $h_t=|g_t|^2=\overline{g_t}\,g_t\in J$; then $h_t(t)>0$ on some open set $V_t$. As $X\setminus V$ is compact, there exists a finite cover $V_{t_1},\ldots,V_{t_m}$; so $g_1=\sum_{j=1}^m h_{t_j}\in J$, and $g_1(t)>0$ for all $t\in X\setminus V$. As $X\setminus V$ is compact, there exists $k>0$ with $g_1(t)>k$ for all $t\in X\setminus V$. So the function $g_2:t\mapsto \frac1{g_1(t)}$ is continuous on $X\setminus V$.

Now we extend $g_2$ to all of $X$, using Tietze, and still call it $g_2$. Let $g_V=g_1g_2\in J$ (since $g_1\in J$). The function $g_V$ has the property that $g=1$ on $X\setminus V$, $g_V=0$ on $Y$, and $|g|\leq1$.

Now let $f\in J_Y$. Fix $\varepsilon>0$. We have $f(y)=0$ for each $y\in Y$, so there exist open neighbourhoods $V_y$ such that $|f|<\varepsilon$ on $V_y$. As $Y$ is compact (closed subset of a compact), it is covered by some finite choice of the $V_y$; the union of these furnishes an open $V$ with $|f|<\varepsilon$ on $V$. As $J$ is an ideal, $fg_V\in J$.

For any $t\in X\setminus V$, $|f(t)-f(t)g_V(t)|=0$ (as $g_V(t)=1$). For $t\in V$, $$|f(t)-f(t)g_V(t)|<2|f(t)|<2\varepsilon$$ (as $|g_V|\leq1$ everywhere and $|f|<\varepsilon$). This shows that $$ \|f-fg_V\|<2\varepsilon. $$ As we can do this for any $\varepsilon>0$, we have shown that $f$ belongs to the closure of $J$, i.e. $f\in J$. So $J_Y\subset J$.

What we are doing here is an explicit example of the fact that a closed ideal of a C$^*$-algebra has a quasicentral approximate identity (i.e. an approximate unit that is approximately central for the whole algebra).