3

Let's say I have more than one qbits $|0\rangle|1\rangle$ and I want to perform a $H$ on both of them. I know the matrix representation for the Hadamard on a single qbit is

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

If I represent the qbits with the vector $$\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0\end{bmatrix}$$ I think that the representation for a two qbit Hadamard is the tensor $H\otimes H$ giving

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

and so

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

which feels correct as

$$ \begin{align}\frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1 & 1\\1 & -1\end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} &= \\ \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1 \end{bmatrix} \otimes \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ -1 \end{bmatrix} &= \\ \frac{1}{2} \begin{bmatrix} 1 \\ -1 \\ 1 \\ -1 \end{bmatrix} \end{align} $$

But is this actually correct? And how does it (or is it possible to?) generalize to different gate compositions like $H \otimes CNOT$? Does it scale to $n$ qbits?

glS
  • 27,670
  • 7
  • 39
  • 126
1ijk
  • 235
  • 1
  • 6

2 Answers2

2

What you are looking for is https://en.wikipedia.org/wiki/Kronecker_product

Note that a column-vector can be considered as a matrix with the size $n \times 1$, so the Kronecker product rule also applies.

Danylo Y
  • 8,121
  • 13
  • 25
2

In general, given two matrices $A$ and $B$ of dimensions $n_1\times n_2$ and $m_1\times m_2$, respectively, their tensor product $A\otimes B$ can be represented using the Kronecker product as $$(A\otimes B)_{n_1 m_1,n_2m_2}=A_{n_1,n_2}B_{m_1, m_2}.$$ The indices on the left hand side are a standard way to enumerate the integers from $1$ to $n_1 m_1$ and from $1$ to $n_2 m_2$. This is what you already observed in the case of $H\otimes H$, where two $2\times 2$ matrices become one $4\times 4$ matrix, whose elements are the product of elements of the two copies of $H$.

glS
  • 27,670
  • 7
  • 39
  • 126