# Getting a numeric result from the variational quantum eigensolver

I am confused about how the VQE is able to print out a decimal number for the ground state energy of a molecule.

For example, for $$\text{LiH}$$, the ground state energy I get for an interatomic distance of $$1.5$$ was $$-7.88210$$. What I know is that after a quantum algorithm, it measures the qubit state, and therefore, it would read the state $$|0\rangle$$ or $$|1\rangle$$ from a qubit.

So I would like to know how does by measuring a qubit state of $$|1\rangle$$ or $$|0\rangle$$ turns into a decimal number to represent a ground state energy?

For example, suppose your observable is $$Y_0 X_1$$. Then the eigenvalues corresponding to the four possible outcomes $$[00, 01, 10, 11]$$ are $$[1, -1, -1, 1]$$ respectively.
$$[11, 00, 00, 01, 10, 10, 11, 11, 00, 00]$$
Plugging in the eigenvalues and taking the average gives the expectation estimate $$\langle Y_0 X_1 \rangle \approx \frac{1 + 1 + 1 - 1 - 1 - 1 + 1 + 1 + 1 + 1}{10} = 0.4$$