# Is the tensor product of two states commutative?

I'm reading "Quantum Computing Expained" of David McMahon, and encountered a confusing concept.

In the beginning of Chapter 4, author described the tensor product as below:

To construct a basis for the larger Hilbert space, we simply form the tensor products of basis vectors from the spaces $$H_1$$ and $$H_2$$. Let us denote the basis of $$H_1$$ by $$|u_i\rangle$$ and the basis of $$H_2$$ by $$|v_i\rangle$$. Then it follows that we can construct a basis $$|w_i\rangle$$ for $$H=H_1\otimes H_2$$ using $$|w_i\rangle = |u_i\rangle \otimes |v_i\rangle$$ (4.6)

Note that the order of the tensor product is not relevant, meaning $$|\phi\rangle\otimes |\chi\rangle = |\phi\rangle \otimes |\chi\rangle$$.

In last equation, I think it implies that tensor product of two state vector is commutative. However, with simple computation to prove this sentence, I could hardly understand why this holds.

Can anyone help me to understand what author want to explain?

• Use a different book. Jun 23, 2020 at 23:35
• @NorbertSchuch I disagree. From a purely mathematical perspective, this is actually a natural statement to make. It's just that physicists often implicitly assume additional structure connecting the factor spaces, and then use a non-obvious notational convention that is more convenient for advanced applications but more confusing for beginners. See my answer. Jun 24, 2020 at 23:00
• @tparker, I actually agree with Norbert Schuch (can't @ you) here. akawarren is most likely starting out in the field of quantum computing, and I can very much understand that the quoted explanation can invoke confusion. Even though there may be more nuance, and that in principle the order is not relevant, the statement brings unnecessary ambiguity. Students are often drawn to formulas as the main focus of their study, so an author should make sure that these formulas make sense for someone who the concept has just been introduced to.
– JSdJ
Jun 25, 2020 at 7:33
• @tparker My comment was in no way primarily related to the quote given. It is intended just in the way and the generality in which it is written. Jun 25, 2020 at 9:48
• @NorbertSchuch Gotcha, thanks for clarifying. JSdJ, I agree that it depends on the context of the text giving the explanation, and for an intro to quantum computing that last statement is confusing. Jun 25, 2020 at 21:45

The idea of a tensor product is to link two Hilbert spaces together in a nice mathematical fashion so that we can work with the combined system. Normally, these two Hilbert spaces each consist of at least one qubit, and sometimes more.

Let's say we have a qubit, which we label $$a$$, and a qubit which we label $$b$$. These qubits 'live' in the Hilbert spaces of $$\mathcal{H}_{a}$$ and $$\mathcal{H}_{b}$$, respectively; we might call their respective states $$|\psi_{a}\rangle$$ and $$|\psi_{b}\rangle$$. The idea of the tensor product is that we can write the state of the two system together as: $$|\psi_{ab}\rangle = |\psi_{a}\rangle \otimes |\psi_{b}\rangle.$$ We have 'linked' the Hilbert spaces $$\mathcal{H}_{a}$$ and $$\mathcal{H}_{b}$$ together into one big composite Hilbert space $$\mathcal{H}_{ab}$$:

$$\mathcal{H_{ab}} = \mathcal{H}_{a} \otimes \mathcal{H}_{b}.$$

Of course, there is no reason that qubit $$a$$ should come before qubit $$b$$. We thus also could link their Hilbert spaces together in reversed order:

$$\mathcal{H_{ba}} = \mathcal{H}_{b} \otimes \mathcal{H}_{a}.$$ We need to respect our new ordering, and therefore the state of the two systems together is now:

$$|\psi_{ba}\rangle = |\psi_{b}\rangle \otimes |\psi_{a}\rangle.$$

Mathematically speaking, this is a different vector than $$|\psi_{ab}\rangle$$. This is exactly because we have rearranged the order of qubits in how we linked them together.

## Explicit example

Let's say that we have a qubit $$a$$ in the Hilbert space $$\mathcal{H}_{a}$$ with the state $$|\psi_{a}\rangle = \alpha |0_{a}\rangle + \beta|1_{a}\rangle,$$ and a qubit $$b$$ in the Hilbert space $$\mathcal{H}_{b}$$ with the state $$|\psi_{b}\rangle = \gamma |0_{b}\rangle + \delta|1_{b}\rangle.$$

We can link these two qubits together with $$a$$ first: $$|\psi_{ab}\rangle = \alpha\gamma |0_{a}0_{b}\rangle + \alpha\delta |0_{a}1_{b}\rangle + \beta\gamma |1_{a}0_{b}\rangle + \beta\delta|1_{a}1_{b}\rangle,$$ where I now have specifically labeled the basis states for qubit $$a$$ and $$b$$.

Or with $$b$$ first: $$|\psi_{ba}\rangle = \alpha\gamma |0_{b}0_{a}\rangle + \beta\gamma|0_{b}1_{a}\rangle + \alpha\delta |1_{b}0_{a}\rangle + \beta\delta|1_{b}1_{a}\rangle.$$

These state are not the same. We see that the coefficients for $$|01\rangle$$ and $$|10\rangle$$ have been interchanged, but why this happened becomes very obvious if we look at the labels $$a$$ and $$b$$ of the basis states. All we have done is writing $$a$$ or $$b$$ first.

As an added argument, you could have the SWAP operation act on either of these states, and arrive at the other one. Note that, if we are very scrupulous, strictly speaking, by applying the SWAP gate we have not (re)reversed the order, but we have just 'given' the state of qubit $$a$$ to qubit $$b$$ and vice versa. If you may, it is kind of like a 'double fault', that cancels itself out.

So in general a tensor product does not commute, but rearranging the terms is just reordering the systems that you link. We just stick with one particular ordering, and it is always evident which one this is.

• You are comparing coefficients in different bases and draw the wrong conclusion that the states are different. $|0\rangle_a |1\rangle_b = |1\rangle_b|0\rangle_a$ and similarly $|\psi_{ab}\rangle=|\psi_{ba}\rangle$. Jun 27, 2020 at 16:38
• I disagree; the point I was arguing is exactly that the reordering is a change of basis. If you just look at the vector, the two different orderings give different vectors (in the sense that the basis are differently ordered). For someone to whom to concept of the tensor product is introduced, this is ambiguous to say the least.
– JSdJ
Jun 27, 2020 at 16:58
• The reorderings give different coefficients for the same vector. If you change the basis for ordinary 3D vectors they also remain equal, but only the representation changes. Jun 27, 2020 at 17:46

Annoyingly, the answer is "it depends on what you mean by $$|\psi\rangle \otimes |\phi\rangle$$."

A tensor product of vectors from a collection of Hilbert spaces over the same field is simply a choice of one vector from each Hilbert space, with some equivalence relations modded out. (A tensor product of Hilbert spaces is more complicated.) Let $$\mathcal{H}_A$$ and $$\mathcal{H}_B$$ be the Hilbert spaces for two distinct physical systems $$A$$ and $$B$$ (e.g. qubits), and let $$|\psi\rangle \in \mathcal{H}_A$$ and $$|\phi\rangle \in \mathcal{H}_B$$. Then $$|\psi\rangle_A \otimes |\phi\rangle_B$$ and $$|\phi\rangle_B \otimes |\psi\rangle_A$$ are indeed identical vectors; clearly the choice itself doesn't depend on the order in which you write down its pieces.

But if there is a natural isomorphism between $$\mathcal{H}_A$$ and $$\mathcal{H}_B$$ (which is the case by definition if the two systems are "physically equivalent" at the level of our quantum description), with $$(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$$ and $$(|\phi\rangle \in \mathcal{H}_B) \equiv (|\phi'\rangle \in \mathcal{H}_A)$$, then $$|\psi\rangle_A \otimes |\phi\rangle_B$$ is definitely not necessarily equal to $$|\phi'\rangle_A \otimes |\psi'\rangle_B$$. The tensor product doesn't even "know about" our isomorphism between the factor spaces, so there's no way that this relationship could hold. These two vectors correspond to the two (equivalent but distinct - a subtle concept!) systems being assigned the same two physical states, but swapped.

Without Hilbert space subscripts, the notations $$|\psi\rangle \otimes |\phi\rangle$$ and $$|\phi\rangle \otimes |\psi\rangle$$ are somewhat ambiguous, so the notation is underspecified for determining whether or not they're identical. Your author is interpreting the Hilbert space label as being "pinned" to the particular vector, so it swaps along with the symbols $$|\psi\rangle$$ and $$|\phi\rangle$$. In this case, indeed $$|\psi\rangle \otimes |\phi\rangle \equiv|\phi\rangle \otimes |\psi\rangle$$.

However, physicists often use the following notational convention:

1. If there exists a natural physical isomorphism between Hilbert spaces $$\mathcal{H}_A \equiv \mathcal{H}_B$$, then use the same notation for isomorphic vectors between the Hilbert spaces, with possibly only a subscript distinguishing them. That is, if $$(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$$, then simply use the notations $$|\psi\rangle_A$$ and $$|\psi\rangle_B$$ to describe them.
2. Fix the order of factor Hilbert spaces in a tensor product once at the beginning of the discussion, and then use that order consistently throughout the entire discussion. This allows you to drop Hilbert space subscript labels and save writing.

Under this second convention (which is more common with physicists), we have $$|\psi\rangle \otimes |\phi\rangle \not\equiv|\phi\rangle \otimes |\psi\rangle$$, as explained in the third paragraph.

What the author is trying to say is that it does not matter in which order you write down the two subsystems, it is still the same state. It becomes much clearer if you add subscripts for the subsystems $$1$$ and $$2$$. Let's say $$H_1$$ and $$H_2$$ are finite dimensional with bases $$|u_i\rangle_1$$ and $$|v_j\rangle_2$$. The Hilbertspace $$H_1\otimes H_2$$ has a basis $$|w_{ij}\rangle = |u_i\rangle_1 \otimes |v_j\rangle_2$$, but the order does not matter: $$|w_{ij}\rangle=|u_i\rangle_1 \otimes |v_j\rangle_2 = |v_j\rangle_2 \otimes |u_i\rangle_1$$. The same applies to the states $$|\phi\rangle$$ and $$|\chi\rangle$$: \begin{aligned} |\phi\rangle_1 \otimes |\chi\rangle_2 =& \sum_{ij} \phi_i \chi_j |v_i\rangle_1\otimes |u_j\rangle_2 \\ =& \sum_{ij} \phi_i \chi_j |w_{ij}\rangle \\ =& \sum_{ij} \phi_i \chi_j |u_j\rangle_2\otimes |v_i\rangle_1 \\ =& |\chi\rangle_2 \otimes |\phi\rangle_1 \end{aligned} Your confusion probably comes from the fact that the coefficients in a vector representation change when you change the basis. This is because in general the tensor product is not commutative. For example: $$\left( \begin{array}{c} 1\\ 0 \end{array}\right) \otimes \left( \begin{array}{c} 0\\ 1 \end{array}\right) = \left( \begin{array}{c} 0\\1 \\ 0 \\ 0 \end{array}\right)$$ but $$\left( \begin{array}{c} 0\\ 1 \end{array}\right) \otimes \left( \begin{array}{c} 1\\ 0 \end{array}\right) = \left( \begin{array}{c} 0\\0 \\ 1 \\ 0 \end{array}\right).$$