TITLE: Polynomials (or analytic functions) vanishing on a real algebraic set
QUESTION [5 upvotes]: I have seen the following result stated several times in the literature, without proof:

Let $\mathbb{K}$ be $\mathbb{R}$ or $\mathbb{C}$, and assume $P\in\mathbb{K}[X_{1},\ldots,X_{n}]$ is an irreducible polynomial of $n$ variables, and let
$$ V = \{z\in\mathbb{C}^{n},~P(z)=0\},\quad I(V)=\{Q\in\mathbb{C}[X_{1},\ldots,X_{n}],~Q=0\text{ on }V\}.$$
Assume that $V$ contains a real point $a\in\mathbb{R}^{n}$ which is regular, that is
$$\text{dim }V=n-\text{rank }J_{a}(V),$$
where $J_{a}(V)$ denotes the Jacobian of a family of generators of $I(V)$, evaluated at $a$.
Then the set $V_{\mathbb{R}}=V\cap\mathbb{R}^{n}$ of real points of $V$ is Zariski dense in $V$, or equivalently any polynomial that vanishes on $V_{\mathbb{R}}$ must vanish on $V$.

I am also interested by the analytic version of this result (if true) where $V$ is still the zero set of a polynomial $P$ but $I(V)$ is the ideal of analytic functions vanishing on $V$, and the vanishing of an analytic function $f$ on $V_{\mathbb{R}}$ implies the vanishing of $f$ on $V$.
Could someone provide a proof for the algebraic or analytic case?
Many thanks in advance.

REPLY [6 votes]: The more general statement that is true is the following:

Let $X \subset \mathbb{C}^d$ be an irreducible affine variety defined by real polynomials. If $X$ has a smooth real point, then $X(\mathbb{R})$ is Zariski dense in $X.$

A sketch of the proof and some good examples are given here: Real Algebraic Geometry for Geometric Constraints by Frank Sottile (page 8). 
The main fact used is, under the assumption there is a real smooth point, the smooth points of the $\mathbb{R}$-locus is a real manifold of the same dimension.
The main reference is: Real Algebraic Geometry by Bochnak, Coste, Roy.
Fun facts: 

If you ask instead for the density of $\overline{\mathbb{Q}}$-points then that is true more generally for any $d$–dimensional affine variety $V$ defined over $\mathbb{Q}$ by Noether Normalization.
If you remove the assumption that there is a smooth point, then the statement is false as $V(x^2+y^2)$ has only one $\mathbb{R}$-point which is not smooth, namely $(0,0)$, and $x^2+y^2$ is irreducible over $\mathbb{R}$ and the $\mathbb{C}$-locus is dimension 1 (so the $\mathbb{R}$-locus not Zariski dense).