Union of two subgroups is not a subgroup unless they are comparable

Statement
Suppose $$G$$ is a group and $$H$$ and $$K$$ are subgroups of $$G$$. Then, the following are true:


 * 1) If $$L$$ is a subgroup of $$G$$ contained in $$H \cup K$$, then $$L$$ is contained either in $$H$$ or in $$K$$ (note: it may be contained in both).
 * 2) $$H \cup K$$ is a subgroup of $$G$$ if and only if either $$H$$ is contained in $$K$$ or $$K$$ is contained in $$H$$. (Note that if $$H$$ is contained in $$K$$, $$H \cup K = K$$, and if $$K$$ is contained in $$H$$, $$H \cup K = H$$).

Statement (slightly more general formulation)
Suppose $$G$$ is a group and $$H$$ and $$K$$ are subgroups of $$G$$. Then, the following are true:


 * 1) If $$L$$ is a subsemigroup of $$G$$ contained in $$H \cup K$$, then $$L$$ is contained either in $$H$$ or in $$K$$ (note: it may be contained in both).
 * 2) $$H \cup K$$ is a subsemigroup of $$G$$ if and only if either $$H$$ is contained in $$K$$ or $$K$$ is contained in $$H$$. (Note that if $$H$$ is contained in $$K$$, $$H \cup K = K$$, and if $$K$$ is contained in $$H$$, $$H \cup K = H$$).

Conditions for the existence of two incomparable subgroups
This result is of interest only when we have examples of a group $$G$$ and subgroups $$H$$ and $$K$$ of $$G$$ such that neither is contained in the other. Here are some examples:


 * In the group of integers $$\mathbb{Z}$$ under addition, the subgroups generated by any two integers, neither of which is a divisor of the other, are not comparable. This is because subgroup containment relation in the group of integers equals divisibility relation on generators. In particular, the subgroups of multiples of $$2$$ and multiples of $$3$$ have the property that neither is contained in the other.
 * In the direct product of two nontrivial groups, neither direct factor is contained in the other.

On the other hand, in a cyclic group of prime power order, any two subgroups are comparable. In fact, the only finite groups where any two subgroups are comparable are the trivial group and the cyclic groups of prime power order; the only infinite groups with the property are the quasicyclic groups.

A group where any two normal subgroups are comparable in termed a normal-comparable group: there are more examples of normal-comparable groups.

Tightness
It is possible for a union of three subgroups to be a subgroup; for instance, the Klein four-group (which is a direct product of the cyclic group of order two with itself) is a union of three of its subgroups. This is more generally related to the notion of partition of a group: a way of expressing a group as a union of proper subgroups any two of which intersect in the trivial subgroup.

In general, the elementary abelian group of order $$p^2$$ (defined as the direct product of two cyclic groups of order $$p$$) is a union of $$(p+1)$$ subgroups of order $$p$$, any two of which intersect trivially.

We do have a fairly tight restriction on how a group may be a union of three subgroups and somewhat weaker restrictions on other unions of finitely many subgroups:


 * Union of three subgroups is the whole group implies they have index two and form a flower arrangement
 * Union of n subgroups is the whole group iff the group admits one of finitely many groups as quotient
 * There is no group that is a union of seven proper subgroups but not a union of fewer proper subgroups
 * B. H. Neumann's lemma

Related facts in group theory

 * Directed union of subgroups is subgroup
 * Union of all conjugates is proper
 * Every group is a union of cyclic subgroups
 * Every group is a union of maximal among abelian subgroups
 * Cyclic iff not a union of proper subgroups

Analogues in other algebraic structures

 * A closely related result in commutative algebra is the prime avoidance lemma. The prime avoidance lemma states that a prime ideal is contained in a union of finitely many ideals, at most two of which are not prime, if and only if it is contained in one of them. In fact, the prime avoidance lemma for two ideals is precisely this statement, and the case of two ideals is the starting point for the argument.
 * Union of two subquasigroups is not a subquasigroup unless they are comparable: The analogous result holds for subquasigroups of a quasigroup. The key reason why the result holds is that it continues to be true that if two of the elements $$h, k, hk$$ are in the subquasigroup, so is the third.
 * Union of two incomparable submonoids may be a submonoid: For monoids, we can have two submonoids, neither of which is contained in the other, but their union is a submonoid. Note that it is still true that in most cases, the union is not a submonoid; however, the possibility cannot be ruled out. For instance, the union of the non-negative integers and the non-positive integers is the group of integers. Both the non-negative integers and the non-positive integers form submonoids, and neither is contained in the other.

Proof idea
The proof is based on the idea that if two of the elements $$h,k,hk$$ belong to a subgroup, so does the third. We carry out the proof by contradiction starting with $$h$$ and $$k$$ in different pieces, and show that whichever piece the product $$hk$$ lands in, we get a contradiction.

The key use of us working with groups arises in the step where we need to deduce that $$hk$$ lying in the same subgroup as one of the elements $$h$$ or $$k$$ implies the other element (respectively, $$k$$ or $$h$$) also lies in the same subgroup.

Proof details for (1)
Given: A group $$G$$, subgroups $$H,K,L$$ such that $$L \subseteq H \cup K$$

To prove: $$L$$ is contained in $$H$$ or $$L$$ is contained in $$K$$.

Proof: We use the technique of proof by contradiction. Below is the assumption from which we will try to derive a contradiction.

ASSUMPTION: $$L$$ is not contained in $$H$$ and $$L$$ is not contained in $$K$$.

NOTE FOR MORE GENERAL VERSION: Note that the only step in the proof above where we use that $$L$$ is a subgroup is Step (3), and that step only uses the fact that it is closed under multiplication. Hence, we can weaken the assumption to $$L$$ being only a subsemigroup of $$H \cup K$$, and still obtain the same conclusion.

Proof of (2): direction from union being a subgroup to comparability
Given: Group $$G$$, subgroups $$H,K$$ of $$G$$ such that $$H \cup K$$ is a subgroup of $$G$$.

To prove: Either $$H \subseteq K$$ or $$K \subseteq H$$.

Proof: We set $$L = H \cup K$$ in part (1) of the statement to get that $$H \cup K \subseteq H$$ or $$H \cup K \subseteq K$$. The former possibility is equivalent to $$K \subseteq H$$ and the latter possibility is equivalent to $$H \subseteq K$$. Thus, one of the two must hold.

NOTE FOR MORE GENERAL VERSION: We can weaken the assumption to "$$H \cup K$$ is a subsemigroup of $$G$$" and use the general version of part (1) to deduce the same conclusion.

Proof of (2): direction from comparability to union being a subgroup
Given: Group $$G$$, subgroups $$H,K$$ of $$G$$ such that $$H \subseteq K$$ or $$K \subseteq H$$

To prove: $$H \cup K$$ is a subgroup of $$G$$

Proof: If $$H \subseteq K$$, then $$H \cup K = K$$, which we know is a subgroup. If $$K \subseteq H$$, then $$H \cup K = H$$, which we know is a subgroup. Thus, in either case, $$H \cup K$$ is a subgroup.