TITLE: When does locally irreducible imply irreducible?
QUESTION [8 upvotes]: The situation is this: I have a homogeneous ideal with many generators and variables, too many to simply ask isPrime I in Macaulay2. However, the ideal simplifies significantly when localizing in each variable (that is, setting one of the variables equal to one and substitute everywhere for lone variables). It turns out, when localized in each variable, the ideal $I_{(x_i)}$ is prime.
The question is, when can I conclude that the ideal itself is prime?
I cannot in general do this, because there are examples of rings with all localizations integral domains, but not the ring itself (take for example $\mathbb{Z}/(6)$ and localize in only two primes to get $\mathbb{Z}/(3)$ and $\mathbb{Z}/(2)$). In my case, the ideal is $I \subseteq k[x_1,\cdots, x_{20}]$, with $k$ an algebraically closed field of characteristic zero (or just $\mathbb{C}$).
Thinking about this, it seems that if there are "sufficiently many prime ideals", then it is true that locally prime implies prime, but I have not been able to prove this.

REPLY [9 votes]: Despite of the counterexamples, there are still some hopes. And if you are interested, here is a simple criterion.

Let $k$ be a field. Let $I$ be a homogeneous ideal of $k[x_0, \dots, x_n]$ such that $I_{(x_i)}$ is prime for all $i\le n$. Then $I$ is prime if and only if $I_{(x_ix_j)}$ is a proper ideal for all $i, j\le n$.
Geometrically, let $Z=V_+(I)$, then the last condition is $Z\cap D_+(x_ix_j)\ne\emptyset$ for all $i,j$.

Proof. As $Z$ is already reduced, we only have to care about the irreducibility of $Z$. If $Z$ is irreducible, then $Z\cap D_+(x_i)$ and $Z\cap D_+(x_j)$ are both non-empty (because $I_{(x_i)}$ is a proper ideal defining $Z\cap D_+(x_i)$) hence dense open subsets of $Z$, so their interseciton $Z\cap D_+(x_ix_j)\ne \emptyset$.
Conversely, suppose the above condition holds. Let $F$ be an irreducible component of $Z$. We can suppose $F\cap D_+(x_0)\ne \emptyset$. Then $Z\cap D_+(x_0)=F\cap D_+(x_0)$ because $Z\cap D_+(x_0)$ is irreducible. For any $i\le n$, by hypothesis $Z\cap D_+(x_0x_i)$ is a non-empty open subset of $Z\cap D_+(x_0)=F\cap D_+(x_0)$, so it is dense and contained in $F$. But it is also dense in $Z\cap D_+(x_i)$ for the same reason. Therefore $Z\cap D_+(x_i)\subseteq F$. This being true for all $i\le n$, we have $Z=F$ and $Z$ is irreducible.
Edit This is in fact a general result.

Let $X$ be a topological space and let $Z$ be a closed (or even an arbitrary) subset of $X$ such that there exists an open covering $\{ U_i\}_i$ of $X$ with $Z\cap U_i$ irreducible (in particular non-empty) for all $i$. Then $Z$ is irreducible if and only if $Z\cap U_i\cap U_j\ne\emptyset$ for all $i,j$.

The proof is the same as above.