I'm trying to solve an algebra homework problem, basically I have:
$$\phi:V \longrightarrow V$$ such that $\phi = \phi^2$, where $V$ is finite dimensional. I already proved that $V = \phi(V) \oplus ker(\phi).$ I need to prove that there is a basis such that the associated matrix of $\phi$ has entries $0$ or $1$. This is my attempt:
Let $\{v_1,\ldots,v_n \}$ be a basis for $V$, $\mathscr{E} = \{e_1,\ldots,e_k \}$ be a basis for $ker(\phi)$ and $\mathscr{E}_1 = \{e_{k+1},\ldots,e_m \}$ be a basis for $\phi(V)$.
Since $\phi(V) \cap ker(\phi) = 0$. Then for $v \in V$, we have: $v\in ker(\phi)$ or $v \in \phi(V)$. It $v \in ker(\phi)$, then $\phi(v) = 0$, but $\phi(v) = \phi^2(v)$, then the associated matrix $$M_{\mathscr{E}}^{\mathscr{E}}(\phi) = \phi(v_j) = \sum\limits_{i=1}^k \phi^2(e_i) = 0, \qquad j \in\{1,2,\ldots,n \}$$
Its is clear that such matrix has $0$ in the diagonal. On the other hand, for $v \in V$ write $v = \sum\limits_{i=1}^n r_iv_i$, then: $\phi(v) = \phi^2(v)$, then the associated matrix is given by $$M_{\mathscr{E_1}}^{\mathscr{E_1}}(\phi) = \phi(v_j) = \sum\limits_{i=k+1}^m \phi^2(e_i), \qquad j \in\{1,2,\ldots,n \}$$ This is the part that I'm not sure if it's true. Since the image has a basis, then both of the basis must coincide, hence $$\ \phi^2(e_i)) = \begin{cases} 1 & i = j \\ 0 & i \neq j \end{cases} \\$$ Then the associated matrix will have $1$ along the diagonal. my question is basically how the final matrix will looks like, i think the first $k$ along the diagonal will be all zero and the rest $k+1$ will be one, but I don't get the part where the image get the diagonal of ones.
You already found a good basis, simply use $\mathscr{B} = \mathscr{E} \cup \mathscr{E}_1$.
In the matrix in this basis for $\phi$, we have the first $k$ columns are all $0$, since:
$\phi(e_i) = 0$ for $i = 1,\dots,k$.
On the other hand, let's look at $\phi(e_j)$ for $j = k+1,\dots,n$.
Note that since $e_j \in \phi(V) - \text{ker }\phi$, we have: $e_j = \phi(v)$ for some $v \neq 0 \in V$.
Hence $\phi(e_j) = \phi(\phi(v)) = \phi(v) = e_j$, since $\phi^2 = \phi$. So the column of the matrix for $\phi$ in the basis $\mathscr{B}$, corresponding to $\phi(e_j)$ is all $0$'s with a single $1$ in the $j$-th place (row).
But this is the $j$-th column, so that the $1$ occurs on the diagonal.