# A sufficient condition for a set to be dense.

A subset $A$ of a topological space $(X,\tau)$ is said to be dense if $\overline A=X$. Prove that if for each open set $O\neq\varnothing$ we have $A\cap O\neq\varnothing$, then $A$ is dense in $X$.

Could you please check if the following is right? Thanks!

A characterization of $\overline A$ is $$\overline A=\bigcap_{\alpha\in I} F_\alpha$$ where $\{F_\alpha\}_{\alpha\in I}$ is the family of all closed sets containing in $A$.

($C(Y)$ denote the complement of a set $Y$) Then $$C(\overline A)=C\left(\bigcap_{\alpha\in I} F_\alpha\right)=\bigcup_{\alpha\in I}C(F_\alpha)$$ where $O_\alpha:=C(F_\alpha)$ is open, for all $\alpha\in I$.

Since $A\subset F_\alpha$ for all $\alpha\in I$, we have $O_\alpha\subset C(A)$, and since $O_\alpha(\neq\varnothing)$ is open, by hypothesis $O_\alpha\cap A\neq\varnothing$. But this is impossible, so $O_\alpha=\varnothing$ for each $\alpha$, and thus $$C(\overline A)=\bigcup_{\alpha\in I}\varnothing =\varnothing$$

This leads to $\overline A=C(\varnothing)=X$.

Suppose that $A$ is not dense, that is, there is a closed set $F\subsetneq X$ such that $A\subset F$; then $O=C(F)$ is a nonepty open set disjoint with $A$.
$A$ is dense in $X$ if and only the complement of $A$ in $X$ has empty interior (as you realized, this just comes down to the complement of an intersection being the union of the complements).
The complement of $A$ in $X$ has empty interior if and only if there is no non-empty open set of $X$ contained entirely in the complement of $A$.
In other words, $A$ is dense in $X$ if and only if every open subset of $X$ meets $A$.