TopicBeginnerEstablished concept

Dirac Notation

Dirac Notation

Dirac notationDirac Notation: Dirac notation writes vectors as "kets" ψ⟩ and dual vectors as "bras" ⟨ψ, so inner products, projectors and operators become concise expressions. writes vectors as "kets" $|\psi\rangle$ and dual vectors as "bras" $\langle\psi|$, so inner products, projectors and operators become concise expressions.

Dirac notation, or bra–ket notation, is the standard language of quantum computing. A ket $|\psi\rangle$ is a column vector in a Hilbert spaceHilbert Space: A Hilbert space is a complex vector space equipped with an inner product; the states of n qubits live in a space of dimension 2^n built with the tensor product., and a bra $\langle\psi|=(|\psi\rangle)^\dagger$ is its conjugate transpose, i.e. a row vector with conjugated entries. For a single qubitQubit: The qubit is the unit of quantum information: a two-level system whose state is a unit vector α0⟩+β1⟩ in ℂ^2. $$|0\rangle=\begin{pmatrix}1\\0\end{pmatrix},\quad |1\rangle=\begin{pmatrix}0\\1\end{pmatrix},\quad |\pm\rangle=\tfrac{1}{\sqrt2}(|0\rangle\pm|1\rangle).$$

Everything is built from these two symbols. The inner product $\langle\phi|\psi\rangle=\sum_x\phi_x^*\psi_x$ is a complex number; $\langle\psi|\psi\rangle=1$ for normalised states, and $\langle\phi|\psi\rangle=0$ means orthogonality. The outer product $|\psi\rangle\langle\phi|$ is a matrix; for example $|0\rangle\langle0|=\begin{pmatrix}1&0\\0&0\end{pmatrix}$ is the projector onto $|0\rangle$, and $X=|0\rangle\langle1|+|1\rangle\langle0|$. The matrix element $\langle i|A|j\rangle$ is the entry in row $i$ and column $j$, and the expectation value is $\langle\psi|A|\psi\rangle$. The completeness relation $\sum_x|x\rangle\langle x|=I$ lets us insert a basis anywhere.

For composite systems we write $|a\rangle\otimes|b\rangle=|a\rangle|b\rangle=|ab\rangle$. Here the convention needs care: in Qiskit and in this lab the qubits are written from right to left, so $|q_1q_0\rangle$ means $|q_1\rangle\otimes|q_0\rangle$, and qubit 0 is the least significant bit. Textbooks usually write the first qubit first, on the left; that is why the textbook CNOT matrix is shown with the most significant qubit as the control.

The advantage of the notation is that it is basis-independent: the expression $\langle\phi|U|\psi\rangle$ stays valid whatever basis is used for the numerical computation, and long calculations shrink to a single line.

It is also useful to work with two other common bases: the $X$ basis made of $|+\rangle,|-\rangle$, and the $Y$ basis made of $|{+i}\rangle=\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)$ and $|{-i}\rangle=\tfrac{1}{\sqrt2}(|0\rangle-i|1\rangle)$. Any two of the three bases are mutually unbiased: the squared inner product between any vector of one and any vector of the other equals $\tfrac12$, so knowing the outcome in one gives no information about the outcome in the other. This property is the basis of the BB84 key-distribution protocol.

When computing by hand, it is advisable to write the state first in Dirac notation and convert it to column vectors only when matrix multiplication is needed, always stating the qubit order used, because mixing up the two conventions is one of the most common sources of errors when comparing textbook results with Qiskit results.

|00⟩|01⟩|10⟩|11⟩|ψ⟩ = Σ αᵢ|i⟩
State vector: complex amplitudes for each basis state

Mathematical formulation

$$\langle\phi|\psi\rangle=\sum_x\phi_x^{*}\psi_x,\qquad \sum_x|x\rangle\langle x|=I$$

Worked example

  1. $\langle+|-\rangle=\tfrac12(\langle0|+\langle1|)(|0\rangle-|1\rangle)=\tfrac12(1-1)=0$; the two states are orthogonal.
  1. Let $|\psi\rangle=\tfrac{1}{\sqrt2}(|0\rangle+i|1\rangle)$. The bra is $\langle\psi|=\tfrac{1}{\sqrt2}(\langle0|-i\langle1|)$ (note the conjugate). So $\langle0|\psi\rangle=\tfrac{1}{\sqrt2}$ and $|\langle+|\psi\rangle|^2=\left|\tfrac{1+i}{2}\right|^2=\tfrac12$.
  1. $\langle\psi|Z|\psi\rangle=\tfrac12(1)+\tfrac12(-1)=0$.

Try it yourself: Qubit Simulator

Loading the simulator…

The full experiment page

Test your understanding

The quiz needs JavaScript.

Related topics

References

  1. Microsoft (2025). Dirac Notation in Quantum Computing. Azure Quantum documentation learn.microsoft.com
  2. Michael A. Nielsen; Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press doi:10.1017/CBO9780511976667The standard reference for quantum computing; the Crossref record gives 2012 for the Cambridge Core online edition.
  3. John Watrous / IBM Quantum (2025). Basics of Quantum Information (course). IBM Quantum Learning quantum.cloud.ibm.com