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 & 0 \\ 1 & 0 \end{bmatrix}, |0\rangle\langle 1| = \begin{bmatrix}0 & 1 \\ 0 & 0 \end{bmatrix}\tag{1}.$$

This can be verified easily, for example:

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

gives:

ans =
   0   0
   1   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$
2
  • 1
    $\begingroup$ Traditionally (or so I think, correct me if I'm wrong), $|0\rangle$ is $\begin{pmatrix}1\\0\end{pmatrix}$ and $|1\rangle$ is $\begin{pmatrix}0\\1\end{pmatrix}$, while it seems that you've used a reversed convention here. If it's deliberate, I think it could be helpful to state the convention you use at the beginning of your answer if you don't mind! $\endgroup$
    – Tristan Nemoz
    Jan 22 at 8:23
  • 2
    $\begingroup$ @TristanNemoz I think you're right but I'm not near a keyboard right now (5:46am in Waterloo!). Feel free to edit the answer. $\endgroup$ Jan 22 at 10:47

Your Answer

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

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