From a5207583866055fc87be1af153f8991d14454734 Mon Sep 17 00:00:00 2001 From: Matti Sarjala Date: Thu, 14 May 2026 02:33:02 +0300 Subject: [PATCH] Fix Pauli-basis expansion normalization --- docs/guides/specify-observables-pauli.ipynb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/guides/specify-observables-pauli.ipynb b/docs/guides/specify-observables-pauli.ipynb index d65aefa5415..440a0b3c5e8 100644 --- a/docs/guides/specify-observables-pauli.ipynb +++ b/docs/guides/specify-observables-pauli.ipynb @@ -147,10 +147,13 @@ "We expand the observable $O$ as\n", "\n", "$$\n", - "O = \\sum_{P \\in \\{I, X, Y, Z\\}^{\\otimes n}} \\mathrm{Tr}(O P) P,\n", + "O =\n", + "\\frac{1}{2^n}\n", + "\\sum_{P \\in \\{I, X, Y, Z\\}^{\\otimes n}}\n", + "\\mathrm{Tr}(O P) P,\n", "$$\n", "\n", - "where the sum runs over all possible $n$-qubit Pauli terms and $\\mathrm{Tr}(\\cdot)$ is the trace of a matrix, which acts as inner product.\n", + "where the sum runs over all possible $n$-qubit Pauli terms and $\\mathrm{Tr}(\\cdot)$ is the trace of a matrix, which acts as an inner product. The factor $1/2^n$ accounts for the Hilbert--Schmidt normalization of $n$-qubit Pauli strings.\n", "You can implement this decomposition from a matrix to Pauli terms using the `SparsePauliOp.from_operator` method, like so:" ] },