I guess what you may need is the Pauli operators: https://qiskit.org/documentation/_modules/qiskit/quantum_info/operators/pauli.html https://www.sciencedirect.com/topics/engineering/pauli-operator