From f354f54470cef61b184686a396435b377bca3849 Mon Sep 17 00:00:00 2001 From: Sonia Lopez <74979440+SoniaLopezBravo@users.noreply.github.com> Date: Wed, 14 Aug 2024 00:27:30 +0200 Subject: [PATCH] Katas UI review - Multiqubit systems (#1813) Co-authored-by: Mariia Mykhailova Co-authored-by: Scott Carda <55811729+ScottCarda-MS@users.noreply.github.com> --- katas/content/deutsch_algo/index.md | 6 ++- katas/content/deutsch_jozsa/index.md | 8 ++-- katas/content/grovers_search/index.md | 1 + .../bell_state_change_1/solution.md | 12 ++--- .../bell_state_change_2/solution.md | 6 +-- .../bell_state_change_3/solution.md | 8 ++-- katas/content/multi_qubit_systems/index.md | 46 ++++++++++--------- .../learn_basis_state_amplitudes/index.md | 2 +- .../prepare_basis_state/solution.md | 2 +- .../prepare_superposition/solution.md | 8 ++-- .../prepare_with_complex/solution.md | 8 ++-- .../prepare_with_real/solution.md | 6 +-- katas/content/oracles/index.md | 6 ++- katas/content/qec_shor/index.md | 6 ++- katas/content/qubit/index.md | 6 ++- katas/content/random_numbers/index.md | 4 +- 16 files changed, 74 insertions(+), 61 deletions(-) diff --git a/katas/content/deutsch_algo/index.md b/katas/content/deutsch_algo/index.md index dec960f0e6..6817daa1e3 100644 --- a/katas/content/deutsch_algo/index.md +++ b/katas/content/deutsch_algo/index.md @@ -16,8 +16,10 @@ This kata introduces you to Deutsch algorithm - the single-qubit variant of Deut **What you should know to start working on this kata:** -- Basic knowledge of single-qubit gates -- Basic knowledge of quantum measurements +- Basic single-qubit gates +- Quantum measurements + +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "deutsch_algo__problem", diff --git a/katas/content/deutsch_jozsa/index.md b/katas/content/deutsch_jozsa/index.md index b53cc8d8bb..bbeeb7a933 100644 --- a/katas/content/deutsch_jozsa/index.md +++ b/katas/content/deutsch_jozsa/index.md @@ -17,9 +17,11 @@ This kata introduces you to Deutsch-Jozsa algorithm - one of the most famous alg **What you should know to start working on this kata:** -- Basic knowledge of single-qubit gates -- Basic knowledge of quantum measurements -- Deutsch algorithm - the single-qubit variant of Deutsch-Jozsa algorithm. If you're not familiar with it, you can find it in the Deutsch algorithm kata. +- Basic single-qubit gates +- Quantum measurements +- Deutsch algorithm - the single-qubit variant of Deutsch-Jozsa algorithm. + +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "deutsch_jozsa__problem", diff --git a/katas/content/grovers_search/index.md b/katas/content/grovers_search/index.md index c4bb82b654..6aa668aadd 100644 --- a/katas/content/grovers_search/index.md +++ b/katas/content/grovers_search/index.md @@ -20,6 +20,7 @@ Note that this tutorial does not cover implementing specific classical functions - Basic knowledge of quantum gates and measurements - Basic understanding of quantum oracles +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "grovers_search__search_problem", diff --git a/katas/content/multi_qubit_systems/bell_state_change_1/solution.md b/katas/content/multi_qubit_systems/bell_state_change_1/solution.md index ccfe6b0d58..f063d9967d 100644 --- a/katas/content/multi_qubit_systems/bell_state_change_1/solution.md +++ b/katas/content/multi_qubit_systems/bell_state_change_1/solution.md @@ -1,15 +1,15 @@ -We recognize that the goal is another Bell state. In fact, it is one of the four Bell states. +You recognize that the goal is another Bell state. In fact, it is one of the four Bell states. -We remember from the Single-Qubit Gates kata that the Pauli Z gate will change the state of the $\ket{1}$ basis state of a single qubit, so this gate seems like a good candidate for what we want to achieve. This gate leaves the sign of the $\ket{0}$ basis state of a superposition unchanged, but flips the sign of the $\ket{1}$ basis state of the superposition. +You have seen in the Single-Qubit Gates kata that the Pauli Z gate will change the state of the $\ket{1}$ basis state of a single qubit, so this gate seems like a good candidate for what you want to achieve. This gate leaves the sign of the $\ket{0}$ basis state of a superposition unchanged, but flips the sign of the $\ket{1}$ basis state of the superposition. -Don't forget that the Z gate acts on only a single qubit, and we have two here. +Don't forget that the $Z$ gate acts on only a single qubit, and you have two here. Let's also remember how the Bell state is made up from its individual qubits. -If the two qubits are A and B, where A is `qs[0]` and B is `qs[1]`, we can write that +If the two qubits are A and B, where A is `qs[0]` and B is `qs[1]`, you can write that $\ket{\Phi^{+}} = \frac{1}{\sqrt{2}} \big(\ket{0_{A}0_{B}} + \ket{1_{A}1_{B}}\big)$. -If we apply the Z gate to the qubit A, it will flip the phase of the basis state $\ket{1_A}$. As this phase is in a sense spread across the entangled state, with $\ket{1_A}$ basis state being part of the second half of the superposition, this application has the effect of flipping the sign of the whole basis state $\ket{1_A1_B}$, as you can see by running the solution below. +If you apply the $Z$ gate to the qubit A, it will flip the phase of the basis state $\ket{1_A}$. As this phase is in a sense spread across the entangled state, with $\ket{1_A}$ basis state being part of the second half of the superposition, this application has the effect of flipping the sign of the whole basis state $\ket{1_A1_B}$, as you can see by running the solution below. -The exact same calculations can be done if we apply Z to the qubit B, so that's another possible solution. +The exact same calculations can be done if you apply $Z$ to the qubit B, so that's another possible solution. @[solution]({ "id": "multi_qubit_systems__bell_state_change_1_solution", "codePath": "Solution.qs" diff --git a/katas/content/multi_qubit_systems/bell_state_change_2/solution.md b/katas/content/multi_qubit_systems/bell_state_change_2/solution.md index 5fee5a50c8..387e63385d 100644 --- a/katas/content/multi_qubit_systems/bell_state_change_2/solution.md +++ b/katas/content/multi_qubit_systems/bell_state_change_2/solution.md @@ -1,8 +1,8 @@ -We have seen in the Single-Qubit Gates kata that the Pauli X gate flips $\ket{0}$ to $\ket{1}$ and vice versa, and as we seem to need some flipping of states, perhaps this gate may be of use. (Bearing in mind, of course, that the X gate operates on a single qubit). +You have seen in the Single-Qubit Gates kata that the Pauli X gate flips $\ket{0}$ to $\ket{1}$ and vice versa, and as you seem to need some flipping of states, perhaps this gate may be of use. (Bearing in mind, of course, that the $X$ gate operates on a single qubit). -Let's compare the starting state $\frac{1}{\sqrt{2}} \big(\ket{0_A0_B} + \ket{1_A1_B}\big)$ with the goal state $\frac{1}{\sqrt{2}} \big(\ket{1_A0_B} + \ket{0_A1_B}\big)$ term by term and see how we need to transform it to reach the goal. +Let's compare the starting state $\frac{1}{\sqrt{2}} \big(\ket{0_A0_B} + \ket{1_A1_B}\big)$ with the goal state $\frac{1}{\sqrt{2}} \big(\ket{1_A0_B} + \ket{0_A1_B}\big)$ term by term and see how you need to transform it to reach the goal. -Using our nomenclature from "Bell state change 1", we can now see by comparing terms that $\ket{0_{A}}$ has flipped to $\ket{1_A}$ to get the first term, and $\ket{1_{A}}$ has flipped to $\ket{0_A}$ to get the second term. This allows us to say that the correct gate to use is Pauli X, applied to `qs[0]`. +Using the nomenclature from "Bell state change 1", you can now see by comparing terms that $\ket{0_{A}}$ has flipped to $\ket{1_A}$ to get the first term, and $\ket{1_{A}}$ has flipped to $\ket{0_A}$ to get the second term. This allows you to say that the correct gate to use is Pauli X, applied to `qs[0]`. @[solution]({ "id": "multi_qubit_systems__bell_state_change_2_solution", diff --git a/katas/content/multi_qubit_systems/bell_state_change_3/solution.md b/katas/content/multi_qubit_systems/bell_state_change_3/solution.md index 55b1e001c7..1caa360ff1 100644 --- a/katas/content/multi_qubit_systems/bell_state_change_3/solution.md +++ b/katas/content/multi_qubit_systems/bell_state_change_3/solution.md @@ -1,9 +1,9 @@ -We remember from the Single-Qubit Gates kata that the Pauli Z gate leaves the sign of the $\ket{0}$ component of the single qubit superposition unchanged but flips the sign of the $\ket{1}$ component of the superposition. We have also just seen in "Bell State Change 2" how to change our input state to the state $\frac{1}{\sqrt{2}} \big(\ket{01} + \ket{10}\big)$, which is almost our goal state (disregarding the phase change for the moment). So it would seem that a combination of these two gates will be what we need here. The remaining question is in what order to apply them, and to which qubit. +You have seen in the Single-Qubit Gates kata that the Pauli Z gate leaves the sign of the $\ket{0}$ component of the single qubit superposition unchanged but flips the sign of the $\ket{1}$ component of the superposition. You have also just seen in "Bell State Change 2" how to change our input state to the state $\frac{1}{\sqrt{2}} \big(\ket{01} + \ket{10}\big)$, which is almost your goal state (disregarding the phase change for the moment). So it would seem that a combination of these two gates will be what you need here. The remaining question is in what order to apply them, and to which qubit. -First of all, which qubit? Looking back at the task "Bell state change 2", it seems clear that we need to use qubit `qs[0]`, like we did there. +First of all, which qubit? Looking back at the task "Bell state change 2", it seems clear that you need to use qubit `qs[0]`, like you did there. -Second, in what order should we apply the gates? Remember that the Pauli Z gate flips the phase of the $\ket{1}$ component of the superposition and leaves the $\ket{0}$ component alone. -Let's experiment with applying X to `qs[0]` first. Looking at our "halfway answer" state $\frac{1}{\sqrt{2}} \big(\ket{01} + \ket{10}\big)$, we can see that if we apply the Z gate to `qs[0]`, it will leave the $\ket{0_{A}}$ alone but flip the phase of $\ket{1_{A}}$ to $-\ket{1_{A}}$, thus flipping the phase of the $\ket{11}$ component of our Bell state. +Second, in what order should you apply the gates? Remember that the Pauli Z gate flips the phase of the $\ket{1}$ component of the superposition and leaves the $\ket{0}$ component alone. +Let's experiment with applying $X$ gate to `qs[0]` first. Looking at our "halfway answer" state $\frac{1}{\sqrt{2}} \big(\ket{01} + \ket{10}\big)$, you can see that if you apply the $Z$ gate to `qs[0]`, it'll leave the $\ket{0_{A}}$ alone but flip the phase of $\ket{1_{A}}$ to $-\ket{1_{A}}$, thus flipping the phase of the $\ket{11}$ component of our Bell state. @[solution]({ "id": "multi_qubit_systems__bell_state_change_3_solution", diff --git a/katas/content/multi_qubit_systems/index.md b/katas/content/multi_qubit_systems/index.md index e487e1d165..1ff8236008 100644 --- a/katas/content/multi_qubit_systems/index.md +++ b/katas/content/multi_qubit_systems/index.md @@ -20,12 +20,14 @@ If you are not familiar with single-qubit systems, we recommend that you complet - Basic single-qubit gates - The concept of tensor product +If you need a refresher on these topics, you can check out the previous katas. + @[section]({ "id": "multi_qubit_systems__introduction", "title": "Multi-Qubit Systems" }) -In The Qubit kata we discussed the concept of a qubit - the basic building block of a quantum computer. +The Qubit kata discussed the concept of a qubit - the basic building block of a quantum computer. A multi-qubit system is a collection of multiple qubits, treated as a single system. Let's start by examining a system of two classical bits. Each bit can be in two states: $0$ and $1$. Therefore, a system of two bits can be in four different states: $00$, $01$, $10$, and $11$. Generally, a system of $N$ classical bits can be in any of the $2^N$ states. @@ -47,7 +49,7 @@ $$\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}, \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix}, \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}$$ -It is easy to see that these vectors form an orthonormal basis. Note that each of these basis states can be represented as a tensor product of some combination of single-qubit basis states: +It's easy to see that these vectors form an orthonormal basis. Note that each of these basis states can be represented as a tensor product of some combination of single-qubit basis states: @@ -78,14 +80,14 @@ The coefficients of the basis vectors define how "close" is the system state to \frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \\ 1 \\ 0 \end{bmatrix}, \frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \\ -1 \\ 0 \end{bmatrix}$$ > -> You can check that these vectors are normalized, and orthogonal to each other, and that any two-qubit state can be expressed as a linear combination of these vectors. The vectors of Bell basis, however, can not be represented as tensor products of single-qubit basis states. +> You can check that these vectors are normalized, and orthogonal to each other, and that any two-qubit state can be expressed as a linear combination of these vectors. The vectors of Bell basis, however, can't be represented as tensor products of single-qubit basis states. @[section]({ "id": "multi_qubit_systems__separable_states", "title": "Separable States" }) -Sometimes the global state of a multi-qubit system can be separated into the states of individual qubits or subsystems. To do this, you would express the vector state of the global system as a tensor product of the vectors representing each individual qubit/subsystem. Here is an example of a two-qubit state: +Sometimes the global state of a multi-qubit system can be separated into the states of individual qubits or subsystems. To do this, you express the vector state of the global system as a tensor product of the vectors representing each individual qubit/subsystem. Here is an example of a two-qubit state: $$ \begin{bmatrix} \frac{1}{\sqrt{2}} \\ 0 \\ \frac{1}{\sqrt{2}} \\ 0 \end{bmatrix} = @@ -104,14 +106,14 @@ $$
Solution -To separate the state into a tensor product of two single-qubit states, we need to represent it in the following way: +To separate the state into a tensor product of two single-qubit states, you need to represent it in the following way: $$ \begin{bmatrix} \alpha \gamma \\ \alpha \delta \\ \beta \gamma \\ \beta \delta \end{bmatrix} = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} \otimes \begin{bmatrix} \gamma \\ \delta \end{bmatrix} $$ -This brings us to a system of equations: +This brings you to a system of equations: $$ \begin{cases} @@ -119,7 +121,7 @@ $$ \end{cases} $$ -Solving this system of equations gives us the answer: +Solving this system of equations gives the answer: $$\alpha = \frac{1}{\sqrt2}, \beta = \frac{-i}{\sqrt2}, \gamma = \frac{1}{\sqrt2}, \delta = \frac{i}{\sqrt2}$$ @@ -128,7 +130,7 @@ $$ \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ -i \end{bmatrix} \otimes \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ i \end{bmatrix} $$ -Note that finding such representation is not always possible, as you will see in the next exercise. +Note that finding such representation isn't always possible, as you'll see in the next exercise.
## 🔎 Analyze @@ -139,7 +141,7 @@ $$\frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ 0 \\ 0 \\ 1 \end{bmatrix}$$
Solution -Let's assume that this state is separable and write down the system of equations to determine the coefficients of individual qubit states in the tensor product, similar to what we did in the previous exercise: +Let's assume that this state is separable and write down the system of equations to determine the coefficients of individual qubit states in the tensor product, similar to what you did in the previous exercise: $$ \begin{cases} @@ -155,7 +157,7 @@ $$ \end{cases} $$ -We can see that this system of equations doesn't have a solution, which means that this state is not separable. +You can see that this system of equations doesn't have a solution, which means that this state is not separable.
@[section]({ @@ -163,7 +165,7 @@ We can see that this system of equations doesn't have a solution, which means th "title": "Entanglement" }) -Sometimes, quantum states cannot be written as individual qubit states. Quantum systems that are not separable are called **entangled** systems. If a state can be written as the product state of the individual subsystems, that state is not entangled. +Sometimes, quantum states can't be written as individual qubit states. Quantum systems that aren't separable are called **entangled** systems. If a state can be written as the product state of the individual subsystems, that state isn't entangled. Entanglement is a quantum correlation, which is very different from classical correlations. In entanglement, the state of the subsystems isn't determined, and you can talk only about the probabilities associated with the outcomes. The global system must be considered as one. @@ -186,7 +188,7 @@ This property is used extensively in many quantum algorithms. Just like with single qubits, Dirac notation provides a useful shorthand for writing down states of multi-qubit systems. -As we've seen earlier, multi-qubit systems have their own canonical bases, and the basis states can be represented as tensor products of single-qubit basis states. Any multi-qubit system can be represented as a linear combination of these basis states: +As you've seen earlier, multi-qubit systems have their own canonical bases, and the basis states can be represented as tensor products of single-qubit basis states. Any multi-qubit system can be represented as a linear combination of these basis states: $$ \begin{bmatrix} x_0 \\ x_1 \\ x_2 \\ x_3 \end{bmatrix} = @@ -215,14 +217,14 @@ Or, more generally: $$\ket{i_0} \otimes \ket{i_1} \otimes \dotsb \otimes \ket{i_n} = \ket{i_0i_1...i_n}$$ -Using this notation simplifies our example: +Using this notation simplifies the example: $$ \begin{bmatrix} x_0 \\ x_1 \\ x_2 \\ x_3 \end{bmatrix} = x_0\ket{00} + x_1\ket{01} + x_2\ket{10} + x_3\ket{11} $$ -Just like with single qubits, we can put arbitrary symbols within the kets the same way variables are used in algebra. +Just like with single qubits, you can put arbitrary symbols within the kets the same way variables are used in algebra. Whether a ket represents a single qubit or an entire system depends on the context. Some ket symbols have a commonly accepted usage, such as the symbols for the Bell basis: @@ -233,7 +235,7 @@ $$\ket{\Psi^-} = \frac{1}{\sqrt{2}}\big(\ket{01} - \ket{10}\big)$$ >## Endianness > -> In classical computing, endianness refers to the order of bits (or bytes) when representing numbers in binary. You're probably familiar with the typical way of writing numbers in binary: $0 = 0_2$, $1 = 1_2$, $2 = 10_2$, $3 = 11_2$, $4 = 100_2$, $5 = 101_2$, $6 = 110_2$, etc. This is known as **big-endian format**. In big-endian format, the *most significant* bits come first. For example: $110_2 = 1 \cdot 4 + 1 \cdot 2 + 0 \cdot 1 = 4 + 2 = 6$. +> In classical computing, *endianness* refers to the order of bits (or bytes) when representing numbers in binary. You're probably familiar with the typical way of writing numbers in binary: $0 = 0_2$, $1 = 1_2$, $2 = 10_2$, $3 = 11_2$, $4 = 100_2$, $5 = 101_2$, $6 = 110_2$, etc. This is known as **big-endian format**. In big-endian format, the *most significant* bits come first. For example: $110_2 = 1 \cdot 4 + 1 \cdot 2 + 0 \cdot 1 = 4 + 2 = 6$. > > There is an alternate way of writing binary numbers - **little-endian format**. In little-endian format, the *least significant* bits come first. For example, $2$ would be written as $01$, $4$ as $001$, and $6$ as $011$. To put it another way, in little endian format, the number is written backwards compared to the big-endian format. > @@ -294,15 +296,15 @@ to the first element of the array.) @[example]({"id": "multi_qubit_systems__multi_qubit_systems_demo", "codePath": "./examples/MultiQubitSystems.qs"}) -> You might have noticed that we've been "resetting" the qubits at the end of our demos, that is, returning them to $\ket{0}$ state. Q# requires you to return your qubits into the $\ket{0}$ state before they are released at the end of their scope. +> You might have noticed that every demo has been "resetting" the qubits at the end of the code, that is, returning them to $\ket{0}$ state. Q# requires you to return your qubits into the $\ket{0}$ state before they are released at the end of their scope. > The reason for this is entanglement. > > Consider running a program on a quantum computer: the number of qubits is very limited, and you want to reuse the released qubits in other parts of the program. -If they are not in zero state by that time, they can potentially be still entangled with the qubits which are not yet released, thus operations you perform on them can affect the state of other parts of the program, causing erroneous and hard to debug behavior. +If they aren't in zero state by that time, they can potentially be still entangled with the qubits which aren't yet released, thus operations you perform on them can affect the state of other parts of the program, causing erroneous and hard to debug behavior. > > Resetting the qubits to zero state automatically when they go outside the scope of the block they were allocated in is dangerous as well: if they were entangled with others, measuring them to reset them can affect the state of the unreleased qubits, and thus change the results of the program - without the developer noticing this. > -> The requirement that the qubits should be in zero state before they can be released aims to remind the developer to double-check that all necessary information has been properly extracted from the qubits, and that they are not entangled with unreleased qubits any more. +> The requirement that the qubits should be in zero state before they can be released aims to remind the developer to double-check that all necessary information has been properly extracted from the qubits, and that they aren't entangled with unreleased qubits any more. @[exercise]({ "id": "multi_qubit_systems__learn_basis_state_amplitudes", @@ -315,8 +317,8 @@ If they are not in zero state by that time, they can potentially be still entang "title": "Separable State Preparation" }) -In the following exercises you will learn to prepare separable quantum states by manipulating individual qubits. -You will only need knowledge from the Single-Qubit Gates kata for that. +In the following exercises you'll learn to prepare separable quantum states by manipulating individual qubits. +You'll only need knowledge from the Single-Qubit Gates kata for that. > In each exercise, you'll be given an array of qubits to manipulate; you can access the $i$-th element of the array `qs` as `qs[i]`. Array elements are indexed starting with 0, the first array element corresponds to the leftmost qubit in Dirac notation. @@ -350,7 +352,7 @@ Array elements are indexed starting with 0, the first array element corresponds "title": "Modifying Entangled States" }) -Entangled quantum states can be manipulated using single-qubit gates. For example, each state in the Bell basis is entangled and can be transformed into another Bell state through the application of single-qubit gates. In this lesson, you'll learn how to do that. (And we will learn more about applying single-qubit gates to multi-qubit states in the next kata.) +Entangled quantum states can be manipulated using single-qubit gates. For example, each state in the Bell basis is entangled and can be transformed into another Bell state through the application of single-qubit gates. In this lesson, you'll learn how to do that (and you'll learn more about applying single-qubit gates to multi-qubit states in the next kata). @[exercise]({ "id": "multi_qubit_systems__bell_state_change_1 ", @@ -381,4 +383,4 @@ Congratulations! In this kata you learned to prepare separable multi-qubit state - Any two-qubit system can be expressed as some linear combination of the tensor products of single-qubit basis states. - Two qubits are entangled if their states are correlated and if they can't be described as two independent qubits. -Next, you will learn about multi-qubit gates and how they can give you access to all states of multi-qubit systems in the "Multi-Qubit Gates" kata. +Next, you'll learn about multi-qubit gates and how they can give you access to all states of multi-qubit systems in the "Multi-Qubit Gates" kata. diff --git a/katas/content/multi_qubit_systems/learn_basis_state_amplitudes/index.md b/katas/content/multi_qubit_systems/learn_basis_state_amplitudes/index.md index 2c2595778f..a27c3e38cc 100644 --- a/katas/content/multi_qubit_systems/learn_basis_state_amplitudes/index.md +++ b/katas/content/multi_qubit_systems/learn_basis_state_amplitudes/index.md @@ -10,5 +10,5 @@ once for every run.
Need a hint? - On a physical quantum system, there would be no way to obtain these values from a single observation. Since this program runs on a simulator, we can use DumpMachine to inspect the qubits and take a note of their state. Furthermore, the problem statement guarantees, that the state will be the same from invocation to invocation. So we can update the code to return the amplitudes that we've taken note of. Then run the code again. + On a physical quantum system, there would be no way to obtain these values from a single observation. Since this program runs on a simulator, you can use DumpMachine to inspect the qubits and take a note of their state. Furthermore, the problem statement guarantees that the state will be the same from invocation to invocation. So, you can update the code to return the amplitudes that you've taken note of, then run the code again.
diff --git a/katas/content/multi_qubit_systems/prepare_basis_state/solution.md b/katas/content/multi_qubit_systems/prepare_basis_state/solution.md index 3a0f4638af..f2e2f5dc12 100644 --- a/katas/content/multi_qubit_systems/prepare_basis_state/solution.md +++ b/katas/content/multi_qubit_systems/prepare_basis_state/solution.md @@ -4,7 +4,7 @@ $$ \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \ket{0} \otimes \ket{0} $$ The goal state can be represented as follows: $$ \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} = \ket{1} \otimes \ket{1} $$ -Applying an **X** gate to a qubit in the $\ket{0}$ state transforms the qubit state into the $\ket{1}$ state. So, if we apply the **X** gate on the first qubit and the second qubit, we get the desired state. +Applying an $X$ gate to a qubit in the $\ket{0}$ state transforms the qubit state into the $\ket{1}$ state. So, if you apply the $X$ gate on the first qubit and the second qubit, you get the desired state. @[solution]({ "id": "multi_qubit_systems__prepare_basis_state_solution", diff --git a/katas/content/multi_qubit_systems/prepare_superposition/solution.md b/katas/content/multi_qubit_systems/prepare_superposition/solution.md index f515a9982f..6f665f25e7 100644 --- a/katas/content/multi_qubit_systems/prepare_superposition/solution.md +++ b/katas/content/multi_qubit_systems/prepare_superposition/solution.md @@ -1,15 +1,15 @@ -We begin in the same state as the previous exercise: +You begin in the same state as the previous exercise: $$ \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \ket{0} \otimes \ket{0}$$ The goal state can be separated as follows: $$ \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ -1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \frac{1}{\sqrt2}\begin{bmatrix} 1 \\ -1 \end{bmatrix} = \ket{0} \otimes \frac{1}{\sqrt2}\big(\ket{0} - \ket{1}\big)$$ -This means that the first qubit is already in the state we want it to be, but the second qubit needs to be transformed from the $ \begin{bmatrix} 1 \\ 0 \end{bmatrix} $ into $ \frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ -1\end{bmatrix}$ state. +This means that the first qubit is already in the state you want it to be, but the second qubit needs to be transformed from the $ \begin{bmatrix} 1 \\ 0 \end{bmatrix} $ into $ \frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ -1\end{bmatrix}$ state. -First, we apply the **X** gate to the second qubit; this performs the following transformation: +First, you apply the $X$ gate to the second qubit; this performs the following transformation: $$ X \ket{0} = \begin{bmatrix}0 & 1 \\ 1 & 0 \end{bmatrix} \cdot \begin{bmatrix}1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \ket{1} $$ -Second, we apply the **H** gate to the second qubit; this transforms its state into the desired one: +Second, you apply the $H$ gate to the second qubit; this transforms its state into the desired one: $$ H\ket{1} = \frac{1}{\sqrt2}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \cdot \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \frac{1}{\sqrt2}\begin{bmatrix} 1 \\ -1 \end{bmatrix}$$ @[solution]({ diff --git a/katas/content/multi_qubit_systems/prepare_with_complex/solution.md b/katas/content/multi_qubit_systems/prepare_with_complex/solution.md index 7695535912..7bf2729537 100644 --- a/katas/content/multi_qubit_systems/prepare_with_complex/solution.md +++ b/katas/content/multi_qubit_systems/prepare_with_complex/solution.md @@ -8,16 +8,16 @@ $$ \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ e^{i\pi/2} \end{bmatrix} \otimes \frac{1}{\sqrt2}\begin{bmatrix} 1 \\ e^{i\pi/4} \end{bmatrix} = \frac{1}{\sqrt2}\big(\ket{0} + e^{i\pi/2}\ket{1}\big) \otimes \frac{1}{\sqrt2}\big(\ket{0} + e^{i\pi/4}\ket{1}\big) $$ -We will again need to adjust the states of both qubits independently. +You'll again need to adjust the states of both qubits independently. -For the first qubit, we'll start by applying the **H** gate, getting the state $\frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix}$, as we've seen in the previous task. Afterwards we'll apply the **S** gate with the following result: +For the first qubit, you'll start by applying the $H$ gate, getting the state $\frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix}$, as you've seen in the previous task. Afterwards you'll apply the $S$ gate with the following result: $$ \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} \cdot \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ i \end{bmatrix}$$ -If we recall that $i = e^{i\pi/2}$, we can write the final state of the first qubit as: +If you recall that $i = e^{i\pi/2}$, you can write the final state of the first qubit as: $$ \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ e^{i\pi/2} \end{bmatrix} $$ -For the second qubit. we'll apply the **H** gate, followed by the **T** gate, with the following result: +For the second qubit, you'll apply the $H$ gate, followed by the $T$ gate, with the following result: $$ \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{bmatrix} \cdot \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ e^{i\pi/4} \end{bmatrix} $$ @[solution]({ diff --git a/katas/content/multi_qubit_systems/prepare_with_real/solution.md b/katas/content/multi_qubit_systems/prepare_with_real/solution.md index 3c1d2c2f45..12021edf70 100644 --- a/katas/content/multi_qubit_systems/prepare_with_real/solution.md +++ b/katas/content/multi_qubit_systems/prepare_with_real/solution.md @@ -1,12 +1,12 @@ -Again, to start we will represent the goal state as a tensor product of single-qubit states; this gives us the following representation: +Again, to start you'll represent the goal state as a tensor product of single-qubit states; this gives you the following representation: $$ \frac{1}{2}\big(\ket{00} - \ket{01} + \ket{10} - \ket{11}\big) = \frac{1}{2}\begin{bmatrix} 1 \\ -1 \\ 1 \\ -1 \end{bmatrix} = \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix} \otimes \frac{1}{\sqrt2}\begin{bmatrix} 1 \\ -1 \end{bmatrix} = \frac{1}{\sqrt2}\big(\ket{0} + \ket{1}\big) \otimes \frac{1}{\sqrt2}\big(\ket{0} - \ket{1}\big) $$ -This time we need to transform both the first and the second qubits. Let's start with the first qubit. Applying the **H** gate transforms its state as follows: +This time you need to transform both the first and the second qubits. Let's start with the first qubit. Applying the $H$ gate transforms its state as follows: $$ H\ket{0} = \frac{1}{\sqrt2}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \cdot \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \frac{1}{\sqrt2} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{1}{\sqrt2}\big(\ket{0} + \ket{1}\big)$$ -For the second qubit we can use the same transformation we've seen in the "Prepare a Superposition of Two Basis States" exercise; this will give the desired end state. +For the second qubit, you can use the same transformation you've seen in the "Prepare a Superposition of Two Basis States" exercise; this will give the desired end state. @[solution]({ "id": "multi_qubit_systems__prepare_with_real_solution", diff --git a/katas/content/oracles/index.md b/katas/content/oracles/index.md index 28b6c52b52..0beba3ad83 100644 --- a/katas/content/oracles/index.md +++ b/katas/content/oracles/index.md @@ -16,8 +16,10 @@ Quantum oracles are a key part of many quantum algorithms that rely on quantum i **What you should know to start working on this kata:** -- Basic knowledge of fundamental quantum concepts -- Basic knowledge of multi-qubit gates, especially controlled gates. If you're not familiar with these concepts, you can find them in the Multi-Qubit Gates kata. +- Fundamental quantum concepts +- Basic multi-qubit gates, especially controlled gates + +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "oracles__classical_oracles", diff --git a/katas/content/qec_shor/index.md b/katas/content/qec_shor/index.md index 4197bbe353..120fa8c4e3 100644 --- a/katas/content/qec_shor/index.md +++ b/katas/content/qec_shor/index.md @@ -17,8 +17,10 @@ This kata introduces you to the basic concepts of quantum error correction using **What you should know to start working on this kata:** -- Basic knowledge of single-qubit and multi-qubit gates -- Basic knowledge of single-qubit and multi-qubit quantum measurements and their effect on quantum systems +- Basic single-qubit and multi-qubit gates +- Single-qubit and multi-qubit quantum measurements, and their effect on quantum systems + +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "qec_shor__noise", diff --git a/katas/content/qubit/index.md b/katas/content/qubit/index.md index 12a6fa6d34..fbb6e42214 100644 --- a/katas/content/qubit/index.md +++ b/katas/content/qubit/index.md @@ -19,8 +19,10 @@ This kata introduces you to one of the core concepts in quantum computing - the **What you should know to start working on this kata:** -- Basic knowledge of complex arithmetic -- Basic knowledge of linear algebra +- Basic concepts of complex arithmetic +- Basic concepts of linear algebra + +If you need a refresher on these topics, you can check out the previous katas. @[section]({ "id": "qubit__concept", diff --git a/katas/content/random_numbers/index.md b/katas/content/random_numbers/index.md index 034bf5124b..656149d1e7 100644 --- a/katas/content/random_numbers/index.md +++ b/katas/content/random_numbers/index.md @@ -16,8 +16,8 @@ The quantum algorithm for random number generation is one of the simplest applic **What you should know to start working on this kata:** -- Basic knowledge of qubits and measurements -- Basic knowledge of single-qubit gates +- Quantum measurements +- Basic single-qubit gates If you need a refresher on these topics, you can check out the previous katas.