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.

In a different basis the same linear operation has different matrix encoding, diagonality is not preserved under basis change.


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<p<1$.

  • 2
    $\begingroup$ Original question had a gate, not density operator. So not rho with p and 1-p. Replace p's with phases. $\endgroup$
    – AHusain
    Mar 20 '19 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.