Hello,
I have a question about measuring expected values using PauliZ in a quantum computing context (as shown above). Here’s an example of the code:
return [qml.expval(qml.PauliZ(i)) for i in range(2)]
In this case, we are measuring the expected values for each qubit. I want to understand the theory behind this measurement. Is the calculation or math behind it as follows?
- For Qubit 1: ⟨ψ|(Z ⊗ I)|ψ⟩
- For Qubit 2: ⟨ψ|(I ⊗ Z)|ψ⟩
Additionally, I have seen ⟨ψ|(Z ⊗ Z)|ψ⟩ as a solution in some cases. My understanding is that this provides only one expectation value, whereas the code above generates two values for two qubits. Could you clarify this for me?