DEV Community

Cover image for Understanding Bell Inequality of Quantum Computing

Posted on


Understanding Bell Inequality of Quantum Computing

Quantum Mechanics/Physics is rising and intersting field, right?. When learning it you come across topic called Bell Inequality. This is little guide for it.

It is a test which depends on Quantum Mechanics to describe real world experiment.

So let's know what is it and how do we calculate it.

Bell Inequality

John Stewart Bell is a Irish physicist. He devised an amazing test which distinguish between Bohr and Einstein models. Most amazing feature of this test is not only it is philosophies but also testable. So, let's take a look at it.

Before we start learning Bell Inequality, we have to learn it's basic ideas on which it depends. I hope you have basic knowledge about matrices and it's operations.


Column vector represent as "ket" ψ\ket{\psi}

Column vector represent as ket

Row vector represent as "bra"

Row vector represent as bra

You can look at it like this

Hadamard gate

Also known as H gate. It is single qubit operation that map qubit into equal superposition.

Simply it convert basis state into equally superposition states like this

0=0+12 \ket{0} = {\ket{0} + \ket{1} \above{2pt} \sqrt{2}}
1=012 \ket{1} = {\ket{0} - \ket{1} \above{2pt} \sqrt{2}}

Matrix for this is

Hadamard matrix of 2x2

Simply every element is 1 with scalar multiple of 12{1 \above{1pt} \sqrt{2}}

example let's calculate hadamard matrix for 0\ket{0}

calculating hadamard matrix for qubit

At top we write matrix for 0\ket{0} , take look at it because it contains 1 at top and 0 and bottom describing it is at 0\ket{0} state. Side of it is Hadamard matrix (H). Below is simply multiplication of 2x2 matrix and 2x1 matrix. After calculating we get 2x1 matrix containing 1 at each position indicating it has both 01\ket{0} \ket{1} states
and at the end we can write it in simple form

0=0+12 \ket{0} = {\ket{0} + \ket{1} \above{2pt} \sqrt{2}}


Hadamard gate symbol


It is two qubit operation. So it take two qubit as input, label it as first is "control" qubit and second is "target" qubit. Main point to remember is,

  • If control qubit is 1 then it perform Pauli-X gate on target qubit means convert 0 to 1 or vice-versa.
  • If control qubit is 0, then target qubit remain unchanged.

You can consider this as classical NOT gate.

00=00 \ket{00} = \ket{00}
01=01 \ket{01} = \ket{01}
10=11 \ket{10} = \ket{11}
11=10 \ket{11} = \ket{10}


CNOT gate symbol

That's it we need to understand Bell Inequality, although you read EPR and Bell's story as additional resources to your knowledge.

Bell Inequality

Before getting output from Bell circuit (similar to classical logic circuit) it first undergo Hadamard transformation and then CNOT gate act on it and give us output.


Now we have hadamard gates and CNOT gate with us the circuit of Bell state is

Bell circuit

So first hadamard gate act on it like

0=0+12 \ket{0} = {\ket{0} + \ket{1} \above{2pt} \sqrt{2}}

And after converting 0\ket{0} to it's equally superposition states we apply CNOT gate. As CNOT gate require two qubits as input.

00=(0+1)02 \ket{00} = {(\ket{0} + \ket{1})\ket{0} \above{2pt} \sqrt{2}}
00=00+102 \ket{00} = {\ket{00} + \ket{10} \above{2pt} \sqrt{2}}

We know CNOT gate will change target qubit if control qubit is 1 else it remains unchanged.

00=00+112 \ket{00} = {\ket{00} + \ket{11} \above{2pt} \sqrt{2}}

Similarly we get another 3 states.

for 01\ket{01}

01=01+102 \ket{01} = {\ket{01} + \ket{10} \above{2pt} \sqrt{2}}

for 10\ket{10}

10=00112 \ket{10} = {\ket{00} - \ket{11} \above{2pt} \sqrt{2}}

for 11\ket{11}

11=01102 \ket{11} = {\ket{01} - \ket{10} \above{2pt} \sqrt{2}}

And above are Bell's states/pairs

Top comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git