2
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ Just to note $$H \otimes CNOT = \frac{1}{\sqrt{2}}\begin{bmatrix} CNOT & CNOT \\ CNOT & -CNOT\end{bmatrix}$$ And of course, this works generally. $\endgroup$ – Martin Vesely Nov 14 at 14:54
  • $\begingroup$ @MartinVesely yes, that makes sense, and that fits my observations informally. I guess my question was about the formal generalization -- it appears, as given in the answers below, that the Kronecker product gives the proper generalization. thanks for commenting -- this relation is handy on its own $\endgroup$ – 1ijk Nov 18 at 0:51
2
$\begingroup$

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

$\endgroup$
  • $\begingroup$ excellent, thank you. $\endgroup$ – 1ijk Nov 18 at 0:48
2
$\begingroup$

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.

$\endgroup$

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.