3

I'm trying to solve 2 linear equations with the help of HHL algorithm. I've taken $A=\begin{pmatrix} 1.5 & 0.5\\ 0.5 & 1.5\\ \end{pmatrix}$ and $b=\begin{pmatrix} 1\\ 0\\ \end{pmatrix}$. I've implemented the circuit here, on quirk.

Question

How do I get expectation value of Pauli matrices in the above circuit?

Omkar
  • 341
  • 1
  • 9

1 Answers1

6

To find the expectation value of a given Pauli matrix, you just measure in the basis defined by the Pauli matrix. For example, to evaluate the expectation value of the $X$ matrix, you find the basis vectors of the $X$ matrix. These are $|+\rangle$ and $|-\rangle$, with corresponding eigenvalues +1 and -1. You measure in the $|\pm\rangle$ basis many times and find the probability of getting either result, $p_\pm$. Then, finally, the expectation value is $p_+-p_-$ (the numbers multiplying the $p_{\pm}$ terms correspond to the eigenvalues).

DaftWullie
  • 62,671
  • 4
  • 55
  • 140