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.


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


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).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.