If $V$ is an algebraic set of $K^n$, show that $V$ is irreducible exactly then when $I(V )$ is a prime ideal of $K[X_1, X_2, \dots, X_n]$ .
Let $V$ be irreducible. We suppose that $I(V)$ is not a prime ideal of $K[X_1, X_2, \dots, X_n]$.
That means that there are polynomials $f,g \in K[X_1, X_2, \dots, X_n]$ such that $f \notin I(V), g \notin I(V)$ but $f \cdot g \in I(V)$.
We set: $$V_1=\{ x \in V | f(x)=0\}$$
$$V_2=\{ x \in V | g(x)=0\}$$
$V_1, V_2$ are non-empty and proper subsets of $V$ with $V=V_1 \cup V_2$.
Indeed:
$$I(V)=\{ h \in K[X_1, X_2, \dots, X_n]| h(x)=0 \}$$
$f \cdot g \in I(V) \Rightarrow f \cdot g(x)=0 \forall x \in V$
$f \notin I(V), g \notin I(V)$ means that there are $a,b \in V$ such that $f(a) \neq 0, g(b) \neq 0$.
But since $(fg)(a)=0 \Rightarrow g(a)=0 \Rightarrow a \in V_2$
Also since $(fg)(b)=0 \Rightarrow f(b)=0 \Rightarrow b \in V_1$
From the definition of $V_1$ and $V_2$ we have that $V_1 \subseteq V, V_2 \subseteq V$.
But $a \in V \wedge a \notin V_1 \Rightarrow V_1 \subset V$.
Also $b \in V$ but $b \notin V_2$, and thus $V_2 \subset V$.
We will show that $V=V_1 \cup V_2$.
Let $x \in V$. That means that $h(x)=0 \forall h \in K[x_1, x_2, \dots, x_n]$.
$fg(x)=0 \Rightarrow f(x)=0 \lor g(x)=0 \Rightarrow x \in V_1 \lor x \in V_2$
So $V \subseteq V_1 \cup V_2 $.
Since $V_1, V_2 \subset V$ we have that $V_1 \cup V_2 \subseteq V$.
So the equality holds.
Do we also have to show that $V_1, V_2$ are closed subsets of $V$ ? If so how could we do this?
Furthermore do we also have to prove that if $I(V)$ is a prime ideal that $V$ is irreducible?
Let $I(V)$ be a prime ideal. Assume that $V=V_1 \cup V_2$ for some closed subsets $V_1, V_2.$ Now $I(V)=I(V_1 \cup V_2)=I(V_1) \cap I(V_2).$ So either $I(V) = I(V_1)$ or $I(V)=I(V_2),$ i.e. either $V=V_1$ or $V=V_2.$
Now assume that $V$ is irreducible. Suppose $I(V)$ is not a prime ideal. Choose $f, g \in k[x_1, x_2, \cdots , x_n]$ such that $fg \in I(V).$ Then $ V \subseteq Z(fg)=Z(f) \cup Z(g).$ Thus $V= (V \cap Z(f)) \cup (V \cap Z(g)).$ Since $V$ is irreducible, either $V = V \cap Z(f)$ or $V = V \cap Z(g)$ i.e. either $V \subseteq Z(f)$ or $V \subseteq Z(g).$ In other words, either $f \in I(V)$ or $g \in I(V).$