# How do I find the intersection of two vector spaces?

What is the general method to find the basis of the intersection of two vector spaces?

Example: $$U= <(1,2,0,0),(0,-1,1,0)>; V= <(1,0,0,-1),(0,1,0,0),(0,0,1,0)>$$

We have that: $$\dim \ U + \dim V = \dim(U+V) + \dim(U \cap V).$$ The first step is to find $\dim(U\cap V)$. In your example, it is easy to see that this dimension is $1$. Actually, we'll find a basis for $U+V$ and a basis for $U \cap V$ at the same time. Put everyone in a matrix, and reduce the matrix like this: $$\begin{pmatrix} 1 & 2 & 0 & 0 \\ 0 & -1 & 1 & 0 \\1 & 0 & 0 & -1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0\end{pmatrix} \stackrel{R_2:=R_2+R_4-R_5}{\sim} \begin{pmatrix} 1 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 \\1 & 0 & 0 & -1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0\end{pmatrix}$$
The line that became all zeros corresponded to the vector $(0,-1,1,0)$, who generates $U \cap V$. The rest of them generate $U+V$. I didn't try to kill any more rows, because I already found out that the dimension of the intersection is $1$. And before doing this, be sure that you start with basis for $U$ and $V$.