you can't just use these formulas, you need more.
For instance, you can start by looking at . It consists of all such that . This condition is equivalent to : has to be zero on , and may be equal to anything on a supplementary space. Thus the dimension of the set of such is . But we also have , hence we conclude .
The statement about " has to be zero on , and may be equal to anything on a supplementary space" and the computation of the dimension are made rigorous using bases or dual bases. For instance you can take a base of that starts with a base of , so that iff it equals 0 on the first vectors of the basis. From there you can deduce that is spanned by the elements of the dual base that correspond to vectors not in . (I know this is not very clear, that's just the rough idea, I let you try to find by yourself)