DEV Community

Malcolm Low
Malcolm Low

Posted on Originally published at malcolmlow.com

Quantum Fourier Transform (QFT) of a Single Qubit: The Hadamard Transform

Module 4 in the Quantum Computing: A Complete Learning Path series. Bridging the transition from entangled communications in Superdense Coding (Module 3b) and Two-Qubit Entanglement (Module 3) to the multi-qubit Hadamard tools in The Walsh-Hadamard Matrix (Module 5).

The Quantum Fourier Transform (QFT) is one of the most powerful subroutines in all of quantum algorithms. It serves as the mathematical engine powering Shor's Factoring Algorithm, Quantum Phase Estimation (QPE), and quantum order finding. At first glance, the general $n$-qubit QFT formula appears formidable, laden with complex exponential phases and multi-controlled phase rotations.

However, when stripped down to its absolute simplest case—a single qubit ($N = 2^1 = 2$)—an elegant mathematical symmetry emerges: the 1-qubit Quantum Fourier Transform is identical to the familiar Hadamard gate.

In this guide, we derive this equivalence from first principles, evaluate the basis states $|0\rangle$ and $|1\rangle$, inspect the matrix representation, and verify the equivalence in Qiskit 2.x.


1. The General Definition of the Quantum Fourier Transform

In an $N$-dimensional Hilbert space with computational basis states ${|0\rangle, |1\rangle, \dots, |N-1\rangle}$, the Quantum Fourier Transform acts on a computational basis state $|x\rangle$ as:

|x̃⟩ ≡ QFT |x⟩ ≡ ( 1 / √N ) ∑ [ e^(2π i x y / N) ] |y⟩    (summed from y = 0 to N - 1)
Enter fullscreen mode Exit fullscreen mode

Just like the classical Discrete Fourier Transform (DFT), the QFT maps computational basis states into superpositions of states whose relative phases rotate at frequencies proportional to $x$. For an $n$-qubit quantum register, the dimension of the state space is $N = 2^n$.


2. Specializing to One Qubit (N = 2)

Now, let us examine what happens when we set the number of qubits to $n = 1$, which gives $N = 2^1 = 2$. The summation runs over only two values: $y = 0$ and $y = 1$:

QFT |x⟩ = ( 1 / √2 ) ∑ [ e^(2π i x y / 2) ] |y⟩
        = ( 1 / √2 ) ∑ [ e^(i π x y) ] |y⟩
        = ( 1 / √2 ) [ e^(i π x · 0) |0⟩ + e^(i π x · 1) |1⟩ ]
        = ( 1 / √2 ) [ |0⟩ + e^(i π x) |1⟩ ]
Enter fullscreen mode Exit fullscreen mode

Notice how drastically the phase factor simplifies:

  • $e^{2\pi i x y / 2}$ simplifies immediately to $e^{i \pi x y}$.
  • Because $y \in {0, 1}$, the first term is always $e^0 = 1$.
  • This leaves only the single phase factor $e^{i \pi x}$ multiplying the $|1\rangle$ component.

3. Evaluating Basis States |0⟩ and |1⟩

A single qubit has only two computational basis inputs: $x = 0$ and $x = 1$. Let us evaluate each:

Case 1: When $x = 0$

Substitute $x = 0$ into the phase term $e^{i \pi \cdot 0} = e^0 = 1$:

QFT |0⟩ = ( 1 / √2 ) [ |0⟩ + e^(i π · 0) |1⟩ ]
        = ( |0⟩ + |1⟩ ) / √2
        = |+⟩ ≡ H |0⟩
Enter fullscreen mode Exit fullscreen mode

Case 2: When $x = 1$

Substitute $x = 1$ into the phase term using Euler's identity ($e^{i \pi} = -1$):

QFT |1⟩ = ( 1 / √2 ) [ |0⟩ + e^(i π · 1) |1⟩ ]
        = ( |0⟩ - |1⟩ ) / √2
        = |-⟩ ≡ H |1⟩
Enter fullscreen mode Exit fullscreen mode

The Matrix Identity

Because the QFT transforms $|0\rangle \to |+\rangle$ and $|1\rangle \to |-\rangle$, its $2 \times 2$ unitary matrix representation is:

F₂ = ( 1 / √2 ) × [ [ 1,  1 ],
                    [ 1, -1 ] ] ≡ H
Enter fullscreen mode Exit fullscreen mode

Thus, the single-qubit Quantum Fourier Transform and the single-qubit Hadamard gate are literally the exact same unitary operator!


4. Verifying the Equivalence in Qiskit 2.x

In Qiskit 2.x, the Quantum Fourier Transform is available as QFTGate in qiskit.circuit.library. When we decompose a 1-qubit QFTGate, Qiskit compiles it directly into a single H gate:

1-Qubit QFT Decomposed Circuit in Qiskit

Here is a reproducible script in Qiskit 2.x verifying that the Frobenius norm difference between QFTGate(1) and Operator.from_label('H') is zero down to machine precision ($10^{-16}$):

import numpy as np
from qiskit import QuantumCircuit
from qiskit.circuit.library import QFTGate
from qiskit.quantum_info import Operator

# 1. Build circuit with 1-qubit QFT
qc = QuantumCircuit(1)
qc.append(QFTGate(1), [0])

# 2. Decompose the gate into elementary operations
qc_decomposed = qc.decompose()
print("Decomposed 1-Qubit QFT Circuit:")
print(qc_decomposed)

# 3. Extract the Unitary Matrix Operators
op_qft = Operator(qc).data
op_hadamard = Operator.from_label('H').data

print("\n1-Qubit QFT Matrix:")
print(np.round(op_qft, 4))

print("\nStandard Hadamard Matrix:")
print(np.round(op_hadamard, 4))

# 4. Verify mathematical equivalence
diff = np.linalg.norm(op_qft - op_hadamard)
print(f"\nFrobenius Norm Difference: {diff:.2e}")
print(f"Equivalence Verified    : {np.allclose(op_qft, op_hadamard)}")
Enter fullscreen mode Exit fullscreen mode

Execution Output:

Decomposed 1-Qubit QFT Circuit:
   ┌───┐
q: ┤ H ├
   └───┘

1-Qubit QFT Matrix:
[[ 0.7071+0.j  0.7071+0.j]
 [ 0.7071+0.j -0.7071+0.j]]

Standard Hadamard Matrix:
[[ 0.7071+0.j  0.7071+0.j]
 [ 0.7071+0.j -0.7071+0.j]]

Frobenius Norm Difference: 2.38e-16
Equivalence Verified    : True
Enter fullscreen mode Exit fullscreen mode

5. Frequently Asked Questions

Is the QFT of one qubit the exact same as the Hadamard gate?

Yes. Working through the $N = 2$ case of the QFT definition shows that $\text{QFT}|0\rangle = |+\rangle$ and $\text{QFT}|1\rangle = |-\rangle$, which are identical to the outputs of a Hadamard gate on the same inputs. For one qubit, QFT and $H$ are literally the exact same unitary operator.

What is the Quantum Fourier Transform used for in quantum algorithms?

The QFT is the foundational engine of Quantum Phase Estimation (QPE) and Shor's Factoring Algorithm. It converts periodic phase differences into measurable computational basis states, allowing a quantum computer to find periods exponentially faster than any classical algorithm.

How does the multi-qubit QFT generalize beyond 1 qubit?

When multiple qubits are involved ($n > 1$), the QFT cannot be achieved with independent Hadamard gates alone. It requires an interlocking ladder of Hadamards and controlled phase rotation gates ($R_k$), followed by SWAP gates to reverse qubit order:

R_k = [ [ 1,        0        ],
        [ 0,  e^(2π i / 2^k) ] ]
Enter fullscreen mode Exit fullscreen mode

The 1-qubit case is the unique scenario where all controlled rotations vanish, leaving only the lone Hadamard transformation.


Key Insights & Takeaways

  1. One-Qubit Equivalence: Setting $N = 2$ in the discrete quantum Fourier transform collapses the general phase sum to $(|0\rangle + e^{i \pi x}|1\rangle) / \sqrt{2}$.
  2. Euler's Identity at Work: Because $e^{i \pi \cdot 0} = +1$ and $e^{i \pi \cdot 1} = -1$, the QFT turns $|0\rangle \to |+\rangle$ and $|1\rangle \to |-\rangle$—the hallmark behavior of the Hadamard gate.
  3. The Stepping Stone to Multi-Qubit QFT: Understanding the 1-qubit case is essential before studying how controlled phase rotations generalize the QFT to Shor's algorithm and period finding.

Continue the Quantum Series

Top comments (0)