Purpose
Since I couldn't find a handy textbook on QAOA (Quantum Approximate Optimization Algorithm), I decided to take a look at the Qiskit textbook. In doing so, a formula appeared that was not quite self-evident, so the scope of this article is to prove it, partly to confirm that I haven't misread it in the first place.
What is QAOA?
It can be described as a quantum approximate optimization algorithm for the problem of finding a combination that minimizes a given cost function:
\begin{align*}
\argmax
\end{align*}_{x \in S} C(x)
Basically, you can just read the textbook in order, but since there was a difficult equation, I will provide a messy proof here.
Notation
-
n: A given natural number.
- [n] = \{1, \dots, n\}
-
Q \subset [n] refers to, for example, Q = \varnothing, Q = \{1\}, or Q = \{1, 2, 3, 5, 8, \dots\}.
- Identify the integer 0 \leq x \leq 2^{n-1} with its binary expansion x_1 x_2 \cdots x_n.
- $\ket{x} = \ket{x_1 x_2 \cdots x_n} = \ket{x_1} \otimes \ket{x_2} \otimes \cdots \otimes \ket{x_n}
Let the cost function in a binary combinatorial optimization problem be C, and for x \in \{0, 1\}^n, define it as:
\begin{align*}
\def\barQ{\overline{Q}}
C(x) = \sum_{(Q,\barQ) \subset [n]} w_{Q,\barQ} \prod_{i \in Q} x_i \prod_{j \in \barQ} (1-x_j)
\tag{1}
\end{align*}
Next, let the "Hamiltonian" be:
\begin{align*}
H = \sum_{x \in \{0, 1\}^n} C(x) \ket{x} \bra{x}
\tag{2}
\end{align*}
Then, it is stated that H is equal to (3), which is obtained by replacing x_i \to \frac{1-Z_i}{2} in equation (1):
\begin{align*}
\def\barQ{\overline{Q}}
\sum_{(Q,\barQ) \subset [n]} w_{Q,\barQ} \frac{1}{2^{|Q| + |\barQ|}} \prod_{i \in Q} (1-Z_i) \prod_{j \in \barQ} (1+Z_j)
\tag{3}
\end{align*}
Here, Z_i is the tensor product I \otimes \cdots \otimes Z \otimes \cdots \otimes I where the i-th position of I^{\otimes n} is Z.
By the way, noting that
\begin{align*}
\frac{1-Z_i}{2} &= I \otimes \cdots \otimes \frac{1-Z}{2} \otimes \cdots \otimes I = I \otimes \cdots \otimes \ket{1}\bra{1} \otimes \cdots \otimes I \\
\frac{1-Z_i}{2} &= I \otimes \cdots \otimes \frac{1+Z}{2} \otimes \cdots \otimes I = I \otimes \cdots \otimes \ket{0}\bra{0} \otimes \cdots \otimes I
\end{align*}
we should note that equation (3) can also be written as (3'):
\begin{align*}
\def\barQ{\overline{Q}}
\sum_{(Q,\barQ) \subset [n]} w_{Q,\barQ} \prod_{i \in Q} I \otimes \cdots \otimes \overbrace{\ket{1}\bra{1}}^i \otimes \cdots \otimes I \prod_{j \in \barQ} I \otimes \cdots \otimes \overbrace{\ket{0}\bra{0}}^j \otimes \cdots \otimes I
\tag{3'}
\end{align*}
To be shown
That equation (2) and equation (3) are equal.
Proof
Rewriting the problem
Substituting (1) into (2) and rearranging gives:
\begin{align*}
\def\barQ{\overline{Q}}
H = \sum_{(Q,\barQ) \subset [n]} w_{Q,\barQ} \left[ \sum_{x \in \{0, 1\}^n} \prod_{i \in Q} x_i \prod_{j \in \barQ} (1-x_j) \ket{x}\bra{x} \right]
\tag{4}
\end{align*}
Therefore, comparing this with equation (3'), what remains to be shown is the equivalence of the following (5) and (6) for any (Q,\overline{Q}) \subset [n].
\begin{align*}
\def\barQ{\overline{Q}}
\prod_{i \in Q} I \otimes \cdots \otimes \overbrace{\ket{1}\bra{1}}^i \otimes \cdots \otimes I \prod_{j \in \barQ} I \otimes \cdots \otimes \overbrace{\ket{0}\bra{0}}^j \otimes \cdots \otimes I
\tag{5}
\end{align*}
\begin{align*}
\def\barQ{\overline{Q}}
\sum_{x \in \{0, 1\}^n} \prod_{i \in Q} x_i \prod_{j \in \barQ} (1-x_j) \ket{x}\bra{x}
\tag{6}
\end{align*}
In the following, we assume Q and \overline{Q} are disjoint, i.e., Q \cap \overline{Q} = \varnothing. If this were not the case, there would exist some k \in Q \cap \overline{Q}, and we would find a term I \otimes \cdots \otimes \overbrace{\ket{1}\bra{1} \ket{0}\bra{0}}^k \otimes \cdots \otimes I in equation (5), and a term x_k (1-x_k) in equation (6). The former is trivially 0, and the latter is 0 for any x \in \{0, 1\}^n.
Looking at Equation (6) — Focusing on Diagonal Components
Looking closely at (6), for x \in \{0, 1\}^n, \ket{x}\bra{x} are mutually orthogonal projection operators, and since \sum_{x \in \{0, 1\}^n} \ket{x}\bra{x} = I, it takes the form of a spectral decomposition.
Take and fix an arbitrary y \in \{0, 1\}^n. At this time, the eigenvalue for the "eigenvector" \ket{y} is
\begin{align*}
\def\barQ{\overline{Q}}
\prod_{i \in Q} x_i \prod_{j \in \barQ} (1-x_j) \bigg|_{x=y}
\tag{7}
\end{align*}
Therefore, noting that both (5) and (6) are diagonal matrices, from equation (5), we should check that
\begin{align*}
\def\barQ{\overline{Q}}
\prod_{i \in Q} I \otimes \cdots \otimes \overbrace{\ket{1}\bra{1}}^i \otimes \cdots \otimes I \prod_{j \in \barQ} I \otimes \cdots \otimes \overbrace{\ket{0}\bra{0}}^j \otimes \cdots \otimes I \ket{y}
\tag{8}
\end{align*}
is equal to (7).
Looking at Equation (8)
\ket{y} = \ket{y_1} \otimes \cdots \otimes \ket{y_n}, and by letting Y_0 := \{i;\ \ket{y_i} = \ket{0} \} and Y_1 := \{j;\ \ket{y_j} = \ket{1} \}, we have [n] = Y_0 \sqcup Y_1 (disjoint union).
Looking closely at equation (7), it can be seen that:
\begin{align*}
= \begin{cases}
1,\quad Q \subset Y_1 \;\;\;\text{and} \;\;\; \overline{Q} \subset Y_0 \\
0,\quad \text{otherwise}
\end{cases}
\tag{9}
\end{align*}
Looking at equation (8) a bit more carefully, when y_k = 0, it results in 0 if k \in Q and 1 if k \not\in Q. Conversely, when y_k = 1, it results in 0 if k \in \overline{Q} and 1 if k \not\in \overline{Q}. In other words,
\begin{align*}
= \begin{cases}
1,\quad Q \cap Y_0 = \varnothing \;\;\;\text{and} \;\;\; \overline{Q} \cap Y_1 = \varnothing \\
0,\quad \text{otherwise}
\end{cases}
\tag{10}
\end{align*}
This holds, and it is easily seen to be equivalent to (9). Since the values 0 or 1 are determined by the same conditions, the values of equations (7) and (8) are equal.
Since \{\ket{y}\}_{y \in \{0, 1\}^n} spans \mathbb{C}^{2^n}, by considering their linear combinations, it is shown that equation (5) and equation (6) are equal. Therefore, the claim of the proposition is proven.
Summary
Actually, I didn't start with this derivation from the beginning; I began by manually calculating all cases of (Q,\overline{Q}) \subset [n] for n=1 and n=2 to confirm it holds.
I struggled for a long time unable to find a clever derivation, but while looking at Proving Universality in the Qiskit textbook, I realized, "Perhaps I should focus more on the action of individual single-qubit gates in the product representation on each qubit, rather than the properties of the massive matrix after calculating the tensor product..." This was the deciding factor.
Discussion