X gate
The X gate is a single-qubit quantum gate that exchanges the computational-basis states zero and one.
Quantum Programming in Depth
An X gate is a single-qubit bit-flip quantum gate that exchanges the computational-basis states zero and one.
- How it is used
- Uses the X gate for bit flips, measurement-result normalization, and distinguishing candidate unitary operations.
- How deep it goes
- Explains basis-state action and implements X within single- and two-qubit discrimination circuits, without developing its matrix representation.
- Examples
- Uses X-versus-Z, X-versus-H, and X-versus-minus-X discrimination experiments with measured circuit outcomes.
- What you can do after
- Apply it via Qiskit or Q# and test discrimination circuits through measurement outcomes and passing automated tests.
Building Quantum Software with Python
The X gate is a single-qubit quantum gate that swaps the amplitudes associated with the two computational-basis outcomes.
- How it is used
- Uses the X gate to transform a single-qubit state by exchanging its computational-basis amplitudes.
- How deep it goes
- Defines the amplitude swap, implements it with a list assignment, and verifies reversibility by applying the transformation twice.
- Examples
- Demonstrates the gate with two-item state lists, the default state [0, 1], and successive swaps returning [1, 0].
- What you can do after
- Builds a direct state-list simulation and verifies that applying the X gate twice restores the initial amplitudes.
Read how Building Quantum Software with Python explains x gate →
Related concepts
- quantum gatekind of · A quantum gate is an operation that transforms the state of one or more qubits, typically represented by a unitary transformation.
- inverseequivalent to · An inverse is a value or operation that reverses the effect of another value or operation under a specified composition rule.
- logical NOTimplements · Logical NOT is a unary Boolean operation that produces the complementary truth value of its operand.
- Qiskitused by · Qiskit is an open-source software development kit for constructing, simulating, compiling, and executing quantum circuits.
- reversible operationuses · A reversible operation is a computation that maps each input uniquely to an output so the input can be recovered.
- quantum stateuses · A quantum state is a mathematical representation of a quantum system that determines the probabilities of possible measurement outcomes.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

