Let $X$ be some affine variety. I am trying to understand why if $I(X)$ is prime, then $X$ is irreducible. In a proof here, the author states:
Let $I(X)$ be a prime ideal, and suppose that $X=X_1\cup X_2$. Then $I(X)=I(X_1)\cap I(X_2)$. As $I(X)$ is prime, we may assume $I(X)=I(X_1)$, so $X=X_1$.
My question is about this last sentence: "As $I(X)$ is prime, we may assume $I(X)=I(X_1)\dots$" What about the primeness of $I(X)$ implies this?
For context, the reference the author provided for the last statement was
If $X_1\subset X_2\subset\mathbb{A}^n$, then $I(X_1)\supset I(X_2)$.