Inverse Quantum Fourier Transform
The Inverse QFT
The Inverse Quantum Fourier Transform (IQFT) is the conjugate transpose (adjoint) of the QFT. Since the QFT is unitary, its inverse is obtained by negating the exponent:
This is the defining property of a unitary operator: .
Round-Trip Identity
Applying QFT then IQFT recovers the original state (up to floating-point precision):
Example: Recovering
The QFT of is the uniform superposition .
Applying IQFT to this uniform superposition:
All higher components vanish similarly — returning exactly.
import cmath, math
def iqft(state):
N = len(state)
result = []
for k in range(N):
amp = sum(state[j] * cmath.exp(-2j * math.pi * j * k / N)
for j in range(N))
result.append(amp / math.sqrt(N))
return result
# IQFT of uniform superposition recovers |0⟩
result = iqft([0.5, 0.5, 0.5, 0.5])
print(round(abs(result[0]), 4)) # 1.0
print(round(abs(result[1]), 4)) # 0.0
Role in Quantum Algorithms
The IQFT is used in Quantum Phase Estimation: after building up phase information in the ancilla register via controlled- operations, the IQFT converts that phase into a readable binary fraction.
Your Task
Implement iqft(state) using the formula above (note the negative sign in the exponent compared to QFT).