# How can we decompose the identity matrix given a set of orthonormal vectors?

Let $$A$$ be a positive semidefinite (P.S.D) matrix with distinct set of eigenvalues. since it is P.S.D its eigendecomposition is as follows for eigenpairs of $$(\lambda_i,v_i)$$

$$A= \begin{bmatrix} v_1 & v_2 & \cdots v_n \end{bmatrix} \begin{bmatrix} \lambda_1 & 0 & \cdots & 0 \\ 0 & \lambda_2 & 0 & \cdots \\ \vdots & & \ddots \\ 0 & \cdots & 0 & \lambda_n \end{bmatrix} \begin{bmatrix} v_1^T \\ v_2^T \\ \vdots \\ v_n^T \end{bmatrix}$$

where $$v_i^Tv_i=1$$ and $$v_i^Tv_j =0$$ for $$i \neq j$$. $$A$$ can be written as the summation as the following

$$A= \begin{bmatrix} \lambda_1v_1 & \lambda_2v_2 & \cdots \lambda_nv_n \end{bmatrix} \begin{bmatrix} v_1^T \\ v_2^T \\ \vdots \\ v_n^T \end{bmatrix} = \sum_{i=1}^{n} \lambda_iv_iv_i^T$$

If $$A=I$$, is the above holds for any set of orthonormal vectors $$\{u_i\}_{i=1}^n$$? If so, could you show it?

Let you have a set of orthonormal vectors $$\{u_i\}_{i=1}^n$$ building $$U$$ as follows
$$U= \begin{bmatrix} u_1 & u_2 & \cdots & u_n \end{bmatrix}$$ Hence, $$U$$ is a unitary matrix, i.e. $$U^TU=I_n$$ and $$UU^T=I_n$$, so by multiplying
$$UU^TU=UI_n \rightarrow I_nUU^T=UI_nU^T \rightarrow I_n=UI_nU^T=\sum_{i=1}^{n} u_iu_i^T$$
It follows that $$I=\sum_{i=1}^{n}v_iv_i^T$$ for any orthonormal basis $$v_i$$, i.e. any complete orthonormal set. The argument is the same, it makes no difference whether the eigenvalues $$\lambda_i=1$$ are distinct or not. What matters is that $$v_i$$ form an orthonormal eigenbasis. For $$A=I$$ every vector is an eigenvector, so any basis is an eigenbasis. Applying the sum to any vector $$x$$ we have $$\big(\sum_{i=1}^{n}v_iv_i^T\big)x=\sum_{i=1}^{n}(v_i,x)v_i=x,$$ because $$v_i$$ are an orthonormal basis. Which means that the sum acts the same way as $$I$$.