Stuck with H.5.2

I am having a hard time to solve the codercise H.5.2. This is what I have so far:

Could someone give me a hint? :slight_smile:

Hi @Qimi,

it looks like you have the right idea but have mixed up the order of operations. If you translate Equation (6) in H.5 to the Hamiltonian of the problem, you can see that the cross-term (the one with X_{0} X_{1}) should act on the state first.

In other words, if you have a sequence of operations U_{3} U_{2} U_{1}, the operation on the right (U_{1}) will act on the state first, followed by U_{2} and then U_{3}. Remember that in PennyLane, the first gate in the circuit is the first one that acts on the state.

Your solution has the cross-term of the Hamiltonian acting on the state last so you are implicitly assuming that U_{3} U_{2} U_{1} = U_{1} U_{2} U_{3} which is not generally true.

Let me know if that helps!

@DanielNino27 Thank you! I could solve the codercise with your hint.

1 Like

My pleasure @Qimi ! Glad to see you are continuing to make progress!