# How to write down product operators acting on non-adjacent subsystems?

Given the following fusion gate (type-2) which is projecting 2 qubits to an even state

$$F_{ZZ}=(\langle00|+\langle|11|)$$

I would like to find the operator for the bigger space. For example, if I have 4 qubits, and I fusion 2 and 3:

$$U = I^1 \otimes F_{ZZ}^{2,3} \otimes I^4$$

Clearly, U is collapsing the state from 4 qubits to 2 qubits.

Question: How can I build $$U$$ if the 2 fusion qubits are not neighbors? For example, qubits $$1$$ and $$3$$ or qubits $$2$$ and $$4$$ or $$1$$ and $$4$$. I want a very practical approach, where I can use $$U$$ to multiply any state $$Ux$$ without changing the internal order of $$x$$.

You can exploit the distributive law. For example, the operator projecting onto the even subspace of qubits $$1$$ and $$3$$ can be written as

$$\langle 0|_1\otimes I_2\otimes\langle 0|_3\otimes I_4+ \langle 1|_1\otimes I_2\otimes\langle 1|_3\otimes I_4\tag1$$

or more condensed

$$\sum_{k\in\{0,1\}}\langle k|_1\otimes I_2\otimes\langle k|_3\otimes I_4.\tag2$$

You can reduce clutter by making identity operators implicit

$$\langle 00|_{1,3}+\langle 11|_{1,3}.\tag3$$

Similarly for other pairs of qubits.

The slight awkwardness of the notation is a symptom of the limitations of the traditional one-dimensional notation for linear algebra. See tensor networks and ZX-calculus for alternatives that use two-dimensional diagrams.