Let $X$ and $Y$ be subspaces of a vector space $V$. Show that $X\cup Y$ is a subspace if and only if $X\subset Y$ or $Y \subset X$ I'm currently learning linear algebra using textbook Linear Algebra Done Wrong, and I encountered this problem.

Let $X$ and $Y$ be subspaces of a vector space $V$. Show that $X\cup Y$ is a subspace if and only if $X\subset Y$ or $Y\subset X$

I don't really have any idea. I only figured out that 0 is in the set, so it is not empty. What else should I do? Thanks!!
 A: I'm assuming you're just working on the forward direction seeing as the reverse direction is trivial. Try proving by contrapositive: so suppose that $X\not\subseteq Y$ and $Y\not\subseteq X$, and we want to show $X\cup Y$ is not a subspace. Then you can take some $x\in X\setminus Y$ and some $y\in Y\setminus X$. Then clearly $x,y\in X\cup Y$, but what about $x+y$?
A: Nice result. Note that this problem has many applications in the solution of problems in linear algebra.

Theorem: Let $V$ a vector space and let  $X$ and $Y$ vectorial subspaces of $V$, so $$X\cup Y\quad \text{vector subspace of V} \iff X \subseteq Y \quad \text{or} \quad Y\subseteq X$$

Proof:

*

*$(\Rightarrow)$ Suppose that $X\cup Y$ is a vector subspace of $V$. Now, we can prove this by contradiction: Suppose that $X\not\subseteq Y$ and that $Y\not\subseteq X$. So, there exists $x \in X\setminus Y$ and $y\in Y\setminus X$. Then, $x+y\in X\cup Y$ because $X\cup Y$ is vector subspace of $V$. But, if $x+y\in X\cup Y$ so, $x+y \in X$ or $x+y\in Y$ by definition of union between sets. Now, suppose that $x+y\in Y$ so $x=(x+y)-y\in Y$ and this contradicts the choice of $X\in X\setminus Y$ and similarly if $x+y\in X$. So, in either case, we have reached a contradiction. Therefore, we can see that $X\subseteq Y$ or $Y\subseteq X$.


*$(\Leftarrow )$ Suppose that $X\subseteq Y$ or $Y\subseteq X$, so if $X\subseteq Y=Y$ and by hypothesis $Y$ is a vector subspace. Similarly, if $Y\subseteq X=X$ and by hypothesis we have that $X$ is a vector subspace of $V$.

An aplication of the theorem:

Example: Let $V=\mathbb{R}^{2}$ a vector space and let $$H=\left\{\begin{pmatrix} x \\ y \end{pmatrix}\in \mathbb{R}^{2}: x+y=0\right\}$$
and $$W=\left\{\begin{pmatrix} x \\ y \end{pmatrix}\in \mathbb{R}^{2}: x-y=0\right\}$$
it's clear that $H$ and $W$ is a vector space. But, what about $H\cup W$?

So,  that statement gives us an operational way of studying whether the union between two vector subspaces is or is not a vector subspace. For this, the theorem tells us we must know:

*

*A basis for $W$: $\beta_{W}$.

*A basis for $H$: $\beta_{H}$.

*The space $W$ with its respective conditional equations: $W=\left\{\begin{pmatrix} x \\ y \end{pmatrix}\in \mathbb{R}^{2}: x-y=0\right\}$.

*The space $H$ with its respective conditional equations: $H=\left\{\begin{pmatrix} x \\ y \end{pmatrix}\in \mathbb{R}^{2}: x+y=0\right\}$.

By calculating a basis for $W$ and a basis for $H$, we can see that $$\beta_{H}=\left\{ \begin{pmatrix} -1 \\ 1 \end{pmatrix}\right\} \quad \text{and} \quad \beta_{W}=\left\{ \begin{pmatrix} 1 \\ 1 \end{pmatrix}\right\} $$
basis for $H$ and $W$ respectively.
Now, using the theorem we have $$H\cup W \quad \text{s.v.e of V} \iff H\subseteq W \quad \text{or} \quad W \subseteq H$$

*

*$W\subseteq H \iff x\in W  \implies x\in H$. But, since that $$x=\begin{pmatrix}1 \\ 1 \end{pmatrix} \implies 1+(1)=2\not=0 \implies x\notin H$$

*$H\subseteq W \iff x\in H  \implies x\in W$. But, since that $$x=\begin{pmatrix}-1 \\ 1 \end{pmatrix} \implies -1-(1)=-2\not=0 \implies x\notin W$$
So, by the theorem we can conclude that $H\cup W$ is not vectorial subspace of $V=\mathbb{R}^{2}$.
A: Elaborating on @Dave 's answer with slightly different approach:
Suppose $X\cup Y$ is a subspace ,Let $x ,y \in X \cup Y$ such that $x \in X$ and $y \in Y$. Then $x + y \in X \cup Y$ since it is a subspace. Now if $x + y \in X$ and we have $-x \in X$ we must have $ y = x + y - x \in X$ and by which we can say that $ Y \subseteq X$. Otherwise if $x + y \in Y$ similarly we can conclude that $x \in Y$ by which we can say $X \subseteq Y$
