liveBook · Manning

X gate

As explained in 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.

The X gate, also called the NOT gate, swaps the amplitudes associated with the two computational-basis outcomes of a single-qubit state. section 3.2.2

Simulating an X gate

Represent the state as a two-item list and exchange its entries: state = [state[1], state[0]]. This directly models the amplitude swap. section 3.2.2

Applying the gate twice

Starting with the default state [0, 1], one X transformation produces the swapped state, and applying the same transformation again returns [1, 0]. section 3.2.5

How Building Quantum Software with Python covers it

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 it assumes
Assumes a single-qubit state represented by a pair of amplitudes and distinguishes computational-basis outcomes.
What you can do after
Builds a direct state-list simulation and verifies that applying the X gate twice restores the initial amplitudes.
How it connects
Connects the X gate to the NOT gate, single-qubit gates, inverse gates, and two-by-two matrix transformations.

Also explained in

Compare how 2 books explain x gate →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.