If I and J are two ideals, I∪J is an ideal if and only if I⊂J or J⊂I. How can we prove the subset part? If $I$ and $J$ are two ideals, $I \cup J$ is an ideal if and only if $I \subset J$ or $J \subset I$. How can we prove the subset part?
What would the proof look like to prove that either $I$ is a subset of $J$ or vice versa?
 A: By the contrapositive, suppose that $I$ and $J$ are both ideals such that neither $J  \subset I$ nor $I \subset J$. Thus, there exist elements $i \in I \setminus J$ and $j \in J \setminus I$. Now, this implies that $i+j$ is not in any of the ideals: if it were $i+j \in I$, then we would have that $j = (-1)i + (i +j) \in I$, and likewise for $J$. Hence $i,j \in I \cup J$ but $i+j \not \in I \cup J$, which proves that $I \cup J$ is not an ideal.
A direct approach: suppose that the union is an ideal and that $I \not \subset J$, so that we can choose $i \in I \setminus J$. Now, for each $j \in J$, we know that $i+j \in I \cup J$ so either $i+j \in I$ or $i+j \in J$. It can't be that $i+j \in J$ because it would imply $i \in J$. Hence $i+j \in I$ and thus $j = (-1)i + (i+j) \in I$, which proves that $J \subset I$.
A: If
$I \subset J \tag 1$
then
$J \subset I \cup J \subset J, \tag 2$
whence
$I \cup J = J, \tag 3$
so $I \cup J$ is the ideal $J$; likewise, if
$J \subset I, \tag 4$
then
$I \subset I \cup J \subset I, \tag 5$
and $I \cup J = I$, and $I \cup J$ is the ideal $I$; so $I \cup J$ is an ideal provided one of (1), (4) holds.
Now suppose $I \cup J$ is an ideal but that
$I \not \subset J, \; J \not \subset I; \tag 6$
then
$\exists i \in I, \; i \notin J; \; \exists j \in J, \; j \notin I; \tag 7$
we note that
$i, j \in I \cup J, \tag 8$
whence, since $I \cup J$ is an ideal,
$i + j \subset I \cup J, \tag 9$
which yields
$i + j \in I, \tag{10}$
or 
$i + j \in J; \tag{11}$
in the former case,
$j = (i + j) - i \in I, \tag{12}$
whilst in the latter,
$i = (i + j) - j \in J; \tag{13}$
but either of these conclusions contradicts (7), whence we find that $I \cup J$ cannot be an ideal in $R$ unless at least one of
$I \subset J, \; J \subset I \tag{14}$
holds.
Note Added in Edit, Tuesday 24 March 2020 12:33 PM PST:  This result apparently holds if $I$ and $J$ are left ideals, right ideals, or two sided ideals, or even if they are ideals of different types.  Indeed, it appears this is really a statement about subgroups of $\langle R, +, 0 \rangle$, the abelian group of elements of $R$. End of Note.
A: Suppose otherwise, i.e. $I\cup J$ is an ideal and $I \not\subset J$ and $J \not\subset I$. Let $a \in I \setminus J$ and $b\in J\setminus I$. Consider $c = a + b$. Then $c \in I \cup J$. If $c \in I$, then $b = c - a \in I$ a contradiction. On the other hand, if $c \in J$, then $a = c - b \in J$ a contradiction.
