A vector is an abstract object, but to compute with it we pick a basis and write down its components.
This lesson makes the bridge between the coordinate-free ket ∣ψ⟩ and the column of numbers we
actually manipulate.
Components are basis-dependent
Fix an orthonormal basis {∣ek⟩}. Any state expands as
∣ψ⟩=k∑ck∣ek⟩,ck=⟨ek∣ψ⟩.
The numbers ck are the components (or coordinates) of ∣ψ⟩ in that basis. The vector
itself does not change when you choose a different basis — only its list of components does. This is the
same idea as describing the same arrow by different (x,y) pairs after rotating your axes.
The column-vector representation
Collecting the components into a column gives the familiar matrix representation. For a qubit in the
computational basis,
∣ψ⟩=c0∣0⟩+c1∣1⟩⟷(c0c1),⟨ψ∣⟷(c0c1).
Inner products then become ordinary matrix multiplication of a row by a column, and operators become
matrices. Choosing a basis is what makes Dirac notation computable.
Changing basis
Suppose we also have a second orthonormal basis {∣fk⟩}. The components in the new basis are
again given by inner products, ck′=⟨fk∣ψ⟩. Inserting the completeness relation of
the old basis,
ck′=⟨fk∣ψ⟩=j∑⟨fk∣ej⟩⟨ej∣ψ⟩=j∑Ukjcj,
where Ukj=⟨fk∣ej⟩ are the entries of a unitary change-of-basis matrix. The
state is fixed; the unitary just rewrites its coordinates. The Hadamard gate, for instance, is exactly
the unitary that converts between the computational {∣0⟩,∣1⟩} basis and the
{∣+⟩,∣−⟩} basis.
Real-amplitude states and the RY rotation
A useful family of single-qubit states has real, non-negative amplitudes:
∣ψ(θ)⟩=cos2θ∣0⟩+sin2θ∣1⟩.
These are produced from ∣0⟩ by the rotation gate RY(θ), whose matrix is
RY(θ)=(cos2θsin2θ−sin2θcos2θ),
so that RY(θ)∣0⟩=∣ψ(θ)⟩. The components depend on the single angle θ,
and normalization cos2+sin2=1 holds automatically.
Worked example
To represent
∣ψ⟩=21∣0⟩+23∣1⟩
we need cos(θ/2)=1/2, i.e. θ/2=π/3, so θ=2π/3. Then
sin(θ/2)=sin(π/3)=3/2, matching the ∣1⟩ component. The probabilities are
∣c0∣2=1/4 and ∣c1∣2=3/4, summing to 1.
Try it
Prepare the state ∣ψ⟩=21∣0⟩+23∣1⟩ on one qubit using
an RY rotation, and return the circuit. The grader checks the full statevector.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.