# Counter-example that $I\cup J$ in a ring $R$ may not be an ideal

I've been doing some reading about ideals and here is another question (to which I couldn't yet find or construct a counterexample).

Let $I, J$ be ideals in a ring $R$. Then $I\cup J$ is contained in $I+J$ but it may not be an ideal since it may not be closed under addition.

Can you give me a counterexample of ideals $I$ and $J$ in $R$ so that $I\cup J$ is not an ideal?

Note: $I\cup J\subseteq I+J$ since we can write $i \in I$ as $i+0\in I+J$ and similarly, we can write $j\in J$ as $0+j\subseteq I+ J$.

 After reading so many great responses from this post, would this be a counter-example? Take $I=\left< 2\right>$ and $J=\left< x\right>$ in $R=\mathbb{Z}[x]$. Then $2\in I, x\in J$, but $2+x$ is not in either $I$ or $J$? After thinking about this counter-example, I don't think this is a good one: it only shows that $I\cup J$ is properly contained in $I+J$.

-
Is it ok to tag this commutative-algebra? – Rudy the Reindeer Jul 4 '12 at 19:48
Yes, please feel free to edit as needed. =) – math-visitor Jul 4 '12 at 19:49

Let $R = \mathbb Z$ and $I = 2 \mathbb Z$ and $J = 5 \mathbb Z$. Then $2,5 \in I \cup J$ but $2 + 5 = 7 \notin I \cup J$.

-
And to answer the second part of your question: Yes, $2+x \notin I \cup J$. – Rudy the Reindeer Jul 4 '12 at 19:44
Thank you Matt! Everyone on math.SE are so fast! – math-visitor Jul 4 '12 at 19:45
To add some details: $J$ looks like all polynomials with constant part zero. But $p(x) = x + 2$ has constant part $2$. Hence it's not in $J$. On the other hand, $I$ looks like all polynomials with even coefficients. But $p(x)$ has coefficient $1$ for $x$. – Rudy the Reindeer Jul 4 '12 at 19:47
@math-visitor You're welcome : ) We're all glad when we can help. – Rudy the Reindeer Jul 4 '12 at 19:47

In fact, if $I$ and $J$ are two ideals, $I\cup J$ is an ideal if and only if $I\subset J$ or $J\subset I$. Indeed, if neither of these two assertions is true, take $x\in J\setminus I$ and $y\in I\setminus J$. Then $x+y$ cannot be either in $I$ or in $J$.

So, you can pick a counter-example taking two ideals where one is not contained in the other.

-
Thanks Davide. This is a great strategy! – math-visitor Jul 4 '12 at 19:53