Let $K$ be algebraically closed and $X\subset K^n$ be an algebraic set. I'm trying to prove $X$ is irreducible, aka $X\neq X_1\cup X_2$ for $X_1,X_2\subsetneq X$ if and only if the Algebra $K[X]=K[x_1,\dots,x_2]/I(X)$ has no zero divisors. $I$ is the vanishing ideal of $X$.
What I did was, suppose that $X$ is reducible and write it as $X=X_1\cup X_2$ then pick polynomials $f,g$ with $f$ vanishes on $X_1$ but not $X_2$ $g$ vanishes on $X_2$ and not $X$ with the product $fg$ vanishing on $X$. But this only gives me that $I(X)$ is prime. Since $K[x_1,\dots,x_2]$ is a commutative ring and for commutative rings and an ideal $I$ $$R/I \quad \text{has no zero divisors} \iff I \quad \text{prime}$$ and per contrapositve this proves the first implication.
Is there another way of proving this without using prime ideals?
As stated by 57Jimmy, we already have zero divisors $$[f+I(X)]\cdot [g+I(X)]=fg+I(X)=I(X)$$ since $fg$ vanishes on $X$. So $K[X]$ is not an integral domain. I didn't want to leave the question unanswered