1
$\begingroup$

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') 

circuit

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") 

paulis

but I want to use a handwritten analytical method.

$\endgroup$

1 Answer 1

1
$\begingroup$

but I want to use a handwritten analytical method.

I see.

So this answer is going to based off of Perry and DaftWullie's answers to a question for constructing the CNOT gate. Check out their answers if you want to see their explanations (it's much better than mine).

To create a CXX gate we again see that we only have one control and we are simply applying the $X$ or $\mathbb{I}$ to two qubits instead of one. Taking these projectors: $$P_0=|0\rangle\langle 0|\equiv\left(\begin{array}{cc} 1 & 0 \\ 0 & 0 \end{array}\right)\qquad P_1=|1\rangle\langle 1|\equiv\left(\begin{array}{cc} 0 & 0 \\ 0 & 1 \end{array}\right)$$

which essentially work by only returning their respective state when multiplied by some other state. Ex: The projector multiped with $|0\rangle$ $$\left(\begin{array}{cc} 1 & 0 \\ 0 & 0 \end{array}\right)\left(\begin{array}{cc} 1 \\ 0 \end{array}\right) \equiv \left(\begin{array}{cc} 1 \\ 0 \end{array}\right)$$ while as multipyling by any other state besides $|0\rangle$ gives $\left(\begin{array}{cc} 0 \\ 0 \end{array}\right)$. (You can check this yourself). And so $P_0 \otimes \mathbb{I}$ achieves the "If the first qubit is $|0\rangle$ leave the second qubit alone". And $P_1 \otimes \mathbb{X}$ achieves the flipping of the qubit if the control is $|1\rangle$. So we can write the CXX as

$$CXX=P_0\otimes\mathbb{I}\otimes\mathbb{I}+P_1\otimes X\otimes X.$$ Using the code from Perry's answer and modifying it for the CXX gate we have: CXX = np.kron(np.kron(zero_matrix, np.eye(2)), np.eye(2)) + np.kron(np.kron(one_matrix, qudot.X.matrix), qudot.X.matrix) which gives us the Pauli-XX matrix you were looking for.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.