1
$\begingroup$

In the 4.16 exercice in the Quantum Computation and Quantum Information (Michael A. Nielsen & Isaac L. Chuang), I don't understand why the correct answer is not this matrix :

$$ \left[ {\begin{array}{ccccc} 1/\sqrt{2} & 1/\sqrt{2} & 0 & 0 \\ 1/\sqrt{2} & - 1/\sqrt{2} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} } \right] $$

Indeed, the Hadamard gate is applied on the first two qubits : $$ |00\rangle , |01\rangle, $$ and nothing is applied to the others, so the previous matrix should be right.

On the contrary, the right solution given is : $$ \left[ {\begin{array}{ccccc} 1/\sqrt{2} & 1/\sqrt{2} & 0 & 0 \\ 1/\sqrt{2} & - 1/\sqrt{2} & 0 & 0 \\ 0 & 0 & 1/\sqrt{2} & 1/\sqrt{2} \\ 0 & 0 & 1/\sqrt{2} & - 1/\sqrt{2} \\ \end{array} } \right] $$ after the calculation of the tensor product $$ I_1 \otimes H_2. $$

$\endgroup$
1
  • $\begingroup$ The first matrix you wrote is not correct because it does not give the correct transformation on all four basis states. It gives the correct transformation for the two states $|00\rangle$ and $|01\rangle$, but it gives the incorrect transformation for the two states you neglected to consider $|10\rangle$ and $|11\rangle$. Under your matrix those latter two states transform trivially, but they should transform as: $|10\rangle\to \frac{1}{\sqrt{2}}\left(|10\rangle + |11\rangle\right)$ and $|11\rangle\to \frac{1}{\sqrt{2}}\left(|10\rangle - |11\rangle\right)$. $\endgroup$
    – hft
    Oct 3, 2023 at 16:25

3 Answers 3

3
$\begingroup$

In my copy, we are asked to consider this action $$ |x_1\rangle|x_2\rangle \rightarrow (I_1 \otimes H_2)|x_1\rangle|x_2\rangle $$ and to find the matrix representation of $I_1 \otimes H_2$. In matrix representation, this is calculated as follows: $$ \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix} \otimes \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \end{bmatrix} = \begin{bmatrix} 1 \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \end{bmatrix} \ & 0 \\ 0 & 1 \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \end{bmatrix} \\ \end{bmatrix} \\ = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} &0 & 0 \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 & 0 \\ 0 & 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ 0 & 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ \end{bmatrix} $$

in agreement with the given solution.

A good litmus test to see why the representation you've given doesn't quite work is to see it's action on the state $|10\rangle$. We expect $$ (I \otimes H)|10\rangle = |1+\rangle = \frac{1}{\sqrt{2}}(|10\rangle +|11\rangle). $$ However, $$ \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 & 0 \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \\ \end{bmatrix} = |10\rangle $$ which is trivially incorrect. In your matrix, it seems we've overlooked the behavior of the system on the second qubit when the first qubit (furthest left qubit) is in the state $|1\rangle$.

Your mistake seems to stem from a common misunderstanding (especially when considering gates in quantum computing) of the tensor product. The tensor product is not just a straightforward combination of two matrices; it is a mathematical operation that captures the combined effect of an operator acting on two systems in parallel.

Remember that if we have two separate systems (e.g. two unentangled qubits), the combined state of the two systems is represented by the tensor product of the two systems ($|01\rangle$ is just shorthand for $|0\rangle \otimes |1\rangle$). Similarly, when we want to describe the effect of two operators acting on these systems, we use the tensor product of the operators. When you take the tensor product of two matrices, you're essentially describing how each element of the first matrix acts in conjunction with each element of the second matrix on the system.

$\endgroup$
1
$\begingroup$

Your matrix is incorrect because it implies that there is no action on the input basis states $|1\rangle |0\rangle$ and $|1\rangle |1\rangle$. The Hadamard gate has the matrix \begin{bmatrix}1/\sqrt{2}&1/\sqrt 2\\1/\sqrt 2&-1/\sqrt 2\end{bmatrix} which means that it sends $|0\rangle \to |+\rangle$ and $|1\rangle \to |-\rangle$. Thus, it acts on all four of the two-qubit basis states $|0\rangle |0\rangle, |0\rangle |1\rangle, |1\rangle |0\rangle,$ and $|1\rangle |1\rangle$ (for example, it sends $|1\rangle |1\rangle \to |-\rangle |1\rangle$).

$\endgroup$
0
$\begingroup$

...the tensor product $$ I_1 \otimes H_2. $$

... I don't understand why the correct answer is not this matrix :

$$ \left[ {\begin{array}{ccccc} 1/\sqrt{2} & 1/\sqrt{2} & 0 & 0 \\ 1/\sqrt{2} & - 1/\sqrt{2} & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{array} } \right] $$

This is not the correct answer because it does not give the correct result for all four basis states.

Indeed, the Hadamard gate is applied on the first two qubits : $$ |00\rangle , |01\rangle, $$ and nothing is applied to the others, so the previous matrix should be right.

No. The Hadamard gate is applied to the latter qubit of the direct product. Therefore it effects all four basis states. The "previous matrix" does not implement the correct transformation. See below for further explanation.


You need to consider the action on the other basis states. You have only considered the two basis states for which your above matrix gives the right transformation, but your matrix fails to give the correct transformation for the other two basis states $|10\rangle$ and $|11\rangle$.

For example, we must have: $$ |10\rangle \to |1\rangle\otimes\frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle\right) =\frac{1}{\sqrt{2}}\left(|10\rangle + |11\rangle\right) \;, $$ but your transformation gives: $$ |10\rangle \to |10\rangle\;, $$ so your transformation matrix is wrong.

On the contrary, the right solution given is : $$ \left[ {\begin{array}{ccccc} 1/\sqrt{2} & 1/\sqrt{2} & 0 & 0 \\ 1/\sqrt{2} & - 1/\sqrt{2} & 0 & 0 \\ 0 & 0 & 1/\sqrt{2} & 1/\sqrt{2} \\ 0 & 0 & 1/\sqrt{2} & - 1/\sqrt{2} \\ \end{array} } \right] $$ after the calculation of the tensor product $$ I_1 \otimes H_2. $$

Yes, the matrix directly above is the correct solution because it gives the correct transformation on all basis states (not just two).

$\endgroup$

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.