# Sum of dimensions of subspaces, dimension of sum of subspaces

I am kind of confused when it comes to subspaces. I have difficulty grasping them conceptually. In one of my questions there is the following:

Find two subspaces $H$ and $K$ of $\mathbb{R}^3$ such that $\dim(H + K) \neq \dim(H) + \dim(K)$

After searching for a bit via trial and error I found the following subspaces:

$$\displaystyle H = \left \{ \left [ \begin{array}{c}0\\k\\k\end{array} \right ] | k \in \mathbb{R} \right \}$$

$$\displaystyle K = \left \{ \left [ \begin{array}{c}0\\a\\b\end{array} \right ] | a, b \in \mathbb{R} \right \}$$

My reasoning is that $\dim(H) = 1$ since any two vectors $u, v \in H$ are trivially linearly dependent, and $\dim(K) = 2$ since $\left [ 0, 1, 0 \right ]$ and $\left [ 0, 0, 1\right ]$ in $K$ are linearly independent (and cannot be $3$ since there are only two degrees of freedom) however:

$$H + K = \left \{ \left [ \begin{array}{c}0\\k + a\\k + b\end{array} \right ] | k, a, b \in \mathbb{R} \right \}$$

And so $\dim(H + K) = 2$ since the first component is always zero (so out of any three vectors, two of them will be linearly dependent), or, equivalently, there are still only two degrees of freedom:

$$\dim(H + K) = 2 \neq \dim(H) + \dim(K) = 3$$

Is this correct? Or am I completely on the wrong track? My intuition is that the dimension of the sum of two subspaces is equal to the sum of the dimensions of each subspace when the two subspaces don't "overlap" (for lack of a better word) i.e. $H \cap K = \{ \mathbf{0} \}$, but is this only true in these cases? I cannot find a counterexample..

-
Your example is fine. So is your intuition. –  Gerry Myerson Aug 20 '13 at 12:28
The formula is $\dim (H+K) = \dim H + \dim K - \dim (H\cap K)$, so your intuition is fine. –  Daniel Fischer Aug 20 '13 at 12:30
It looks fine to me... –  DonAntonio Aug 20 '13 at 12:32
@DonAntonio We've just started vector spaces recently and it feels a bit impenetrable to me. I apologize if the question is trivial (it probably is) but I did not understand most of the documents I googled up to help me –  Thomas Aug 20 '13 at 12:34