# Representation of rotation operators $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ about arbitrary axis for $3$ qubits

I was wondering in how to interpret and represent the operator $$e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$$ for a 3 qubit system in a circuit using qiskit.

I was thinking I could just perform an individual $$\theta$$ degree rotation about each qubit Z axis but what about the identity? $$e^{-i\theta I} = \begin{bmatrix} e^{-i \theta } & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ 0 & e^{-i\theta}& 0 & 0 & 0 & 0 & 0 & 0\\ 0 & 0 & e^{-i\theta} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & e^{-i\theta} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & e^{-i\theta} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 &e^{-i\theta} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 &e^{-i\theta} & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & e^{-i\theta} \end{bmatrix}$$

I can construct this operator with the identity operator in 2 qubits and one identity with a global phase $$e^{-i\theta}$$. Isn't this just an identity with a global phase factor?

We can't implement $$e^{iZ_1 \otimes Z_2 \otimes Z_3 \theta}$$ with three separate rotations. In other words:

$$e^{iZ_1 \otimes Z_2 \otimes Z_3 \theta} \ne e^{i Z_1 \theta} \otimes e^{i Z_2 \theta} \otimes e^{i Z_3 \theta}$$

The implementation of this gate can be found in this answer. The $$e^{-iI \otimes I \otimes I\theta} = e^{-i\theta} I \otimes I \otimes I$$ term is a global phase gate and can be ignored for the case described in the question.

An implementation with Qiskit:

from qiskit import *
from qiskit.aqua.operators import WeightedPauliOperator

theta = 1.7
pauli_dict = {'paulis': [{"coeff": {"imag": 0.0, "real": theta}, "label": "ZZZ"},
{"coeff": {"imag": 0.0, "real": -theta}, "label": "III"}
]
}
operator = WeightedPauliOperator.from_dict(pauli_dict)
circuit = operator.evolve(evo_time=1).decompose()
print(circuit)


The output:

q3_0: ──■─────────────────────────■──
┌─┴─┐                     ┌─┴─┐
q3_1: ┤ X ├──■───────────────■──┤ X ├
└───┘┌─┴─┐┌─────────┐┌─┴─┐└───┘
q3_2: ─────┤ X ├┤ U1(3.4) ├┤ X ├─────
└───┘└─────────┘└───┘


That coincides with the ideas discussed in this answer ($$u1$$ and $$R_z$$ gates are different just by a global phase). Note, that here $$e^{-iI\theta}$$ is a global phase and can be neglected (as was done in the circuit). However, as was discussed in this answer the controlled-$$e^{-i I \theta}$$ should be implemented if one needs to construct controlled-$$e^{-i H \theta}$$, where $$H$$ is a sum of tensor product terms of Pauli matrices with real coefficients (like $$H = I - Z\otimes Z\otimes Z$$ in the question's example) and one of the terms is $$I$$. Also, note that the code presented above works only for such $$H$$ whose terms commute. For more general cases one should also specify the rest of the arguments of the evolve method in order to implement for example first-order Trotter decomposition.

• Is there a place where i could read a bit more about the controlled versions that does implement I? I am constructing a circuit for a hamiltonian operatior composet of a sum of 8 terms (one is I, and the other seven are pauli matrix tensor products) Jun 22, 2020 at 0:27
• @CésarLeonardoClementeLópez, About the controlled-$e^{i I \theta}$ implementation can be found at the end of this answer or at the page 180, Figure 4.5. from M. Nielsen and I. Chuang textbook. Jun 22, 2020 at 6:13

You're right, that this factor can be separated as an operation that applies a global phase factor. Matrix exponentiation is distributive over an additive argument if and and only if the additive terms commute. The identity operator and the scalar $$-i\theta$$, which can incidentally be though of as a constant of the gate design, commute with all unitary gates. Hence, we can think of this as the application of two gates, $$e^{-i\theta I}$$ and $$e^{i\theta Z_1 Z_2 Z_3}$$, to the quantum register in either order of application, applied by successive left multiplication on the initial quantum register "ket" in this case, from rightmost term.

Further, a global phase factor does not change the expectation values of Hermitian observables. Hence, I can think of no physically measurable reason this factor need not be dropped entirely from the circuit, (except classical simulator bookkeeping).

However, if this operator is controlled by any number of control qubits, disjoint from the set enumerated by your $$Z_n$$ operators, then the application of the phase factor is logically conditioned on these control bits being "true." Since the phase factor wouldn't be applied to basis states where the control bits are "false," the phase factor would no longer be "global" in that case, (i.e. equal down the diagonal of the operator matrix,) and the phase factor then affects Hermitian expectation values, and it must be included. The phase factor still commutes with your $$Z_n$$ operators, though, so your matrix exponentiation still distributes.

• Just note that global phase gate $e^{i\theta I}$ is needed in controlled version of the gate. Jun 21, 2020 at 5:47
• can you elaborate a bit more on what the controlled version means? Jun 21, 2020 at 22:39
• If this operator is the payload of a gate with one or more control bits, then the scalar factor is no longer a global phase factor. In that case, this phase factor is only applied if the control bits are set, and that can have a physically measurable effect, in superposition of the control bits. Jun 22, 2020 at 20:23
• Do you know of any online examples I could refer to? I am a bit confused to what you mean to payload of a gate Jul 8, 2020 at 20:35
• Take the matrix form of CNOT, a 4x4 complex matrix that's like a Pauli X gate on the target qubit when the control qubit is |1>, and the identity operator on the target qubit when the control qubit is |0>. Call the Pauli X-like part a "payload," acted only if the control bit is |1>, otherwise acting the identity operator for |0> control. The resemblance to Pauli X isn't superficial; this bifurcation of "payload" and identity over control bits is common to any abstract "controlled gate." Your phase factor is not "global" with this bifurcation. (en.wikipedia.org/wiki/Controlled_NOT_gate) Jul 9, 2020 at 22:10