Nielsen & Chuang Exercise 2.4 - “Matrix representation for identity” [closed]

Reproduced from Exercise 2.4 of Nielsen & Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition):

Show that the identity operator on a vector space $$V$$ has a matrix representation which is one along the diagonal and zero everywhere else, if the matrix representation is taken with respect to the same input and output bases. This matrix is known as the identity matrix.

Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.

closed as off-topic by Sanchayan DuttaJan 7 at 15:10

• This question does not appear to be about quantum computing or quantum information, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

locked by Sanchayan DuttaJan 7 at 15:15

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. See the help center for guidance on writing a good question.

On a vector space $V = \textrm{span}(\{|v_1⟩, \ldots, |v_n⟩\})$, the identity operator $\mathcal{I}$ maps each vector to itself, such that $$\mathcal{I} = \sum_i |v_i⟩⟨v_i|.$$
If $\{|v_1⟩, \ldots, |v_n⟩\}$ is chosen as the basis for the matrix representation, then we set
$$|v_1⟩ = \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix}, \quad |v_2⟩ = \begin{pmatrix} 0 \\ 1 \\ \vdots \\ 0 \end{pmatrix}, \quad \cdots \quad |v_n⟩ = \begin{pmatrix} 0 \\ 0 \\ \vdots \\ 1 \end{pmatrix},$$
and $⟨v_1| = (|v_1⟩)^\dagger$ such that $$|v_1⟩⟨v_1| = \begin{pmatrix} 1 \\ 0 \\ \vdots \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 & \cdots & 0 \end{pmatrix} = \textrm{diag}(1,0,\ldots,0) , \quad\textrm{etc}.$$
Summing over all terms therefore produces the desired matrix $$\mathcal{I} = \begin{pmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{pmatrix}$$