1
$\begingroup$

In the answer here, it is explained that where the measurement operates on only a subset of the qubits of the system (for example qubits 2 and 3 out of five), the matrix can be constructed using the Kronecker product. However, I need to perform the measurement on qubits 1 and 4. So it is not clear to me what matrices to put into the Kronecker product.

The particular measurement I need to do is the Bell measurement, whose matrix is $$\begin{bmatrix} 0&1&1&0\\ 0&-1&1&0\\ 1&0&0&1\\ 1&0&0&-1 \end{bmatrix}.$$

$\endgroup$
3
  • 3
    $\begingroup$ Use swap gates to temporarily turn it into the case you know how to do. $\endgroup$ Dec 19, 2021 at 0:51
  • $\begingroup$ How do you construct the matrix for swapping, for example, qubits 1 and 3 out of five, so as to get a contiguous pair? $\endgroup$
    – Anna Naden
    Dec 22, 2021 at 1:15
  • $\begingroup$ You can build a swap of non-adjacent qubits by composing swaps of adjacent qubits. For example, to swap qubit 1 with 3 (and leave all other qubits unaffected), swap qubit 1 with 2, then swap 2 with 3 and finally 1 with 2 again. $\endgroup$ Dec 22, 2021 at 1:42

1 Answer 1

1
$\begingroup$

Explicit indices

The difficulty here arises from making indices implicit in tensor product expressions. For example, the unitary $U$ corresponding to controlled-NOT gate on qubits $1$ and $2$ and identity on qubit $3$ is often written down as

$$ U=\text{CNOT}\otimes I\tag1 $$

but a similar unitary $U'$ corresponding to controlled-NOT on qubits $1$ and $3$ and identity on qubit $2$ cannot be written this way

$$ U'=\text{???}.\tag2 $$

A solution is to introduce subscripts that identify the qubits

$$ U_{123}=\text{CNOT}_{12}\otimes I_3\tag{1'} $$

which allows us to write $(2)$ as

$$ U_{123}'=\text{CNOT}_{13}\otimes I_2.\tag{2'} $$

Computing matrix elements of tensor products

The additional advantage of this more explicit notation is that it provides a simple algorithm for computing matrix elements of tensor products. To that end replace qubit list like $123$ with two lists of indices like $i_1i_2i_3;k_1k_2k_3$ where $i_m$ are row indices and $k_m$ are column indices and where $m\in\{1,2,3\}$ identifies a qubit corresponding to each index. Then $(2)$ becomes

$$ U_{i_1i_2i_3;k_1k_2k_3}=\text{CNOT}_{i_1i_2;k_1k_2}I_{i_3;k_3}\tag3 $$

and $(2')$ becomes

$$ U_{i_1i_2i_3;k_1k_2k_3}'=\text{CNOT}_{i_1i_3;k_1k_3}I_{i_2;k_2}.\tag{3'} $$

If we now interpret $i_1i_2i_3\in\{000,001,\dots,111\}$ as the binary encoding of the row number of the matrix on the LHS and $k_1k_2k_3$ as the binary encoding of the column number, then $(3)$ and $(3')$ give us simple direct formulas for computing matrix elements of $U$ and $U'$ from the matrix elements of the factor matrices $\text{CNOT}$ and $I$.

Example

For example, the matrix of the CNOT gate is

$$ \text{CNOT}=\begin{bmatrix} 1&0&0&0\\ 0&1&0&0\\ 0&0&0&1\\ 0&0&1&0 \end{bmatrix}.\tag4 $$

In other words,

$$ \text{CNOT}_{ij;i'j'}=\begin{cases} 1&\text{ if }i=i'=0\text{ and }j=j',\\ 1&\text{ if }i=i'=1\text{ and }j\ne j',\\ 0&\text{ otherwise}. \end{cases}\tag5 $$

Also,

$$ I_{i;j}=\begin{cases} 1\text{ if }i=j,\\ 0\text{ if }i\ne j. \end{cases}\tag6 $$

Substituting $(5)$ and $(6)$ into $(3)$, we get

$$ U_{123} = \text{CNOT}_{12}\otimes I_3 = \begin{bmatrix} 1&&&&&&&\\ &1&&&&&&\\ &&1&&&&&\\ &&&1&&&&\\ &&&&&&1&\\ &&&&&&&1\\ &&&&1&&&\\ &&&&&1&& \end{bmatrix}\tag7 $$

and substituting $(5)$ and $(6)$ into $(3')$, we get

$$ U_{123}' = \text{CNOT}_{13}\otimes I_2 = \begin{bmatrix} 1&&&&&&&\\ &1&&&&&&\\ &&1&&&&&\\ &&&1&&&&\\ &&&&&1&&\\ &&&&1&&&\\ &&&&&&&1\\ &&&&&&1& \end{bmatrix}.\tag{7'} $$

Kronecker product

Finally, it is not hard to check that the above algorithm recovers the usual definition of the Kronecker product

$$ A\otimes B=\begin{bmatrix}a_{11}B&\dots&a_{1n}B\\&\dots&\\a_{n1}B&\dots&a_{nn}B\end{bmatrix}\tag8 $$

as a special case since in terms of matrix elements $(4)$ can be written as

$$ (A\otimes B)_{i_1i_2;k_1k_2} = A_{i_1;k_1}B_{i_2;k_2}\tag9 $$

where the compound indices $i_1i_2$ and $k_1k_2$ are to be interpreted as above.

$\endgroup$
4
  • $\begingroup$ I can see that this last answer addresses my concern, but I cannot quite grasp it. For example, I cannot quite see how to construct $CNOT_{13}$. It seems it has something to do with the indices and a generalization of the Kronecker product. Perhaps I adapt the formula for the product so that different indices come into play somehow? $\endgroup$
    – Anna Naden
    Dec 21, 2021 at 20:07
  • $\begingroup$ $\text{CNOT}_{12}$ and $\text{CNOT}_{13}$ have the same matrix, but different index labels. Consequently, $U_{123}=\text{CNOT}_{12}\otimes I_3$ will be different than $U_{123}'=\text{CNOT}_{13}\otimes I_2$. I have added an example that demonstrates this. $\endgroup$ Dec 21, 2021 at 20:54
  • $\begingroup$ I was able to construct $U^\prime_{123}$ per this recipe, but I am still wondering about the meaning of $CNOT_{123}$ since it doesn't exactly refer to a circuit with CNOT on qubits 1 and 3 and identity on qubit 2 $\endgroup$
    – Anna Naden
    Dec 22, 2021 at 0:55
  • $\begingroup$ CNOT should have only two subscripts for identifying qubits, e.g. $\text{CNOT}_{13}$, not three as in $\text{CNOT}_{123}$ (since it's a two-qubit gate!). It can also be written with four index subscripts like $\text{CNOT}_{ij;kl}$ when we wish to separately name the row and column index for each qubit (a fancy way of saying this is that CNOT is an order four tensor). $\endgroup$ Dec 22, 2021 at 1:00

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.