3
$\begingroup$

Hadamard gate matrix is:

$$\frac{1}{\sqrt 2}\begin{bmatrix}1 && 1 \\ 1 && -1\end{bmatrix}$$

The Dirac notation for it is:

$$\frac{|0\rangle+|1\rangle}{\sqrt 2}\langle0|+\frac{|0\rangle-|1\rangle}{\sqrt 2}\langle1|$$

I am unable to understand, how this gate matrix is translated into dirac notation?

$\endgroup$

1 Answer 1

7
$\begingroup$

First remember that each matrix element can be written as outer products in Dirac notation:

$$|0\rangle\langle 0| = \begin{bmatrix}1 & 0 \\ 0 & 0 \end{bmatrix},|1\rangle\langle 1| = \begin{bmatrix}0 & 0 \\ 0 & 1 \end{bmatrix},|1\rangle\langle 0| = \begin{bmatrix}0 & 1 \\ 0 & 0 \end{bmatrix}, |0\rangle\langle 1| = \begin{bmatrix}0 & 0 \\ 1 & 0 \end{bmatrix}\tag{1}.$$

This can be verified easily, for example:

zero=[0 ; 1], one=[1; 0]
one*zero'

gives:

ans =
   0   1
   0   0

So now let's write the matrix as a linear combination of outer products in Dirac notation:

$$ \tag{2} \frac{1}{\sqrt{2}}|0\rangle\langle 0 | + \frac{1}{\sqrt{2}}|0\rangle\langle 1 | + \frac{1}{\sqrt{2}}|1\rangle\langle 0 | - \frac{1}{\sqrt{2}}|1\rangle\langle 1 |. $$

This is what you have in your question, especially if you factor out the $|0\rangle$ from two terms and $|1\rangle$ from the other two terms 😊

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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