microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
427 stars 86 forks source link

Multi-Qubit Systems Kata exercise is wrong #773

Closed bdg221 closed 8 months ago

bdg221 commented 1 year ago

In Multi-Qubit Systems > Prepare a Superposition of Two Basis States, the solution is incorrect. The goal state of the system is:

image

However, this should be achieved by performing an X then H on qubit 0 since Big-ending is used. However, both the accepted correct solution and the "Show solution" use qubit 1: image

image

Trying to use qs[0] for the X and H gates result in the following: image

To verify my results, I ran the following: image and received confirmed my beliefs with the results: image image

As @tcNickolas mentioned in issue #763 This is an artifact of migration from the "old" QDK used in https://github.com/microsoft/QuantumKatas/ to the new QDK we're using on the website (see https://devblogs.microsoft.com/qsharp/introducing-the-azure-quantum-development-kit-preview/ for the announcement).

Again, I would be happy to correct this if you would like to assign this to me.

bdg221 commented 1 year ago

This same behavior applies to Prepare a Superposition with Real Amplitudes where the goal state is: image

While qs[0] should be used due to Big-endian, the accepted and and "Show solution" use qs[1]: image

image

The answer should be: image

bdg221 commented 1 year ago

As expected, this is also seen for the Prepare a Superposition with Complex Amplitudes where the goal state is: image

The accepted answer and "Show solution" use Little-endian: image

image

However, the real answer should use Big-endian since that is what is used by the new QDK: image

image

ScottCarda-MS commented 8 months ago

Thank you for reporting this! We've fixed this issue by rewording the descriptions to use little-endian format. We didn't want to change the code solutions because that would cause a breaking change to those people who had already solved the kata. Thanks for finding this!