# Is this a sufficient condition for a subset of a topological space to be closed?

Let $X$ be a topological space, and let $\{U_i\}$ be an open cover. If $Y$ is subset of $X$ such that $Y\cap U_i$ is closed in $U_i$ (for each $i$), does this imply that $Y$ is closed in $X$?

-
possible duplicate of Is whether a set is closed or not a local property? –  Hagen von Eitzen Nov 12 '12 at 16:17

Note that $Y^c\cap U_i = U_i \setminus Y \cap U_i$ is open in $U_i$. Therefore it is open in $X$. Now, since $\bigcup U_i = X$, $Y^c = \bigcup (Y^c \cap U_i)$ is open in $X$. Hence $Y$ is closed.