7

I'm stuck while trying to understand the Hadamard Gate in a more linear algebra understanding. (I understand the algebraic way). This is because I want to program a simulation of a quantum computer. To apply a gate you multiply each ket by the unitary matrix.

So, the Hadamard gate maps the state $\alpha |0\rangle + \beta|1\rangle$ to $\frac{\alpha}{\sqrt{2}}\begin{bmatrix}1\\1\\\end{bmatrix}+\frac{\beta}{\sqrt{2}}\begin{bmatrix}1\\-1\\\end{bmatrix}$ right? But the outputs are not basis vectors. I know this is hard to understand but how do I make it back to the basis vector form so I can write it in ket form. I know you can do it algebraically but how to in linear algebra?

So put it in the form: $$\alpha\begin{bmatrix}1\\0\\\end{bmatrix}+\beta\begin{bmatrix}0\\1\\\end{bmatrix}$$

If you understand what I mean, can you explain it in a general matrix form?

glS
  • 24,708
  • 5
  • 34
  • 108
Vitulus
  • 173
  • 6

2 Answers2

7

In linear algebra representation:

The state of the qubit is $\alpha|0\rangle + \beta|1\rangle = \begin{bmatrix}\alpha \\ \beta \end{bmatrix}$.

The Hadamard matrix is $\frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ 1 & -1 \end{bmatrix}$.

The state after applying a Hadamard gate can be calculated by multiplying the column vector representing the state by the matrix representing the operator:

$\frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1 \\ 1 & -1 \end{bmatrix} \cdot \begin{bmatrix}\alpha \\ \beta \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix}\alpha + \beta \\ \alpha - \beta \end{bmatrix}$ = $\frac{1}{\sqrt{2}}(\alpha + \beta)|0\rangle + \frac{1}{\sqrt{2}}(\alpha - \beta)|1\rangle$

Dripto Debroy
  • 1,796
  • 8
  • 12
Mariia Mykhailova
  • 9,010
  • 1
  • 12
  • 39
  • 1
    Oh I get you. I was thinking to multiply each ket but it's much simpler to combine them into one vector. Thank you for understanding my question and answering it! – Vitulus Jul 29 '18 at 07:30
3

I think you are misunderstanding what a basis vector is. $|0\rangle$ and $|1\rangle$ are basis vectors and these are referred to a rectilinear basis vectors and $\frac{|0\rangle+|1\rangle}{\sqrt{2}} = |+\rangle$ and $\frac{|0\rangle-|1\rangle}{\sqrt{2}} = |-\rangle$ are basis vectors too and these are referred to as diagonal basis vectors. The hadamard transform takes a vector from one basis representation to another. If you take a dot product between the diagonal basis vectors i.e $\langle+|-\rangle$ you will realize that they are orthonormal. It is entirely possible for a Hilbert space and more generally a vector space to have multiple sets of basis vectors.