# Meaning of “diagonal to the computational basis”

I came across the term "diagonal to the computational basis" in my reading recently. I'm not entirely sure what this term means. I know that a diagonal matrix is one with only non-zero elements on the diagonal and I know that the computational basis is $$\alpha \left| 0 \right> + \beta \left| 1 \right>$$ but I'm not sure how these terms relate to one another nor how a particular gate could be said to be diagonal to the computational basis.

Matrix just encodes linear operation that transforms basis vectors to some other vectors. For example, matrix $$M$$ can transform vector $$|0\rangle$$ to vector $$m_{11}|0\rangle + m_{12}|1\rangle$$ and vector $$|1\rangle$$ to $$m_{21}|0\rangle + m_{22}|1\rangle$$. In this case, this matrix is written as $$\left(\begin{matrix} m_{11} & m_{21} \\ m_{12} & m_{22} \end{matrix}\right)$$. And vectors $$|0\rangle$$, $$|1\rangle$$ are encoded as $$\left(\begin{matrix} 1 \\ 0 \end{matrix}\right), \left(\begin{matrix} 0 \\ 1 \end{matrix}\right)$$ respectively.
If the computational basis is the vectors $$\{|0\rangle,|1\rangle\}$$, then this means that $$\rho$$ is a diagonal matrix when written in this basis. In other words, $$\rho=p|0\rangle\langle 0|+(1-p)|1\rangle\langle 1|$$ for some real number $$0.