Skip main navigation

Extracting Parity

© Keio University
Error correcting codes generally identify errors by calculating the parity of a set of bits.
Parity tells us whether the number of ones in a set of bits is even or odd; the parity of 001 and 111 is 1, while the parity of 000, 110, and 101 is 0. Parity can be calculated by taking the XOR (exclusive OR) of the set of bits. Extracting parity without destroying the superposition is the tricky part of QEC. The CNOT can help.

Parity on a Bell pair

For example, let’s look at our Bell pair \(\frac{|00\rangle + |11\rangle}{\sqrt{2}}\). Consider each element of the superposition separately. The parity of \(|00\rangle\) is 0. The parity of \(|11\rangle\) is also zero. If we try to find the parity by first measuring each qubit, then calculating the parity classically, we will destroy the superposition and entanglement.
Instead, let’s add another qubit, initialized to be \(|0\rangle\), then use that to calculate the parity. Now our state is \(\frac{(|00\rangle + |11\rangle)|0\rangle}{\sqrt{2}} = \frac{|000\rangle + |110\rangle}{\sqrt{2}}\).
Recall that the quantum equivalent of XOR is CNOT. Let’s first apply a CNOT using the left qubit as the control and the right qubit as the target. In each term of the superposition, if the left qubit is zero, it will leave the right qubit alone. If the left qubit is one, it will flip the right qubit. That will make the state \(\frac{|000\rangle + |111\rangle}{\sqrt{2}}\).
Now do the same thing using the middle qubit as the control, and the right qubit as the target. If the middle qubit is zero, leave the right qubit alone; if it’s one, flip the right qubit. Now we have the state \(\frac{|000\rangle + |110\rangle}{\sqrt{2}} = \frac{(|00\rangle + |11\rangle)|0\rangle}{\sqrt{2}}\). In the first term in the superposition, the parity of 00 is 0, and in the right term of the superposition, the parity of 11 is also 0. It’s the same!
Now if we go measure the right hand qubit, we will definitely find 0. Since it’s always 0, the rest of the state is unaffected, and our superposition and entanglement are the same!
On the other hand, consider another type of Bell pair, \(\frac{|01\rangle + |10\rangle}{\sqrt{2}}\). This second type of Bell pair is the same as our first type, but with one qubit flipped – a single bit flip error. The operation would go differently. The first CNOT gate would take our state from \(\frac{(|01\rangle + |10\rangle)|0\rangle}{\sqrt{2}} = \frac{|010\rangle + |100\rangle}{\sqrt{2}}\) to \(\frac{|010\rangle + |101\rangle}{\sqrt{2}}\), then the second CNOT would advance the state to \(\frac{|011\rangle + |101\rangle}{\sqrt{2}} = \frac{(|01\rangle + |10\rangle)|1\rangle}{\sqrt{2}}\). Now if we measure the last qubit, we find 1, and once again the superposition and entanglement of the first two qubits (our original Bell pair) are unaffected.

Parity of larger states

That procedure gives us the ability to measure the parity without collapsing the state, at least for certain kinds of two-qubit states. If we can extend this concept to more qubits, we can build complete error correction.
Consider the three-qubit state \(\frac{|000\rangle + |111\rangle}{\sqrt{2}}\). If we add a fourth qubit and calculate the parity of all three qubits, the problem is that the parity of the components of the superposition differ. We will end up with even (0) parity for the \(|000\rangle\) state, and odd (1) parity for the \(|111\rangle\) state, so we would have the state \(\frac{|0000\rangle + |1111\rangle}{\sqrt{2}}\). Measuring the last (parity) qubit would collapse our superposition.
Instead, we use our technique to measure the parity of only a subset of the qubits. In this case, we’ll work two at a time, first calculating the parity of the left and middle qubits, which should be 0, then the parity of the middle and right qubits, which should also be 0.
This particular state forms the basis of the simplest quantum error correcting code, to which we turn next.




たとえば、ベルペア:\(\frac{\vert00\rangle + \vert11\rangle}{\sqrt{2}}\)を見てみましょう。重ね合わせの各要素を別々に考えてみましょう。\(\vert00\rangle\)のパリティは0です。 \(\vert11\rangle\)のパリティもゼロです。 最初に各量子ビットを測定してパリティを見つけようとすると、パリティを古典的に計算すると、重ね合わせとエンタングルメントが破棄されます。
代わりに、\(\vert0\rangle\)に初期化された別の量子ビットを追加し、それを使ってパリティを計算してみましょう。 ここで、状態は\(\frac{(\vert00\rangle + \vert11\rangle)\vert0\rangle}{\sqrt{2}} = \frac{\vert000\rangle + \vert110\rangle}{\sqrt{2}}\)となります。
XORの量子相当量はCNOTであることを思い出してください。最初にコントロールとして左量子ビットを使用し、右量子ビットをターゲットとしてCNOTを適用しましょう。重畳の各項において、左の量子ビットがゼロであれば、右の量子ビットだけが残ります。左の量子ビットが1の場合、右の量子ビットを反転します。 それは状態\(\frac{\vert000\rangle + \vert111\rangle}{\sqrt{2}}\)になります。
今度は、中央の量子ビットをコントロールとして使用し、右の量子ビットをターゲットとして同じことを行います。中央の量子ビットがゼロの場合は、右の量子ビットだけを残します。それが1つの場合は、右の量子ービットを反転します。今度は状態\(\frac{\vert000\rangle + \vert110\rangle}{\sqrt{2}} = \frac{(\vert00\rangle + \vert11\rangle)\vert0\rangle}{\sqrt{2}}\)になります。重畳の最初の項では、00のパリティは0であり、重畳の右の項では、11のパリティも0です。同じです!
一方、別の種類のベルペア、 \(\frac{\vert01\rangle + \vert10\rangle}{\sqrt{2}}\)を考えてみましょう。この第2のタイプのベルペアは、第1のタイプと同じですが、1つの量子ビットがフリップされています(シングルビットフリップエラー)。すると、操作は異なって行きます。最初のCNOTゲートは\(\frac{(\vert01\rangle + \vert10\rangle)\vert0\rangle}{\sqrt{2}} = \frac{\vert010\rangle + \vert100\rangle}{\sqrt{2}}\)から\(\frac{\vert010\rangle + \vert101\rangle}{\sqrt{2}}\)への状態をとり、2番目のCNOTは状態を\(\frac{\vert011\rangle + \vert101\rangle}{\sqrt{2}} = \frac{(\vert01\rangle + \vert10\rangle)\vert1\rangle}{\sqrt{2}}\)に進めます。ここで最後の量子ビットを測定すると、1となり、最初の2つの量子ビット(元のベルペア)の重ね合わせとエンタングルメントは影響を受けません。


3量子ビット状態\(\frac{\vert000\rangle + \vert111\rangle}{\sqrt{2}}\)を考えてみましょう。4番目の量子ビットを追加して3つの量子ビットすべてのパリティを計算すると、重なりの成分のパリティが異なるという問題があります。\(\vert000\rangle\)の嬢阿智の偶数 (0) パリティと \(\vert111\rangle\)の状態の奇数 (1) パリティで終わるので、状態\(\frac{\vert0000\rangle + \vert1111\rangle}{\sqrt{2}}\)になります。最後(パリティ)量子ビットを測定すると、重ね合わせが崩れます。
代わりに、量子ビットのサブセットのみのパリティを測定する技術を使用します。 この場合、最初に左と中の量子ビットのパリティを計算します。これは0にする必要があります。中位量子ビットと右量子ビットのパリティも0にする必要があります。
© Keio University
This article is from the free online

Understanding Quantum Computers

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education