If $V$ is an algebraic set of $K^n$, I want to show that $V$ is irreducible exactly when $I(V)$ is a prime ideal.
That's what I have tried:
We suppose that $V$ is not irreducible. Then, it can be written in the form $V=V_1 \cup V_2$, where $V_1,V_2$ algebraic sets of $K^n$, $V_1 \subseteq V, V_2 \subset V$.
$$I(V)=I(V_1 \cup V_2)=I(V_1) \cap I(V_2)$$
How can I continue?
Here is an equivalent definition of a prime ideal, which might help here:
Let $R$ be a (commutative) ring and let $P\le R$ be an ideal. $P$ is a prime ideal if and only if the following holds - for any two ideals $I,J\le R$, if $P \supseteq IJ$ then $P \supseteq I$ or $P \supseteq J$ (If you are not familiar with it, try Proving it, it's a nice exercise in basics of ring theory)
Edit: I'll give a slightly different proof to avoid using $I(V_1 \cup V_2)=I(V_1)I(V_2)$. I'll denote by $V(S)$ ,for a subset $S\subseteq K[x_1,...,x_n]$, the subset of $K^n$ on which all of the elements of $S$ vanish simultaneously.
For the direction you started proving, we write $V=V(J)$ when $J$ is radical, and similarly $V_1=V(J_1), V_2=V(J_2)$. This is useful as for any ideal S, $I(V(S))=\sqrt{S}$ (Nullstellensatz). The strict inclusion $V_i \subset V$ implies that $J_i\supsetneq J$, but: $$ V(J_1)\cup V(J_2)=V(J_1 J_2) \tag{1} $$
This is easier to understand geometrically - if all elements of J_1 vanish somewhere, the anything times them will also vanish there (and same goes for $J_2$). On the contrary, if $p\in J_1$ and $q\in J_2$ do not vanish at some point, so does $pq\in J_1 J_2$.
(1) now gives $V(J_1 J_2)=V(J)$. Taking $I$ of both sides gives: $$ I(V)=J=\sqrt{J}=I(V(J))=I(V(J_1 J_2))=\sqrt{J_1 J_2}\supseteq J_1 J_2 $$ To conclude, we found two ideals $J_1,J_2$, both not inside $J=I(V)$, whose product is inside $I(V)$. Thus $I(V)$ is not prime
The other direction is pretty much the same thing reversed - If $I(V)$ is not prime, we find some polynomials $p,q\in K[x_1,...,x_n]$ which do not lie in $I(V)$ but their product does lie there. We define: $$ V_1=\{y\in V:\ p(y)=0\}, V_2=\{y\in V: q(y)=0\} $$
Then $V_1,V_2$ are algebraic subsets of $V$ which are not everything (because $p,q\notin I(V)$, i.e. $p$ and $q$ both do not vanish on all of $V$), but their union is all of $V$.