# How to create a quantum circuit to implement the same operations but acting on different qubits?

I want the draw the quantum circuit of the following Hamiltonian: $$H = - 4 \times X\otimes X\otimes X\otimes X - 4\times Z\otimes Z\otimes Z \otimes Z$$. I have been able to draw the circuits of $$- X\otimes X\otimes X\otimes X$$ and $$- Z\otimes Z\otimes Z \otimes Z$$. But adding them up using qiskit functions like compose, and combine did not give me the matrix I am looking for.

I would like to recall that when looking at $$4 \times X\otimes X\otimes X\otimes X$$ for instance, the operator $$X\otimes X\otimes X\otimes X$$ will be applied $$4$$ times but not on the same set of qubits and the matrix should $$16\times 16$$. Using compose and combine function, I still obtain the $$16\times 16$$ matrix by its components do not add up. Instead, the gates acted on the same set of qubits.

It will be very helpful if someone can help me. Thanks

• Can I suggest you switch notation? It might help make it clearly what you're asking for. For example, let $X_2$ be $I\otimes X\otimes I\otimes I\otimes\ldots\otimes I$, so you can write things like $X_1X_2X_3X_4$ as the operator you're talking about on the first 4 qubits. Now, what do you really mean by $4\times X\otimes X\otimes X\otimes X$? Commented Oct 6, 2021 at 8:37
• Yeah. But the $x_i$ are the same. There are x-Pauli matrices. The initial form of the Hamiltonian is $H = -\sum_v As - \sum_p Bp$ where $As = X\otimes ^4$ and $Bp = Z\otimes^4$. In my case, The sum contains 4 elements for both operator. Commented Oct 6, 2021 at 8:46
• Yes, but, as I understand it, the sets of 4 qubits are different for each term. This is the crucial thing that's missing from the question, and (I suspect) in what you're telling qiskit to do. Commented Oct 6, 2021 at 9:47
• The sets of the 4 qubits are differents. That is true. While applying the operators As and Bp on them, the circuit of each will be the same I think. My concern is how to add up all the circuits without using combine and compose functions Commented Oct 6, 2021 at 10:11
• Are you doing a Toric code(surface code) implementation? If so, you can check this answer: entangledquery.com/t/surface-code-implementation/23 Commented Oct 15, 2021 at 23:55