Introduction

Superposition [1] is a phenomenon in quantum mechanics where a qubit can be manipulated such that instead of having one definite state, it is present in all possible states with each having some probability of occurring. It is during the measurement phase that a qubit selects a definite state, while quantum entanglement [2, 3] is a phenomenon by which qubits are manipulated such that their outputs became correlated and cannot be represented as an output of individual qubits. Superposition and quantum entanglement are playing key roles in designing quantum algorithms and are the backbone of quantum teleportation [4]- and quantum cryptography [5]-based systems. Even though these phenomena provide significant advantage to quantum computers, in reality, very few problems [6, 7] have been figured out which can be solved effectively with quantum computing.

A computer can solve only those problems whose solution can be designed using their available gates. Similarly, in quantum computer, there are varieties of quantum gates available with each having its own characteristics and importance in designing the quantum algorithms. In this paper, we are proposing a solution to the problem of assuring fairness in random selection tasks like in lucky draw, and gambling by providing a generalized quantum algorithm.

Quantum Gates

In quantum computers, the basic unit of quantum information is called a ‘qubit’. General quantum state of a qubits is represented using its two orthonormal basis states |0〉 and |1〉.

$$\left| 0 \right\rangle = \left[ {\begin{array}{*{20}c} 1 \\ 0 \\ \end{array} } \right]$$
$$\left| 1 \right\rangle = \left[ {\begin{array}{*{20}c} 0 \\ 1 \\ \end{array} } \right]$$

A pure qubit is a superposition \(\left| {\varvec{\uppsi}} \right\rangle\) of the basis state, and is described using the linear combination of |0〉 and |1〉 states.

$$\left| {\varvec{\uppsi}} \right\rangle = \alpha \left| {\mathbf{0}} \right\rangle + \beta \left| 1 \right\rangle ; \, {\text{such}}\;{\text{that}}\;\left| {\varvec{\upalpha}} \right|^{2} + \left| {\varvec{\upbeta}} \right|^{2} = 1$$

Here, \(\left| {\varvec{\upalpha}} \right|^{2}\) represents the probability of getting |0〉 state during measurement of the qubit, and \(\left| {\varvec{\upbeta}} \right|^{2}\) represents the probability of getting |1〉 state while measuring the qubit (Fig. 1).

Fig. 1
figure 1

Bloch sphere representing pure state of a quantum bit

Our proposed algorithm relies on four quantum gates including Hadamard [8], Pauli X [9], controlled Hadamard [10], and controlled NOT [11] gate.

Hadamard Gate

When a qubit present in state |0〉 or in state |1〉 is passed through the Hadamard gate, it gets transformed into a superposition of all possible states. In superposition, each state has equal probability of occurring at the time of measurement (Figs. 2, 3). This gate is represented by letter ‘H’.

Fig. 2
figure 2

Hadamard gate applied on |0〉 input state

Fig. 3
figure 3

Hadamard gate applied on |1〉 input state

$$H = \frac{1}{\sqrt 2 }\left( {\begin{array}{*{20}c} 1 & 1 \\ 1 & { - \,1} \\ \end{array} } \right)$$

When a qubit with a Hadamard transformation is passed again to the Hadamard gate, it destroys the superposition effect introduced by the first Hadamard gate (Figs. 4, 5).

Fig. 4
figure 4

Two Hadamard gates applied on |0〉 input state

Fig. 5
figure 5

Two Hadamard gates applied on |1〉 input state

Pauli X Gate

When this quantum gate is applied on a qubit, it interchanges the amplitude of its states (Fig. 6). In other words, it acts similar to the NOT gate of a digital computer. This gate is represented by letter ‘X’.

Fig. 6
figure 6

Pauli X gate interchanging the amplitudes of input state

$$X = \left( {\begin{array}{*{20}c} 0 & 1 \\ 1 & 0 \\ \end{array} } \right)$$

Similar to a digital NOT gate, when two consecutive ‘X’ gates are applied on input qubit, second ‘X’ gate nullifies the effect of first ‘X’ gate (Fig. 7).

Fig. 7
figure 7

Two consecutive Pauli X gates have no effect on input state

Controlled Hadamard Gate

This gate consists of two input qubits where the first qubit (i.e. control qubit) decides whether or not to apply Hadamard transformation to the second (i.e. target qubit) qubit. If the control qubit is in state |1〉, then Hadamard gate is applied on the second qubit, else no transformation is performed (Fig. 8). This gate is represented by letters ‘CH’.

Fig. 8
figure 8

CH gate with input |1〉 to control bit, and input |0〉 to target bit

$${\text{CH }} = \left( {\begin{array}{*{20}c} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & {\frac{1}{\sqrt 2 }} & {\frac{1}{\sqrt 2 }} \\ 0 & 0 & {\frac{1}{\sqrt 2 }} & {\frac{ - \,1}{\sqrt 2 }} \\ \end{array} } \right)$$

Controlled NOT Gate

Controlled NOT gate also have a control qubit and a target qubit. When control qubit holds state |1〉, Pauli X gate is applied to the target qubit (Fig. 9). Controlled NOT gate is represented by letters ‘CX’ or ‘CNOT’.

Fig. 9
figure 9

CX gate with input |1〉 to control bit, and input |0〉 to target bit

$${\text{CNOT }} = \left( {\begin{array}{*{20}c} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{array} } \right)$$

Quantum Entanglement

Quantum entanglement is a physical phenomenon because of which quantum states of each particle cannot be described independent of each other. This phenomenon still persists even if the entangled particles are separated to a greater distance.

Two qubits initialized to |0〉 state can be entangled with positive correlation using CNOT and Hadamard quantum gates. In positive correlated entanglement, output of both the qubits during measurement remains same, i.e. either both are in |0〉 state or both are in |1〉 state (Fig. 10).

Fig. 10
figure 10

Positive correlation between two entangled qubits

While designing two entangled qubits (both initialized to |0〉) with negative correlation, an additional Pauli X gate is applied on the target qubit of CNOT gate. In negative correlated entanglement, output of both the qubits during measurement remains opposite to each other. If one is measured as |0〉 state, then the other will always be in |1〉 state (Fig. 11).

Fig. 11
figure 11

Negative correlation between two entangled qubits

Trust Issues with Lucky Draw-Based Systems

Lucky draw is supposed to be an activity of randomly selecting a winner from the available pool of candidates. Ideally, it is supposed that such type of systems will not have any preferential bias towards any participant, but depending on the intensity of preferential bias, all available lucky draw systems can be manipulated at some stage to profit an individual or group of individuals.

Digital systems can be easily manipulated by the authorities to provide desired output in lucky draw, and other randomness-based gambling systems. Depending on the influence one group have on the digital system random function’s source code, outcome of the digital system can be controlled or altered (Fig. 12).

Fig. 12
figure 12

Winner can be selected by manipulating the source code of random function

Although quantum superposition can be used for having fair randomness for selecting a winner from the list of participants, to perform this operation, Hadamard gates are applied on N qubits (all initialized to |0〉 state) to provide equal chance of selecting one candidate out of 2N total candidates. Although it requires a smaller number of qubits, this approach is not completely quantum assured because no-cloning theorem [12] does not allow the obtained result to be directly teleported to multiple candidates. Thus, the results have to be sent to a classical computer to broadcast it to all the participants. Involvement of digital computer makes this approach vulnerable to alteration (Fig. 13).

Fig. 13
figure 13

No-cloning theorem does not allow sending multiple copies of the result

Instead of providing a single result, our proposed approach provides results for the entire participants about whether they are the winner or not. This makes it impossible to alter the obtained results by individual(s), and also because we are not sending multiple copies of same result, this enables us to teleport the individual’s result to them and making the entire process completely based on quantum computers (Fig. 14).

Fig. 14
figure 14

Our approach provides end-to-end quantum computing-based solution

Proposed Algorithm

Ensuring fairness in random decision-making helps in establishing trust among its users, especially in events like lottery and lucky draw, where the system can be easily altered to directly or indirectly profit an individual or group of individuals. Our proposed quantum circuit designing algorithm randomly provides one qubit with state-1 and the remaining with state-0 while ensuring fairness at each level of random decision-making. Its architecture allows the results to be teleported to other quantum systems for performing further tasks, or even teleporting results directly to the clients which make the system end-to-end quantum secured (Table 1).

figure a
Table 1 Parameters related detail

Output state produced by our proposed algorithm with 2N quantum bits presents equal chances of one qubit holding |1〉 state, while remaining 2N − 1 qubits hold |0〉 . For example in the system of two participants (output state is represented using |φ〉), one qubit always holds |1〉 state and remaining holds |0〉 state.

$$\left| {\mathbf{\varphi }} \right\rangle = \frac{1}{{\sqrt {2^{1} } }} \left( {\left| {10} \right\rangle + \left| {01} \right\rangle } \right)$$

Working Demonstration

Proposed algorithm is implemented using QISKit Library [13] of IBM, and its source code is available in our GitHub repository [14]. For better understanding of the proposed algorithm, two working demonstrations of our algorithm are also provided.

Working Demonstration with Four Participants

To perform random selection among four participants, our proposed algorithm requires four quantum bits (i.e. qubit[] array indexing from 0 to 3) (Fig. 15, Table 2).

Fig. 15
figure 15

Visualization of quantum circuit with four participants generated using QISKit library

Table 2 Steps followed by our proposed algorithm for four participants

Output state |φ〉 has one qubit in |1〉 state, while remaining holds |0〉 state.

$$\left| {\mathbf{\varphi }} \right\rangle = \frac{1}{{\sqrt {2^{2} } }} \left( {\left| {1000} \right\rangle + \left| {0100} \right\rangle + \left| {0010} \right\rangle + \left| {0001} \right\rangle } \right)$$

Working Demonstration with Eight Participants

Our proposed algorithm requires eight quantum bits to perform fair random selection among eight participants (i.e. qubit[] array is indexed from 0 to 7) (Table 3; Fig. 16).

Table 3 Steps followed by our proposed algorithm for eight participants
Fig. 16
figure 16

Visualization of quantum circuit representation of eight participants with QISKit library

Output state |φ〉 has one qubit in |1〉 state, while remaining holds |0〉 state.

$$\begin{aligned} \left| {\mathbf{\varphi }} \right\rangle & = \frac{1}{{\sqrt {2^{3} } }}\left( {\left| {10000000} \right\rangle + \left| {01000000} \right\rangle + \left| {00100000} \right\rangle + \left| {00010000} \right\rangle } \right. \\ & \quad \left. { + \left| {00001000} \right\rangle + \left| {00000100} \right\rangle + \left| {00000010} \right\rangle + \left| {00000001} \right\rangle } \right) \\ \end{aligned}$$

These manipulated qubits can further be teleported (or sent) to the individual participants making our end-to-end system relying only on quantum phenomenon which in turn ensures fairness in each step of our proposed algorithm.

Conclusion

Our proposed quantum algorithm provides a solution to the problem of fair random selection among small number of participants, and has the potential to be used in commercial domains requiring quantum assurance for the random selection tasks. Due to the complete random nature of quantum, it can be used in activities involving lucky draw, and any other similar form of activity dependent on random selection task.