I am learning how to use Qiskit's controlled Pauli gates. For example, I can create a simple three-qubit circuit containing controlled Pauli-XX and -ZZ gates using the code:
import numpy as np import qiskit as qk from qiskit.quantum_info import PauliList, Operator circuit = qk.QuantumCircuit(qk.QuantumRegister(3)) Ulist = [f.to_instruction() for f in PauliList(['XX','ZZ'])] circuit.append(Ulist[0].control(1, ctrl_state=1), [2,1,0]) # circuit.append(Ulist[1].control(1, ctrl_state=1), [2,1,0]) circuit.draw(output='mpl') How do I derive the 8x8 matrix operation of these controlled Pauli gates? I'm aware that Qiskit's functions can tell me the form of these matrices:
circOp = Operator.from_circuit(circuit) circOp.draw("latex") but I want to use a handwritten analytical method.

