# How to do rotations along arbitrary multi-qubit basis

I was trying to implement Trotterization for a $$k$$-local Hamiltonian simulation using qiskit. For this, say I want to apply $$e^{\lambda \sigma^1_z \otimes \sigma^2_z \otimes \sigma^3_z}$$ (this being the 3-local case)

qiskit has support for rotations such as RXX, RYY, RZX, and so on that would be useful to apply the 2-local gates.

How do I generalize this to a higher number of local interactions without using ancilla qubits? (this answer is with an extra qubit)

Just in case I checked the source code of qiskit for RZZ, but it seems to be hardcoded without any general form.

Is there a way to construct this, or is there something inbuilt in qiskit that I'm missing?

One way to do that is by using PauliEvolutionGate:

from qiskit.circuit.library import PauliEvolutionGate
from qiskit.opflow import Z

op = Z^Z^Z
_time = 1.0

# For the parameterized version:
# _time = Parameter('λ')

_gate = PauliEvolutionGate(op, time = _time, synthesis = None)

circ = QuantumCircuit(3)
circ.append(_gate, [0, 1, 2])


The third parameter passed to PauliEvolutionGate constructor, synthesis, can be used to specify the synthesis strategy.

By default it uses Lie-Trotter product formula (LieTrotter class). Higher order Suzuki-Trotter product formula (SuzukiTrotter class) and matrix exponentiation (MatrixExponential class) can also be used.