Even-Odd Algorithm in Quantum Computing

Even-Odd Algorithm in Quantum Computing

Using Qubit Flipper Circuit.

"How to find whether the number is even or odd? Simply divide by 2 and check the remainder. If the remainder is 0 then even else odd. But we are in the quantum world and things are not so easy here! "

There is no significance in using a quantum circuit to find whether the number is even or odd. But the purpose here is to understand the effect of noise and some other mathematics behind the algorithm.

Let's dive into some basics to understand this algorithm.

  1. |0>(Ket 0) and |1>(Ket 1) are the basis states in the standard Z basis as they are the eigenvalues of the Z gate. It is analogous to X, Y, and Z axes which are the standard axes of the cartesian coordinate system. However, we can also change the reference. Hence there are different bases of measurement in quantum computing. These values of |0> and |1> are given by column vectors.

  1. X Gate: Bit Flip Gate. Each quantum gate is a unitary operator or a unitary matrix.

These gates are applied to the quantum states via matrix multiplication.

  1. Z gate: When applied to |1> state, it changes the phase of the state.

Let's apply the Z gate to |0> and |1> states.

Thus we can see here that when applied to |1> state it flips the sign of the state.

Now, if 'A' is a matrix, 'a' is the eigenvalue and 'x' is the eigenvector then: Ax = ax. Hence, from the result we got above, A = Z, x = |0>,a = 1 and A=Z,x=|1>,a=-1. Thus 1 and -1 are eigenvalues of Z gate with |0> and |1> as its eigenvectors.

  1. <0| and <1| are the transpose of the complex conjugates of |0> and |1> respectively known as Bra 0 and Bra 1.

  1. Expectation value: If 'A' is a unitary operator on a Hilbert space, then its expectation value in the state ψ is given by <A> = <ψ|A|ψ>.

We will measure on a Z basis, hence the expectation value of the result will be 1 or -1.(Note: We are not considering the probabilities of the measurement, but the expectation values.)

We have covered sufficient basics to understand the even-odd algorithm.

Even-Odd Algorithm: Given a number 'd', classify whether it is even or odd.

Solution: Take a qubit with initial state |0> and flip it 'd' times using X gate. If the result is |0> then even else odd.

Here 'd' is the number, but 'd' also refers to the circuit depth. The above circuit can be expressed in short as below:

If we plot <Z> on the Y-axis and 'd' on the X-axis then we get the following graph:(The diagrams below are not accurate.)

But practically, as the depth of the circuit increases on the real quantum computer, the signal decays and there are a lot of fluctuations and there is a lot of noise. We get the above result ideally in Hilbert Space. But in the laboratory, they don't quite work out how we expect. This is the practical result we get after running the experiment.

At d=0, the initial measurement value is less than 1.0 and more than -1.0 due to the initial state preparation error. It is followed by a curve instead of a straight line depicting decay or incoherent noise. This is due to the relaxation and decoherence of the qubit. In between there is an oscillation that changes the result due to coherent noise. Coherent noise can be considered as over or under-rotation of quantum gates leading to phase change. There can also be some projection error, which collapses the quantum state into a different state than expected.

Thus using real quantum computers for such problems is still infeasible. Due to these problems, there are potential opportunities in the field of Noise and Error Mitigation in the field of Quantum Computing.

I have learned the above content from Qiskit Global Summer School 2023 by Zlatko Minev. Thank You, IBM!