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
  • 331
  • 1
  • 9
  • 2
    Why do you want to find the expectation values of Pauli matrices in the HHL algorithm? Is that because you want to do a tomography of the state? Here is the link of my tutorial for the VQE algorithm where procedures for finding expectation values for X, Y, and Z Pauli matrices are described https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/variational_quantum_eigensolver.ipynb. – Davit Khachatryan Apr 01 '20 at 08:32
  • 2
    Here https://quantumcomputing.stackexchange.com/questions/9014/quantum-tomography-on-two-qubits you can find something on quantum tomography. – Martin Vesely Apr 01 '20 at 08:56

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
  • 57,689
  • 3
  • 46
  • 124