IQC 004
· 약 10분
Superdense Coding
- counterintuitive protocol that allows us to send 2 bits of classical information by sending only 1 qubit, using pre-shared entanglement
- it's often contextualized as a game with Alice and Bob.
- Alice and Bob share and entangled pair of qubits
- Pre-shared Entanglement (Shared Bell pair)
- Alice wants to send 2 bits of classical information (00, 01, 10, or 11) to Bob
- For 00: Apply Identity (do nothing)
- For 01: Apply Pauli-X (bit flip)
- For 10: Apply Pauli-Z (phase flip)
- For 11: Apply (bit and phase flip)
- Alice sends her one qubit to Bob (Bob possesses both qubits of the entangled pair)
- Bob decodes the information
- Inverts the entanglement operation on the two qubits (CNOT followed by Hadamard)
- Measures each of the qubits
- The outcome of this measurement reveals the two bits Alice encoded.
- : is the most common and convenient form (Bell State) of entanglement and is also maximally entangled state despite single-qubit unitary gates.
- Easy to build circuits for it
- Symmetric and has nice properties that make it ideal for protocols like superdense coding and teleportation
- Other Bell states can be generated from by applying single-qubit gates.
Superdense Coding Circuit

- Alice's message , where each of and is a bit (0 or 1)
- Alice's operation can be represented as
- (no phase flip)
- (phase flip)
- (no bit flip
- (bit flip)
- (phase flip)
- (xor operation)
- :
- :
- : first qubit is , is the phase factor
- : first qubit is , is the phase factor
- Bob's decoding operation is the inverse of the entanglement operation
- which is seperable state.
- First qubit is and second qubit is .
- , then apply Hadamard to the first qubit:
- second qubit is , so the final state is:
Superdense QASM
OPENQASM 2.0;
qreg q[2];
creg c[2];
// Prepare Bell pair
h q[0];
cx q[0],q[1];
// Alice's encoding
// For message 11: apply X and Z
x q[0];
z q[0];
// Alice sends q[0] to Bob (in simulation, we just proceed)
// Bob's decoding
cx q[0],q[1];
h q[0];
// Measure both qubits
measure q[0] -> c[0];
measure q[1] -> c[1];
QASM Programming
Custom Gates
// params: parameters for the gate (e.g., rotation angles)
// q_args: quantum arguments (qubits the gate acts on)
gate NAME(parameters) q_args {
// Define gate operations
}
gate bell a,b {
h a;
cx a,b;
}
qreg q[2];
creg c[2];
// Use the custom bell gate
bell q[0], q[1];
// Measure the qubits
measure q[0] -> c[0];
measure q[1] -> c[1];
Toffoli Gate
// Toffoli gate (CCX)
gate ccx a, b, c {
h c;
cx b, c;
tdg c;
cx a, c;
t c;
cx b, c;
tdg c;
cx a, c;
t b;
t c;
cx a, b;
h c;
t a;
tdg b;
cx a, b;
}
Rotation Gates
// Rotation around Y-axis
gate ry_deg(theta) q {
ry(theta/180 * pi) q;
}
// Rotation around X-axis
gate rx_deg(theta) q {
rx(theta/180 * pi) q;
}
Qiskit
IBM
import qiskit
superdense = qiskit.QuantumCircuit(2, 2)
superdense.draw()
superdense.h(0)
superdense.cx(0, 1)
superdense.draw()

# Alice's encoding for message '11'
superdense.x(0)
superdense.z(0)
superdense.draw()

# Bob unentangles the two qubits (reverses the entangling gate)
superdense.cx(0,1)
superdense.h(0)
# The measurement pattern is `measure(qubit to measure, classical bit to store result)`
superdense.measure(0,0)
superdense.measure(1,1)
superdense.draw()

from qiskit.providers.basic_provider import BasicSimulator
sim = BasicSimulator()
# run the circuit on the simulator with 1 shot (execute the circuit once)
result = sim.run(superdense, shots=1).result().get_counts()
print(result)
# {'11': 1}
Custom Gates in Qiskit
bell = qiskit.QuantumCircuit(2, name='bell')
bell.h(0)
bell.cx(0, 1)
bell_gate = bell.to_gate()
c = qiskit.QuantumCircuit(2)
c.append(bell_gate, [0, 1])
c.draw()
Decompose a custom gate
ccxgate = qiskit.circuit.library.CCXGate()
ccx = qiskit.QuantumCircuit(3)
ccx.append(ccxgate, [0, 1, 2])
print(ccx)
print(ccx.decompose())

Cirq
import cirq
alice = cirq.NamedQubit('Alice')
bob = cirq.NamedQubit('Bob')
superdense = cirq.Circuit()
superdense.append([
cirq.H(alice),
cirq.CNOT(alice, bob),
])
superdense.append([
cirq.X(alice),
cirq.Z(alice),
])
superdense.append([
cirq.CNOT(alice, bob),
cirq.H(alice),
])
superdense.append(cirq.measure(alice, bob, key='received'))
print(superdense)
simulator = cirq.Simulator()
result = simulator.run(superdense, repetitions=1)
print(result)
# received=1, 1
Pennylane
Xanadu
import pennylane as qml
def entangle():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
print(qml.draw(entangle)())
device = qml.device("default.qubit", wires=[0, 1])
# Wrap the quantum function as a QNode
entangle_qnode = qml.QNode(my_circuit, device)
# Set the number of shots to 10
entangle_qnode = qml.set_shots(entangle_qnode, shots=10)
import numpy as np
state = np.array([1, 1j], dtype=complex)
state = state / np.linalg.norm(state)
def teleport(state):
# Ensure "state" is loaded into the first qubit
# (otherwise qubits would start in |0>)
qml.StatePrep(state, wires=0)
# Shared entanglement between qubits 1 and 2
qml.Hadamard(wires=1)
qml.CNOT(wires=[1, 2])
# Alice's operation:
# CNOT from Alice's input qubit to her half of the Bell pair,
# then Hadamard on the input qubit
qml.CNOT(wires=[0, 1])
qml.Hadamard(wires=0)
# Measurement (store the classical outcomes)
m0 = qml.measure(0)
m1 = qml.measure(1)
# Bob's conditional correction operations
qml.cond(m1, qml.PauliX)(wires=2)
qml.cond(m0, qml.PauliZ)(wires=2)
# Return Bob's qubit as a density matrix
return qml.density_matrix(wires=2)
print(qml.draw(teleport)(state))
Quantum Teleportation

| - | Superdense Coding | Teleportation |
|---|---|---|
| Consumes | Entanglement | Entanglement |
| Sends | 1 qubit | 2 bits |
| Transmits | 2 bits | 1 qubit |
- if there is entanglement:
- we can use it to send 2 bits of classical information by sending 1 qubit (superdense coding)
- we can use it to send 1 qubit of quantum information by sending 2 bits of classical information (teleportation)
- Alice wants to send a qubit to Bob, but only has a classical channel.
Protocol
- Alice and Bob share (pre-shared entanglement)
- Alice applies (her qubit
->her Bell half), then , then measures both, obtaining 2 classical bits (00, 01, 10, or 11) - Alice sends classically to Bob
- Bob applies to his qubit, recovering
- For 00: Apply Identity (do nothing)
- For 01: Apply Pauli-X (bit flip)
- For 10: Apply Pauli-Z (phase flip)
- For 11: Apply (bit and phase flip)
- Bob now has a qubit in the state Alice wanted to send without Alice ever sending a qubit directly to Bob.
Teleportation Circuit

- Alice applies a gate with her qubit as control and her half of the Bell pair as target.
- becomes (target flips when control is 1)
- becomes (target flips when control is 1)
- Alice then applies a Hadamard gate to her qubit ().
- To prepare for measurement, Bell measurement is performed on Alice's two qubits, which can be expressed as:
- Alice measures her two qubits, resulting in one of four possible outcomes corresponding to the classical bits where
- Alice's two qubits:
- Bob's qubit is in a state that depends on Alice's measurement outcome
| mn | Bob's state | Bob applies |
|---|---|---|
| 00 | ||
| 01 | ||
| 10 | ||
| 11 |
Channels
- Classical Channel: carries bits (fibre, radio, paper, ...)
- Quantum Channel: carries qubits (can also carry bits)
- Quantum channels can emulate classical ones, but not vice versa
- Teleportation:
classical channel + pre-shared entanglement -> effective quantum channel
Summary
- In superdense coding, by sending only one qubit and using pre-shared entanglement, Alice can transmit two classical bits of information.
- The operation correctly defines the effect of applying the gate times.
- The tensor product of two identity operators is the identity operator on the composite space. In symbols, where the subscript is the dimension: .
- The state is an eigenstate of the Pauli- gate with eigenvalue .
- In the teleportation protocol, the classical communication channel is used to transmit two classical bits from Alice to Bob.
- Three qubits are required for quantum teleportation.
- After the teleportation protocol completes, Bob has a qubit in the state .
- Of QASM, Qiskit, Cirq, and PennyLane, PennyLane is the only quantum language that spells out the full name of the Hadamard gate for its built-in gates.