Let $P$ and $Q$ be prime ideals of a ring $R$ such that every element of $R\setminus (P\cup Q)$ is a unit. Prove that either $P$ or $Q$ is maximal. 
Let $R$ be a commutative ring with a unit. Let $P$ and $Q$ be prime ideals of $R$ such that every element of $R\setminus( P\cup Q)$ is a unit. We want to show that either $P$ or $Q$ is maximal.

I am not really sure what to try here. I can see that if $a$ is an element of a maximal ideal which contains $P$, but $a\notin P$, then $a\in Q$, and vice versa, but I am not sure how that helps me. I have mostly tried to come up with contradictions by supposing that neither $P$ nor $Q$ is maximal, then using things like $R/P$ and $R/Q$ are both integral domains with noninvertible elements, but I haven't had any luck. Any hints on how to proceed would be appreciated (for reference, I haven't taken a full commutative algebra course yet).
 A: By Krull's theorem, there exists $M$ a maximal ideal of $R$. Since $M$ is proper and hence no element of $M$ is a unit, we must have $M\subseteq P\cup Q$. Now, suppose for contradiction that $M\nsubseteq P$ and $M\nsubseteq Q$. Then there is some $m_p\in M\setminus P$ and $m_q\in M\setminus Q$, and we have $m:=m_p+m_q\in M$. Since $M\subseteq P\cup Q$, this means $m\in P\cup Q$, and so either $m\in P$ or $m\in Q$; without loss of generality suppose $m\in P$. Then, since $m_q\in M\subseteq P\cup Q$, and $m_q\notin Q$, we must have $m_q\in P$. But this means that $$m_p=m-m_q\in P,$$ a contradiction. Thus we must have $M\subseteq P$ or $M\subseteq Q$, and so – by maximality of $M$, and since $P$ and $Q$ are prime and hence proper – either $M=P$ or $M=Q$, as desired.
You do not need $P$ and $Q$ to be prime here, just proper, and the argument above shows a more general result: if $R$ is any ring, and $I$, $J_1$, and $J_2$ are any ideals of $R$ with $I\subseteq J_1\cup J_2$, then either $I\subseteq J_1$ or $I\subseteq J_2$. We can extend this result even further by reintroducing the primality hypothesis; if $P_1,\dots,P_n$ are prime ideals of $R$, and $I\subseteq P_1\cup\dots\cup P_n$, then there is some $i$ such that $I\subseteq P_i$. Exercise: try to prove this by induction! (Note, however, that the primality hypothesis really is necessary. For instance, $$(\overline{x},\overline{y})=(\overline{x})\cup (\overline{x+y})\cup (\overline{y})$$ in $\mathbb{F}_2[x,y]\big/(x^2,xy,y^2)$, but $(\overline{x},\overline{y})$ is not contained in any of the ideals on the right.)
A: Firsly I supposed that the ideals are nontrivial. Let $P' \supset P$ and $Q' \supset Q$ be ideals. Obviously, if $P'$ or $Q'$ contains an element in $R \setminus P \cup Q$, then one of them must be $R$. Assume the other case, which is $P' \subset P \cup Q$ and $Q' \subset P \cup Q$. $P'$ contains $q \in Q \setminus P$ and $Q'$ contains $p \in P \setminus Q$. Note that $P'$ and $Q'$ contain both of $p$ and $q$, so their all combinations. Look at the element $p-q$. This is not element of $P$ and $Q$, by using the fact that ideals are additive subgroups. So $p-q \notin P \cup Q$, implies that $p-q$ is unit. Both of $P'$ and $Q'$ become $R$. This shows $P$ and $Q$ are maximals. I wonder that I did not use being prime.
