4.1.5 Measuring all qubits

Once we are done with applying operations that transform our quantum bits, we would like to get some information out. As before, the only way of doing this is by measuring the qubits.

What are the rules for measuring a quantum state of nn qubits? If we measure all nn qubits then we obtain nn bits as the outcome, i.e., a bitstring a1ana_{1}\dots a_{n}. As before, the probability of obtaining any particular outcome a1ana_{1}\dots a_{n} is the squared amplitude:

pa1,,an=ψa1,,an2.p_{a_{1},\dots,a_{n}}=\psi_{a_{1},\dots,a_{n}}^{2}. (4.6)

In Quirky, we can measure all qubits as before, by adding one measurement box for each qubit. To view the probabilities of the measurement outcomes, we can add a probability display – but we have to make sure to resize it suitably so that it applies to all wires. Try reproducing the following example:

[Uncaptioned image]

This sequence of Quirky operations prepares the state

12|000+12|111\displaystyle\frac{1}{\sqrt{2}}\left|000\right\rangle+\frac{1}{\sqrt{2}}\left|% 111\right\rangle (4.7)

and measures all three qubits. Can you see how this works?