The SWAP gate swaps the state of the two qubits so that in the computational basis $|01\rangle \rightarrow |10 \rangle$ with a matrix representation given by:

\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix}

What I found interesting (but not necessarily surprising) is that the matrix representation of the SWAP gate is independent of the basis used, e.g. in the polar basis we also have $|+-\rangle \rightarrow |-+\rangle$ and the matrix representation is the same. As such the SWAP gate can be interpreted as swapping the qubits independent of the basis used. It's also relatively straightforward to check that this holds for any basis $\alpha |0\rangle + \beta |1\rangle$, $\beta^* |0\rangle - \alpha^* |1\rangle$.

Now my question is whether there are other such gates (2- or n-qubit) that have a basis independent interpretation of their action. Mathematically I guess this would translate to the unitary matrices $U_G$ satisfying:

\begin{equation} \left(U_b^{\otimes n}\right)^\dagger U_G U_b^{\otimes n} = U_G \end{equation}

for any $2 \times 2$ unitary matrix $U_b$.

I guess one (not super interesting) example would be any arbitrary sequence of m SWAP gates as this would result in:

\begin{equation} U_G = \prod_m\left(I^{\otimes k_m}\otimes U_{\text{SWAP}} \otimes I^{\otimes n-k_m-2}\right) \end{equation}

which satisfies the requirement as a result of the single SWAP gate satisfying the requirement. However I was hoping there might other more interesting gates that are basis independent or some interesting mathematical details on the set of such gates.

  • 1
    $\begingroup$ A square-root-of-SWAP may also satisfy your requirement (although I haven't thought too much about it). Also, this question may be related. $\endgroup$ Dec 8, 2021 at 16:18

2 Answers 2


The reason why swap works in this way can be seen from its eigenbasis. We have $$ \text{SWAP}=P_+-P_- $$ where $P_+=I-P_-$ and $P_-$ is the projector onto the anti-symmetric state $$ |\Psi\rangle=(|01\rangle-|10\rangle)/\sqrt{2}. $$ Trivially, $(U\otimes U)I(U\otimes U)^\dagger=I$ and it is well known that $$ U\otimes U|\Psi\rangle=|\Psi\rangle $$ (perhaps up to a global phase). So, it is really this basis that does the trick. Any other unitary with the same basis, such as square-root of swap would do, as mentioned by MarkS in a comment.

So, I think the question now becomes what sets of projectors can we find that are all rotationally invariant. And this is basically the same thing as studying decoherence-free subspaces (or subsystems possibly?).

I argued recently that $|\Psi\rangle\langle\Psi|$ is the only one-dimensional projector to have this property. For bipartite $d$-dimensional systems, the Werner states will give you information on the acceptable projectors. So, we break everything down into projectors onto the symmetric ($P_+$) and anti-symmetric ($P_-$) subspaces, allowing us to write $$ U=(I-P_+-P_-)+e^{i\theta_1}P_++e^{i\theta_2}P_- $$

But I have no idea how to parametrise things in the multipartite case. If you want to go down that rabbit hole, you might start with this review paper.

  • $\begingroup$ The multipartite case is also straightforward. What you want to know is the commutant of the group $U(d)^{\otimes n}$. This is given by the famous Schur-Weyl duality: it is the vector space spanned by the permutations between the $n$ subsystems. So you just need to build a convenient basis for this vector space and you know which unitaries are linear combinations of permutations, as you did for the $n=2$ case. Note that $P_+ + P_- = I$, so your parametrisation can be simplified. $\endgroup$ Dec 12, 2021 at 9:12

If I understand the question correctly, you are asking, given a unitary $U$, what are the possible unitaries $V$ such that $V^\dagger UV=U\iff [U,V]=0$. In other words, you are asking what are the possible symmetries of $U$.

These all come from the degeneracies of $U$. To see this, write the eigendecomposition of $U$ as $$U = \sum_k \lambda_k\Pi_k,$$ where $\lambda_k\in\mathbb T$ are eigenvalues (which are bound to belong to the unit circle for unit matrices... not that this makes any difference for our purposes), we assume $\lambda_i\neq\lambda_j$ for $i\neq j$, and $\Pi_k$ is the orthogonal projection with range/support $\ker(U-\lambda_k I)$. In other words, $\Pi_k$ projects onto the eigenspace associated to $\lambda_k$.

The central observation is now that each $\Pi_k$ is effectively an identity operator in a suitable subspace, and the identity looks the same in any basis. Consequently, $U$ is invariant under any basis change $PUP^{-1}$ for any $P$ that preserves these eigenspaces, that is, such that $P\ker(U-\lambda_k I)\subseteq \ker(U-\lambda_k I)$ for all $k$, or equivalently, such that $[P,\Pi_k]=0$.

Vice versa, if $P$ does not preserve one of the eigenspaces, say the one corresponding to $\Pi_k$, then there is some $v\in\ker(U-\lambda_k I)$ such that $P v= P\Pi_k v\notin \ker(U-\lambda_k I)$, while $\Pi_k Pv\in \ker(U-\lambda_k I)$, and thus $[P, \Pi_k]\neq0$, from which $[P,U]\neq0$ follows.

Specialising this to the SWAP, you can observe that any invertible operation that preserves, separately, the supports of $P_+$ and $P_-$, will do what you want.

See also the answers, in math.SE, on the question Given a matrix, is there always another matrix which commutes with it?.


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.