DEV Community

Cover image for Superdense Coding-Math & Implementation
Md. Zubair
Md. Zubair

Posted on

Superdense Coding-Math & Implementation

For classical communication there is a limit on how much information can be send with a given number of bits. We can send no more than n bits of information using n bits. However, there are ways that we can push the boundary which are not possible classically. Hence, we can use superdense coding using quantum computer.

Definition:

It is a procedure that allows someone to send two classical bits to another party using just a single qubit of information.

Here we will use 4 types of gates while implementing this procedure.

  1. H gate -> This puts a qubit into superposition.
  2. X gate -> X|0> -> |1> & X|1> -> |0>
  3. CX gate -> It takes two qubits one is control and another is target. If the control bit is 0 , it does nothing to the target qubit, otherwise if the control bit is 1, X gate is applied on target qubit.
  4. Z gate -> It only change the phase of a qubit when it is in |1> state i.e, Z|0> -> |0> , Z|1> -> -|1>

The procedure is implemented as follows,

Image description

For keeping track , we have put 4 track point here , namely W1,W2,W3,W4.

Now let's see how this procedure works mathematically,

Image description

Image description

Image description

Image description

Image description

Now let's see its coding part, here we will use Qiskit for the implementation,

from qiskit import QuantumCircuit,Aer,execute

qc_3rd_party = QuantumCircuit(2,2)

qc_3rd_party.h(1)

qc_3rd_party.cx(1,0)


message_list = ['00', '01', '10', '11']

qc_Alice = QuantumCircuit(2,2)

for msg in message_list:

    if msg[-2]=='1':

        qc_Alice.z(1)

    if msg[-1]=='1':

        qc_Alice.x(1)

    qc_Bob = QuantumCircuit(2,2)

    qc_Bob.cx(1,0)

    qc_Bob.h(1)

    qc_Bob.measure([0,1],[0,1])

    complete_qc = qc_3rd_party.compose(qc_Alice.compose(qc_Bob))

    backend = Aer.get_backend('qasm_simulator')

    print(f'For message = {msg}\n')

    count = backend.run(complete_qc).result().get_counts()

    print(count,"\n")

    qc_3rd_party.data=[]

    qc_Alice.data=[]

    qc_Bob.data=[]


Enter fullscreen mode Exit fullscreen mode

The output of the code is ,

Image description

Top comments (1)

Collapse
 
alexroor4 profile image
Alex Roor

I admire how you backed up your arguments with solid evidence and real-world examples. It makes your points much more compelling.