---
title: "Bloch Sphere Golf: Learn How Qubits and Gates Work"
description: "Turn a qubit arrow to a target point on the Bloch sphere in as few gates as possible, and learn how gates change a qubit in ways a measurement cannot see."
url: https://tadams.net/quantum/bloch-golf
---

[Quantum demos](https://tadams.net/quantum)

# Bloch sphere golf

A qubit is drawn as an arrow in a ball, called the Bloch sphere. Turn the arrow to a target point in as few gates as possible.

New to qubits: start with the short guide, [Quantum basics](https://tadams.net/quantum#q-basics-title).

Drag or use the arrow keys to turn the sphere. The dark arrow is your state. What the labels mean

Before hole 1

## Putting green

Practice from |0⟩ · No par

Press a gate to see what it does. Try H first.

Strokes

0

Gates used

None

State

Chance of 0 · of 1

How to read the state

|0⟩ means the arrow points straight up, so a measurement gives 0. |1⟩ means the arrow points straight down, so a measurement gives 1.

A state such as 0.707|0⟩ + 0.707|1⟩ is a mix of the two. Multiply each number by itself to get its chance: 0.707 × 0.707 is about 0.5, so 0 and 1 each come up half the time.

A number can also carry a minus sign or an i. Think of each number as a small arrow of its own, with a length and a direction. A plain number points right, a minus sign points it left, and an i points it up, a quarter turn. 0.5 + 0.5i points half way between right and up. Only the length sets the chance: for 0.5 + 0.5i, multiply each part by itself and add, 0.25 + 0.25 = 0.5.

So an i or a minus sign does not change the chance. It shows where the big arrow in the ball points around the middle line.

In a hole, match to target says how close the arrow is to the green ring. 100% means it is on the ring. An arrow that points the opposite way scores 0%.

The middle line is the circle around the ball, half way between the top and the bottom. |+⟩ and |−⟩ are two opposite points on it, at the ends of a line called the X axis. |+i⟩ and |−i⟩ are the two points a quarter turn away from them, at the ends of the Y axis. The ball labels all four. The † on S† and T† marks the gate that undoes S or T.

The readout uses Dirac (ket) notation: |ψ⟩ = α|0⟩ + β|1⟩, where α and β are complex amplitudes with |α|² + |β|² = 1. P(0) = |α|² and P(1) = |β|².

The readout takes out the global phase, which does not move the point on the sphere: it makes the |0⟩ amplitude real and not negative. So it shows Y|0⟩ = i|1⟩ as |1⟩, and any i or minus sign left is the relative phase eiφ.

|±⟩ = (|0⟩ ± |1⟩) / √2 and |±i⟩ = (|0⟩ ± i|1⟩) / √2 are the points on the X and Y axes. U† is the conjugate transpose of U, which for a unitary gate is its inverse.

### What each step did

Press a gate. Its note appears here, newest first.

## What this shows

Think of a qubit as an arrow inside a ball. When you measure it, the arrow snaps to the top, which reads 0, or to the bottom, which reads 1. An arrow near the top gives 0 with a high chance. An arrow on the middle line is a fair coin.

Each gate turns the ball. Some gates tip the arrow up or down, which changes the chance of 0 or 1. Other gates spin the arrow around the middle. A spin does not change the chances right away, but it changes what the next gate does to the arrow.

Up to a global phase, every pure one-qubit state is cos(θ/2)|0⟩ + eiφ sin(θ/2)|1⟩. The Bloch vector is (sin θ cos φ, sin θ sin φ, cos θ). The poles are |0⟩ and |1⟩, and the equator holds the equal superpositions, which differ only in the relative phase φ.

Every one-qubit unitary is a rotation of the sphere: e−iθ n·σ/2 turns the Bloch vector by θ about the axis n. X, Y, and Z are half turns, S is a quarter turn about Z, and T is an eighth turn. P(0) = cos²(θ/2) depends only on the height. A measurement in the 0 and 1 basis cannot see φ, and nothing can see a global phase.

## The labeled points

The six labels mark where the three axes meet the sphere. Points opposite each other are opposite states. A measurement usually asks up or down, but a qubit can be turned first so that the question is asked along any line through the ball. Asked along the line that joins two opposite points, one measurement tells them apart for sure.

The six points are the eigenstates of Z, X, and Y, so they are the three measurement bases. Opposite points on the sphere are orthogonal states.

| Label | Where | What it is |
| --- | --- | --- |
| \|0⟩ | Top | A sure 0.The Z basis state \|0⟩. Bloch vector (0, 0, 1). |
| \|1⟩ | Bottom | A sure 1.The Z basis state \|1⟩. Bloch vector (0, 0, −1). |
| \|+⟩ | Middle line, on the X axis | A fair coin: 0 or 1, half each. H turns 0 into this point.(\|0⟩ + \|1⟩) / √2. Bloch vector (1, 0, 0). H\|0⟩ = \|+⟩. |
| \|−⟩ | Middle line, opposite \|+⟩ | Also a fair coin, half a turn around the middle from \|+⟩. A measurement cannot tell it from \|+⟩, but H turns the two into 0 and 1.(\|0⟩ − \|1⟩) / √2. Bloch vector (−1, 0, 0). H\|1⟩ = \|−⟩. |
| \|+i⟩ | Middle line, on the Y axis, a quarter turn from \|+⟩ | A fair coin, a quarter turn around the middle from \|+⟩. S turns \|+⟩ into this point.(\|0⟩ + i\|1⟩) / √2. Bloch vector (0, 1, 0). S\|+⟩ = \|+i⟩. |
| \|−i⟩ | Middle line, opposite \|+i⟩ | A fair coin, a quarter turn around the middle the other way. S† turns \|+⟩ into this point.(\|0⟩ − i\|1⟩) / √2. Bloch vector (0, −1, 0). S†\|+⟩ = \|−i⟩. |

## The gates

| Gate | Name | What it does |
| --- | --- | --- |
| X | Pauli-X, the bit flip | Flips the arrow upside down, so it swaps 0 and 1.\[\[0, 1\], \[1, 0\]\], a half turn about the X axis. It is the quantum NOT gate. |
| Y | Pauli-Y | Like X, flips the arrow upside down, so the top and the bottom swap. The two differ on the middle line: X keeps \|+⟩ and \|−⟩ where they are and swaps \|+i⟩ with \|−i⟩, and Y does the opposite.\[\[0, −i\], \[i, 0\]\], a half turn about the Y axis. |
| Z | Pauli-Z, the phase flip | Spins the arrow half way around the middle. The top and the bottom do not move.diag(1, −1), a half turn about the Z axis. It flips the sign of the \|1⟩ amplitude. |
| H | Hadamard | Swaps the top with \|+⟩ and the bottom with \|−⟩. It turns a sure 0 into a fair coin, and a coin at \|+⟩ or \|−⟩ back into a sure result.(X + Z) / √2, a half turn about the axis half way between X and Z. H·H = I. |
| S | The phase gate | Spins the arrow a quarter of the way around the middle.diag(1, i), a quarter turn about the Z axis. S·S = Z. |
| S† | S dagger | Undoes S: a quarter turn the other way.diag(1, −i), the inverse of S. † is the conjugate transpose. |
| T | The T gate, or π/8 gate | Spins the arrow one eighth of the way around the middle. Some books call it the π/8 gate, from a number in its math, though the turn is π/4.diag(1, eiπ/4), an eighth turn about the Z axis. T·T = S. Up to a global phase, T = diag(e−iπ/8, eiπ/8), which gives it the name π/8. |
| T† | T dagger | Undoes T: an eighth turn the other way.diag(1, e−iπ/4), the inverse of T. |

## Scorecard

| Hole | Par | Strokes |
| --- | --- | --- |
| Total |  | 0 |

## Other demos

- [Circuit puzzle](https://tadams.net/quantum/circuit)
- [The bomb tester](https://tadams.net/quantum/bomb-tester)
- [Entanglement games](https://tadams.net/quantum/chsh)
- [Teleportation](https://tadams.net/quantum/teleportation)
- [Eavesdropper](https://tadams.net/quantum/eavesdropper)
- [Keep it alive](https://tadams.net/quantum/error-correction)
- [Intercepts](https://tadams.net/quantum/intercepts)

Explain
