Question
Let $T : \mathbf{R^n} \rightarrow \mathbf{R^n}$ be a linear operator such that $T(W) \subseteq W$ for every subspace $W$ of $\mathbf{R^n}$. Show that there exists $k \in \mathbf{R}$ such that $T(x) = kx$, for all $x \in \mathbf{R^n}$.
This is my attempt at an answer:
Let $\{e_1,\ldots, e_n\}$ be a basis of $\mathbf{R^n}$. Let W be the subspace generated by ${e_1}$. Then any element of W is of the form ${ke_1}$, for some $k \in \mathbf{R}$.
$\therefore T(e_1) \in W \Rightarrow T(e_1) = ke_1$ for some $k \in \mathrm{R}$. Similarly, $T(e_2) = ke_2,\ldots, T(e_n) = ke_n$
Every element $x$ of $\mathbf{R^n}$ is of the form $\alpha_1e_1 + \cdots + \alpha_ne_n$, where $\alpha_1, \ldots ,\alpha_n \in \mathbf{R}$
$$\therefore T(x) = T(\alpha_1e_1 + \cdots + \alpha_ne_n)$$
$$= \alpha_1T(e_1) + \cdots + \alpha_nT(e_n)$$ $$= \alpha_1ke_1 + \cdots + \alpha_nke_n$$ $$= k(\alpha_1e_1 + \cdots + \alpha_ne_n)$$ $$= kx$$
I'm not sure if my proof is correct, especially the part in bold.
The problem with the attempted solution presented in the text of the question, especially the part in bold type, is that we can't assume
$T(e_i) = ke_i, \tag 1$
with one value of $k \in \Bbb R$ for all the $e_i$; since all we are given is that
$T(W) \subset W \tag 2$
for any subspace $W$, there is nothing to a priori prohibit
$T(e_i) = k_i e_i, \tag 3$
with a different $k_i \in \Bbb R$ for each $e_i$; certainly an operator $T$ satisfying (3) has the property that
$T(\Bbb R e_i) \subset \Bbb R e_i \tag 4$
for each $e_i$.
So how can we force all the $k_i$ to be equal? Well, suppose we look at the one dimenensional subspace $\Bbb R(e_i + e_j)$; since
$T(\Bbb R(e_i + e_j)) \subset \Bbb R(e_i + e_j), \tag 5$
there must be some $k \in \Bbb R$ with
$T(e_i + e_j) = k(e_i + e_j) = ke_i + ke_j; \tag 6$
but
$T(e_i + e_j) = T(e_i) + T(e_j) = k_i e_i + k_j e_j; \tag 7$
these two equations taken together yield
$ke_i + ke_j = k_i e_i + k_j e_j, \tag 8$
whence
$(k - k_i)e_i + (k - k_j)e_j = 0; \tag 9$
the linear independence of the $e_i$ now forces
$k _i = k = k_j; \tag{10}$
since this argument applies for any two $e_i$, $e_j$, we must have
$k_i = k_j = k, \; \forall i, j \; 1 \le i, j \le n; \tag{11}$
we thus conclude that
$T = kI, \; k \in \Bbb R. \tag{12}$
It should of course be observed that the above argument applies for any basis $e_i$ of $\Bbb R^n$.