# How to write CNOT within a tensor product expression of operations on the whole system

If I have an $$n$$ qubit register and I act on the $$k^{\mathrm{th}}$$ qubit with an arbitrary operator $$\hat{G}$$, I can write the operation on the whole register as the operation, $$\underbrace{\mathbb{1}\otimes...\otimes\mathbb{1}}_\text{k-1 times}\otimes\hat{ G}\otimes\underbrace{\mathbb{1}\otimes...\otimes\mathbb{1}}_\text{n-k times}.$$ Is there some similar notation to write the operator acting on the whole system when we are considering two qubit gates? For example, I know it's not possible to express any entangling gate as a tensor product, but if we were considering a CNOT with the $$k^{\mathrm{th}}$$ qubit as the control and the $$(k+1)^{\mathrm{th}}$$ qubit as the target, something like $$\underbrace{\mathbb{1}\otimes...\otimes\mathbb{1}}_\text{k-1 times}\otimes \mathrm{CNOT}^{(\mathrm{c})}\otimes\mathrm{CNOT}^{(\mathrm{t})}\otimes\underbrace{\mathbb{1}\otimes...\otimes\mathbb{1}}_\text{n-k-1 times}$$ intuitively tells us what's happening (althought it's not correct).

TL;DR: Use explicit labels rather than position to indicate qubits, e.g. $$\text{CNOT}_{k,k+2}$$.

## Notations for tensor product

There are a few different ways of indicating the subsystems (e.g. qubits) in a tensor product expression. In the "positional" or "implicit" notation the subsystems are specified implicitly by the order of the states or operators, as in the question. In this notation it is difficult to represent entangled states and entangling operators unless they span adjacent subsystems.

An alternative notation uses explicit labels to indicate subsystems. Suppose we have three qubits and name them $$A$$, $$B$$ and $$C$$. Then the CNOT gate between $$A$$ and $$B$$ may be written under the first convention as $$\text{CNOT}\otimes\mathbb{I}$$ and in the second convention as $$\text{CNOT}_{A,B}\otimes\mathbb{I}_C$$ or even just $$\text{CNOT}_{A,B}$$ since identities can often be made implicit. The CNOT between $$A$$ and $$C$$ is hard to write in the first convention, but easy in the second $$\text{CNOT}_{A,C}$$. The second convention also allows us to specify which qubit is the control and which one is the target, so that we can differentiate between $$\text{CNOT}_{A,B}$$ and $$\text{CNOT}_{B,A}$$.

## Sum of products

Technically, if you absolutely must use the positional convention, you can actually do this by expressing the gate as a sum. For example, we can use the identity $$\text{CNOT}=P_0\otimes\mathbb{I}+P_1\otimes X$$ where $$P_k$$ is the projector on the $$k$$th computational basis state, to write $$\text{CNOT}_{A,C}$$ in the first convention as $$P_0\otimes\mathbb{I}\otimes\mathbb{I}+P_1\otimes\mathbb{I}\otimes X.$$ The last expression makes the gate quite obscure and I have never seen it used in practice.

• ah yeh the sum of projects makes sense! Jan 21 at 22:31