[proofplan]
Closure in the Zariski topology of $\mathbb{P}^n_k$ is computed by the homogeneous ideal of polynomials vanishing on the set, so it suffices to show that any homogeneous polynomial $f$ vanishing on $V \setminus W$ also vanishes on all of $V$, i.e. $f \in I(V)^h$ (the homogeneous ideal of $V$). The substantive idea is to multiply $f$ by an auxiliary homogeneous polynomial $g$ that vanishes on $W$ but not on $V$ — produced by the projective Nullstellensatz applied to the strict containment $W \subsetneq V$. The product $fg$ vanishes on all of $V$, hence lies in $I(V)^h$. Primality of $I(V)^h$ (equivalent to irreducibility of $V$) plus $g \notin I(V)^h$ then forces $f \in I(V)^h$.
[/proofplan]
[step:Reduce density to membership in $I(V)^h$]
The closure of $V \setminus W$ in $\mathbb{P}^n_k$ is, by the projective Galois correspondence,
\begin{align*}
\overline{V \setminus W} = V(I(V \setminus W)^h),
\end{align*}
where $I(V \setminus W)^h$ denotes the homogeneous ideal of polynomials vanishing on $V \setminus W$. Since $V \setminus W \subset V$, we have $I(V)^h \subset I(V \setminus W)^h$, and applying the order-reversing operator $V(\cdot)$ gives
\begin{align*}
V(I(V \setminus W)^h) \subset V(I(V)^h) = V,
\end{align*}
where the last equality uses that $V$ is closed (hence $V(I(V)^h) = V$). Therefore $\overline{V \setminus W} \subset V$ holds automatically. To prove $\overline{V \setminus W} = V$ it suffices to show the reverse inclusion $V \subset \overline{V \setminus W}$, equivalently $I(V \setminus W)^h \subset I(V)^h$, i.e.: every homogeneous polynomial $f$ vanishing on $V \setminus W$ also vanishes on $V$.
[/step]
[step:Produce a homogeneous polynomial $g$ vanishing on $W$ but not on $V$]
Since $W \subsetneq V$ is a proper closed subset, the [Projective Nullstellensatz](/theorems/2132) applied to the strict inclusion gives the strict reverse inclusion of homogeneous ideals
\begin{align*}
I(V)^h \subsetneq I(W)^h.
\end{align*}
Pick any homogeneous element
\begin{align*}
g \in I(W)^h \setminus I(V)^h.
\end{align*}
By construction:
\begin{itemize}
\item $g$ is homogeneous (we may take $g$ to be a homogeneous component, since $I(W)^h$ is by definition spanned by homogeneous polynomials and the difference of two homogeneous ideals contains some homogeneous element whenever it is nonempty);
\item $g$ vanishes on $W$ (since $g \in I(W)^h$);
\item $g$ does not vanish identically on $V$ (since $g \notin I(V)^h$): there exists $[p] \in V$ with $g(p) \neq 0$.
\end{itemize}
[/step]
[step:Show that $fg$ vanishes on all of $V$]
Let $f$ be any homogeneous polynomial vanishing on $V \setminus W$. We show that the product $fg$ vanishes on every point of $V$, splitting into cases on whether the point lies in $W$.
Take $[p] \in V$. We consider two cases:
\begin{itemize}
\item \textbf{Case 1: $[p] \in W$.} Then $g(p) = 0$ (since $g \in I(W)^h$), so $(fg)(p) = f(p) g(p) = f(p) \cdot 0 = 0$.
\item \textbf{Case 2: $[p] \in V \setminus W$.} Then $f(p) = 0$ by the assumption on $f$, so $(fg)(p) = f(p) g(p) = 0 \cdot g(p) = 0$.
\end{itemize}
In either case $(fg)(p) = 0$. As $[p] \in V$ was arbitrary, $fg$ vanishes identically on $V$, i.e.
\begin{align*}
fg \in I(V)^h.
\end{align*}
The product $fg$ is homogeneous because $f$ and $g$ are (its degree is $\deg f + \deg g$), so this membership is consistent with $I(V)^h$ being a homogeneous ideal.
[guided]
We have to show: every homogeneous $f$ vanishing on $V \setminus W$ already vanishes on $V$. The strategy is "multiply by a separator". A separator is a polynomial that distinguishes the missing piece $W$ from the rest of $V$.
\textbf{Why multiply at all?} Directly, $f$ might fail to vanish at points of $W$, so we cannot immediately conclude $f \in I(V)^h$. The trick is to manufacture a related polynomial that does vanish on all of $V$ — and the natural way is to combine $f$ (which kills $V \setminus W$) with a polynomial $g$ that kills $W$. Their product then kills both halves.
\textbf{Constructing the separator.} How do we know such a $g$ exists? Because $W$ is a strictly smaller closed subset of $V$. The [Projective Nullstellensatz](/theorems/2132) translates the geometric containment $W \subsetneq V$ into the algebraic containment $I(V)^h \subsetneq I(W)^h$ — the homogeneous ideal of $W$ properly contains the homogeneous ideal of $V$. Strict containment means there is some homogeneous polynomial $g$ in the bigger ideal but not the smaller one. This $g$ vanishes on $W$ but is not identically zero on $V$.
\textbf{Verifying $fg$ vanishes on $V$.} We split a point $[p] \in V$ into two cases. Either $[p] \in W$ — then $g(p) = 0$ kills the product — or $[p] \in V \setminus W$ — then $f(p) = 0$ kills the product. Either way $(fg)(p) = 0$. Geometrically, $f$ kills the open piece, $g$ kills the closed missing piece; their product kills everything.
\textbf{Why homogeneity matters.} We are working in projective space, where polynomials are not honest functions on points; only homogeneous polynomials have well-defined vanishing loci. The product of two homogeneous polynomials of degrees $d_1$ and $d_2$ is homogeneous of degree $d_1 + d_2$, so $fg$ is the right kind of object to lie in the homogeneous ideal $I(V)^h$.
[/guided]
[/step]
[step:Use primality of $I(V)^h$ to extract $f \in I(V)^h$]
Since $V$ is irreducible and closed, the [Projective Nullstellensatz](/theorems/2132) (irreducibility correspondence) gives that the homogeneous ideal $I(V)^h$ is a prime ideal of $k[X_0, \ldots, X_n]$. By Step 3, $fg \in I(V)^h$, and by Step 2, $g \notin I(V)^h$. Primality of $I(V)^h$ then forces
\begin{align*}
f \in I(V)^h.
\end{align*}
[guided]
We have $fg \in I(V)^h$ and $g \notin I(V)^h$. The conclusion $f \in I(V)^h$ is the defining property of a prime ideal: in a prime ideal $\mathfrak{p}$, $ab \in \mathfrak{p}$ implies $a \in \mathfrak{p}$ or $b \in \mathfrak{p}$.
\textbf{Why is $I(V)^h$ prime?} This is exactly the algebraic translation of irreducibility of $V$. Concretely: if $I(V)^h$ were not prime, there would exist homogeneous $a, b \notin I(V)^h$ with $ab \in I(V)^h$. Then
\begin{align*}
V = (V \cap V(a)) \cup (V \cap V(b)),
\end{align*}
with both pieces proper closed subsets — contradicting irreducibility. Conversely, primality of $I(V)^h$ implies irreducibility of $V = V(I(V)^h)$. This is the content of the irreducibility statement in the [Projective Nullstellensatz](/theorems/2132).
\textbf{Cancelling $g$.} Since $g \notin I(V)^h$, we are in the "$b \notin \mathfrak{p}$" branch of primality, forcing $f \in I(V)^h$. This is the algebraic analogue of dividing through by $g$ — we cannot divide polynomials, but the ideal-theoretic version of cancellation is precisely the prime ideal property.
[/guided]
[/step]
[step:Conclude that $V \setminus W$ is dense in $V$]
We started with an arbitrary homogeneous $f$ vanishing on $V \setminus W$ and showed $f \in I(V)^h$. By Step 1, this proves the inclusion $I(V \setminus W)^h \subset I(V)^h$ (restricted to homogeneous elements, which is enough since the homogeneous ideal is determined by its homogeneous elements). Equivalently,
\begin{align*}
V \subset V(I(V \setminus W)^h) = \overline{V \setminus W},
\end{align*}
giving the missing inclusion. Combined with the automatic $\overline{V \setminus W} \subset V$ from Step 1, we obtain $\overline{V \setminus W} = V$, i.e. $V \setminus W$ is Zariski dense in $V$.
[/step]