Dimension of subspace of $\text{End}(\mathbb{R}^5)$ I'm doing a problem which presented me with a basis for some  $U\subseteq\mathbb{R}^5$ where $\dim U=3$ (I can give it explicitly if that helps but I do not think it matters). The question is this:
Find the dimension of the space spanned by all linear maps $\mathbb{R}^5\to\mathbb{R}^5$ with:


*

*$(1,1,1,1,1)^{\text{T}}$ lying in the kernel and with image contained in $U$.

*$(1,1,1,1,1)^{\text{T}}$ lying in the kernel or with image contained in $U$.



So first, am I definitely looking at subspaces of $\text{End}(\mathbb{R}^5)\simeq \mathrm{M}_{5\times 5}(\mathbb{R})$ here? If so, any hints on how to approach this? 
By rank nullity, any map $\phi$ can be put into one of $6$ categories: $(\text{rk}\,\phi,\text{nul}\, \phi)=(0,5)$ or $(1,4)$ $\dots$ or $(5,0)$. But I don't really know how these match up with dimensions of subspaces, and I feel like that's not how I'm meant to think about this. The $(1,1,1,1,1)^{\text{T}}$ seems really arbitrary as well but maybe I'm missing something there too.
 A: Matrices are nice, but sometimes it's easier to work directly with abstract endomorphisms and subspaces and so on. So let's just assume that we have a vector space $V$ of dimension $5$, a subspace $U \subset V$ of dimension $3$, and some nonzero $v \in V$. You can then apply the result to your precise case.
First, let's deal with the kernel condition. Let
$$X = \{ f \in \operatorname{End}(V) \mid v \in \ker f \}$$
In other words, $X = \ker(\Phi)$ is the kernel of the linear map
\begin{align}
\Phi : \operatorname{End}(V) & \to V \\
f & \mapsto f(v)
\end{align}
It is not hard to see that $v \neq 0 \implies \Phi$ is surjective. For example given some $w \in V$, complete $(v)$ into a basis $(v,e_1,e_2,e_3,e_4)$ of $V$, and $(w)$ into another basis $(w,f_1,f_2,f_3,f_4)$. There exists an endomorphism $f$ taking the first basis to the second one, so in particular $\Phi(f) = f(v) = w$. Thus by rank-nullity,
$$\dim X = \dim \operatorname{End}(V) - \dim V = 25 - 5 = 20.$$
Now let
$$Y = \{ f \in \operatorname{End}(V) \mid \operatorname{im} f \subset U \}$$
This is, in disguise, the space $\operatorname{Lin}(V,U)$ of linear maps $V \to U$, which has dimension
$$\dim Y = \dim \operatorname{Lin}(V,U) = (\dim V) (\dim U) = 5 \times 3 = 15.$$
The two spaces you are interested in are respectively


*

*$X \cap Y$ (if you want $v \in \ker f$ and $f(V) \subset U$), and

*$X + Y$ (if you want $v \in \ker f$ or $f(V) \subset U$).


Grassman's formula (or however you call it) says:
$$\dim(X+Y) + \dim(X \cap Y) = \dim(X) + \dim(Y) = 20 + 15 = 35,$$
so we just need to find one of the two to be done.
The easiest one is $X \cap Y = \{ f \in \operatorname{End}(V) \mid f(v) = 0 \text{ and } f(V) \subset U \}$, which is isomorphic to $\{ f \in \operatorname{Lin}(V,U) \mid f(v) = 0 \}$. Indeed, define
\begin{align}
\Psi : \operatorname{Lin}(V,U) & \to U \\
f \mapsto f(v)
\end{align}
Just as before, it's easy to see that $\Psi$ is surjective, hence $X \cap Y = \ker \Psi$ has dimension $15 - 3 = 12$. Finally, it follows that $X + Y$ has dimension $35 - 12 = 23$.

As you can see, it didn't matter what $v$ was, only that it was a nonzero vector. It also didn't matter whether $v \in U$ or not. Sometimes it helps to put the problem in more abstract terms – you're less likely to get bogged down by irrelevant details.
