M365Con 2027 – free online conference · 11–22 Jan 2027 · 120 sessions m365con.net

Hadamard gate

Concept

The Hadamard gate is a single-qubit quantum operation that puts a qubit from a basis state into an equal superposition of zero and one.

✦ CONCEPTHadamard gateM365.FM
Title graphic: Hadamard gate (Concept)

Description

The Hadamard gate is a single-qubit quantum operation that takes a qubit from a basis state into an equal superposition of zero and one. In Q#, the quantum programming language used with the Azure Quantum Development Kit, it is written H. Applied to a qubit in the zero state, it leaves the qubit in a state where both measurement outcomes, zero and one, have the same probability. This makes it one of the first operations that learners meet when they begin working with quantum programs.

The main purpose of the Hadamard gate is to create superposition. A qubit does not behave like a classical bit that is simply zero or one. Before a measurement, its state can be described as a probability distribution over outcomes. The Hadamard gate is the step that moves a qubit from a definite starting value into such a balanced distribution. Microsoft Learn illustrates this with Bloch sphere diagrams, which show a qubit that starts in the zero state and is moved into superposition by H.

The standard practical example is a quantum random number generator. According to the Microsoft Learn tutorial on implementing a quantum random number generator in Q#, the program allocates a qubit, applies H, and then measures the qubit. Because the Hadamard gate has produced an equal superposition, the measurement returns zero or one with equal probability, and that result can be used as a random bit. The sequence of allocate, apply H, and measure is the core of the algorithm, and longer random numbers can be built by repeating the process for further bits.

In day-to-day work, the Hadamard gate appears in Q# code inside a project, typically in the Program.qs file. A developer changes that file to build the quantum algorithm and runs the program from the terminal, and the same program can later be sent to real quantum hardware through Azure Quantum. Using real devices involves setting up an Azure account, installing the Azure CLI, and submitting the job with Azure CLI commands. The simulator route is useful for learning and debugging, while the hardware route shows how the same gate behaves on an actual device.

The M365.FM episode "Debug Quantum Programs with VS Code and Azure Quantum" (2025-11-03) mentions the Hadamard gate in this context. It describes building a quantum random number generator with a single qubit and a Hadamard gate by editing Program.qs, and it points to the Azure Quantum Development Kit for trying further algorithms such as Grover's search, quantum phase estimation and variational quantum eigensolvers (VQE). The episode treats the gate as a simple starting point for a first quantum program rather than as an end in itself.

A few limits apply to what the available sources say. The Microsoft Learn tutorial serves as a practical introduction to the role of the gate. It does not give the matrix form of the Hadamard gate and does not describe how it acts on input states other than the zero state. Anyone who needs a formal mathematical definition or a full account of its behavior on arbitrary states would need to consult other material. For the purpose of getting started with Q# and Azure Quantum, the key point is simple: apply H to a qubit in the zero state, measure, and the outcome is zero or one with equal probability.

Overview compiled with AI from M365.FM episodes and the facts on this page. You can improve it with the edit button below.

TypeConcept

Frequently asked questions

Questions marked with AI were written with AI from the facts on this page.

What does the Hadamard gate do? (AI)

It is a single-qubit operation that puts a qubit from a basis state into an equal superposition of zero and one. Applied to a qubit in the zero state, it makes both measurement outcomes equally likely.

How is the Hadamard gate used in a quantum random number generator? (AI)

The Microsoft Learn tutorial allocates a qubit, applies H, and measures it. Because H creates an equal superposition, the measurement returns zero or one with equal probability, giving a usable random bit.

How is the Hadamard gate written in Q#? (AI)

In Q# it is written H. It is applied to a qubit in the program code, for example in the Program.qs file of an Azure Quantum Development Kit project.

Glossary

Community wiki

Short info above, community knowledge below: add practical tips, examples or corrections. New contributions are reviewed first; trusted members publish directly.

Experts and companies for this topic

Nobody has listed this topic yet. Add it to your profile.

Maintained by Mirko Peters (Microsoft MVP) · Last updated: