# Relationship between two different notions of changing basis

To illustrate my question, I will use the spin-$$1$$ $$\hat Y$$ and $$\hat Z$$ operators as examples, although my question applies to all operators. Let $$\{|1;m_z\rangle\}$$ denote the eigenbasis of $$\hat Z$$, and $$\{|1;m_y\rangle\}$$ denote the eigenbasis of $$\hat Y$$. My question concerns what it means to "change basis" from the $$\hat Z$$ basis to the $$\hat Y$$ basis, as it seems that the phrase "change of basis" could refer to two distinct, but related mathematical operations:

1. I can write the kets $$|1; m_z\rangle$$ as a linear combination of $$|1;m_y\rangle$$ via a resolution of identity $$|1;m_z\rangle = \sum_{m_y} |1;m_y\rangle\langle 1;m_y|1;m_z\rangle = \sum_{m_y} C_{m_y, m_z}|1;m_y\rangle.$$ Here, from a mathematical perspective, since $$\sum_{m_y} |1;m_y\rangle\langle 1;m_y| = I$$, I am not actually changing the ket; I am just writing it in a different way.

2. I can represent $$\hat Y$$ and $$\hat Z$$ in the $$\hat Z$$ basis as $$3 \times 3$$ matrices $$[\hat Z] = \begin{pmatrix}1&0&0\\0&0&0\\0&0&-1\end{pmatrix}\quad [\hat Y] = \frac{i}{\sqrt{2}}\begin{pmatrix}0&-1&0\\1&0&-1\\0&1&0\end{pmatrix}.$$ Then, I can obtain a change of basis matrix $$P$$ such that $$[\hat Y] = P^{-1}[\hat Z]P$$, where $$P = \frac{1}{\sqrt{2}} \begin{pmatrix}i&1&-i\\1&0&1\\-i&1&i\end{pmatrix}.$$ Then, in this representation, the $$\hat Z$$ basis becomes $$|1;1\rangle \mapsto [1,0,0]^T = e_1,\quad |1;0\rangle \mapsto [0,1,0]^T = e_2,\quad |1;-1\rangle\mapsto[0,0,1]^T = e_3,$$ and to change basis is to apply the matrix $$P$$ to the $$e_i$$, which will yield the columns of $$P$$ as outputs.

The two above operations are clearly different, as in the first case I am just applying an identity operator, and in the second case I am applying a matrix that is not the identity matrix. However, they are also related, as the matrix $$P$$ houses the expansion coefficients $$C_{m_y, m_z}$$. So my question is: what is the precise relationship between these two operations, and how come in one case I am applying the identity but in another case I am not? I believe my confusion lies somehow in a misunderstanding in the difference between an operator and its matrix representations.