diff --git a/learning/courses/quantum-computing-in-practice/utility-scale-qaoa.ipynb b/learning/courses/quantum-computing-in-practice/utility-scale-qaoa.ipynb index 989816e6cc30..7f82f2de245a 100644 --- a/learning/courses/quantum-computing-in-practice/utility-scale-qaoa.ipynb +++ b/learning/courses/quantum-computing-in-practice/utility-scale-qaoa.ipynb @@ -106,19 +106,61 @@ "As it turns out, we are in luck, because the QUBO problem is very closely related to, and actually computationally equivalent to, one of the most famous and ubiquitous Hamiltonians in physics: the Ising Hamiltonian.\n", "\n", "\n", - "In order to write the QUBO problem as the Ising Hamiltonian, all we actually need to do is do a simple change of variables:\n", + "In order to write the QUBO problem as the Ising Hamiltonian, all we actually need to do is do a simple change of variables from $x \\in \\{0, 1\\}^n$ to $z \\in \\{-1, 1\\}^n:\n", "\n", "$$\n", "x_i = \\frac{1-z_i}{2}.\n", "$$\n", "\n", - "We won't walk through all the steps here, but they are explained in the attached notebook. In the end, the minimization of the QUBO expression is the same as the minimization of this expression:\n", + "\n", + "\n", + "\n", + "First, note that we can rewrite our QUBO expression as the sum of matrix terms:\n", + "\n", + "$$\n", + "x^TQx = \\sum_{ij}Q_{ij}x_ix_j\n", + "$$\n", + "\n", + "Applying the change of variables yields\n", + "\n", + "$$\n", + "\\sum_{ij}Q_{ij}(\\frac{1-z_i}{2})(\\frac{1-z_j}{2}) = \\sum_{ij}\\frac{Q_{ij}}{4}(1 - z_i - z_j + z_iz_j)\n", + "$$\n", + "\n", + "which can be rearranged as follows.\n", + "\n", + "$$\n", + "\\sum_{ij}\\frac{Q_{ij}}{4}z_iz_j - \\frac{Q_{ij}}{4}z_i - \\frac{Q_{ij}}{4}z_j + \\frac{Q_{ij}}{4}\n", + "$$\n", + "\n", + "We can drop the constant term because it will not affect which $z$ minimizes the QUBO problem. Additionally, we can multiply this expression by four to recover the original value of $Q$, since this also doesn't affect the optimal choice of $z$.\n", + "\n", + "$$\n", + "\\sum_{ij}Q_{ij}z_iz_j - Q_{ij}z_i - Q_{ij}z_j = z^TQz + (-\\sum_{ij} Q_{ij}z_i + Q_{ij}z_j)\n", + "$$\n", + "\n", + "By grouping alike linear terms, we can define our linear coefficient vector $b$ using the equation\n", + "\n", + "$$\n", + "b_i = -\\sum_{j} Q_{ij} + Q_{ji}\n", + "$$\n", + "\n", + "which completes the transformation of variables to $z \\in \\{-1, 1\\}^n$ after substituting into the previous equation.\n", + "\n", + "$$\n", + "z^TQz + b^Tz\n", + "$$\n", + "\n", + "\n", + "\n", + "\n", + "In the end, the minimization of the QUBO expression is the same as the minimization of this expression, where $b$ is a real scalar coefficient:\n", "\n", "$$\n", "\\min_{x\\in\\{0,1\\}^n} x^TQx\\Longleftrightarrow \\min_{z\\in\\{-1,1\\}^n}z^TQz + b^Tz\n", "$$\n", "\n", - "Rewriting again slightly and we have our cost function Hamiltonian, where the minimum of the expression represents the ground state, `Z` is the Pauli Z operator, and $b$ is a real scalar coefficient:\n", + "Rewriting again slightly and we have our cost function Hamiltonian, where the minimum of the expression represents the ground state and `Z` is the Pauli Z operator:\n", "\n", "$$\n", "H_C=\\sum_{ij}Q_{ij}Z_iZ_j + \\sum_i b_i Z_i\n",