Quantum states are represented as vectors in a complex vector space. If a vector represents the status of a qubit, a mathematical mechanism is needed to represent the operations that change that status. Just as a function in classical programming might toggle a boolean value from True to False, quantum mechanics uses matrices for these operations.
When an operation acts on a qubit, we represent this mathematically by multiplying the state vector by a matrix. However, not just any matrix will do. Quantum evolution must follow specific rules to ensure that the physics remains valid. The class of matrices that governs these valid operations is called unitary matrices.
The most important rule in quantum mechanics is that the total probability of all possible outcomes must always sum to exactly 1 (or 100%).
Recall that the probability of measuring a specific state is related to the squared magnitude (or length) of the state vector. If we used a matrix that stretched the vector, the total probability would exceed 1. If we used a matrix that shrank the vector, the total probability would drop below 1.
Therefore, valid quantum operators must be length-preserving. They can rotate the state vector anywhere within the Hilbert space, but they must never change its length. This is the geometric definition of a unitary matrix.
The unit circle represents all valid quantum states with a total probability of 1. A unitary operation rotates the vector (blue to teal) but keeps the tip of the arrow exactly on the circle.
To define unitary matrices mathematically, we first need to understand the conjugate transpose. In linear algebra texts, this is often denoted by a dagger symbol () and is sometimes called the Hermitian conjugate.
Calculating the conjugate transpose involves two steps:
If we have a matrix :
The transpose is:
The conjugate transpose is:
A matrix is unitary if its conjugate transpose is also its inverse. Mathematically, this is written as:
Where is the Identity Matrix, a square matrix with 1s on the diagonal and 0s everywhere else. Multiplying by the identity matrix is equivalent to multiplying a number by 1; it leaves the state unchanged.
This definition guarantees reversibility. If you apply a quantum gate to a qubit, you can return to the original state by applying . This suggests that, theoretically, quantum information is never lost (until measurement occurs).
You will often use Python to simulate these operations. We can use NumPy to verify if a matrix is unitary. Let's look at the Pauli X gate, often called the "Quantum NOT" gate, which flips the amplitudes of the state vector.
The matrix for Pauli X is:
We can check if this is unitary by calculating and seeing if we get the identity matrix.
import numpy as np
# Define the Pauli X matrix
X = np.array([[0, 1],
[1, 0]])
# Calculate the conjugate transpose (dagger)
# .conj() takes the complex conjugate
# .T takes the transpose
X_dagger = X.conj().T
# Perform matrix multiplication (dot product)
result = np.dot(X_dagger, X)
print("Result of X_dagger * X:")
print(result)
The output will be:
[[1 0]
[0 1]]
Since the result is the identity matrix, the Pauli X gate is a valid unitary operator.
To simulate a quantum computation, we apply the matrix to the state vector using the dot product.
Let's start with a qubit in the state, represented by the vector . We will apply the Pauli X gate.
This linear algebra operation confirms that the X gate flips the state from to .
Here is how we implement this state transition in Python:
# Define the initial state |0>
state_0 = np.array([[1],
[0]])
# Apply the X gate using dot product
new_state = np.dot(X, state_0)
print("New State Vector:")
print(new_state)
Understanding the flow of data is helpful when constructing algorithms. We start with an input vector, pass it through a series of unitary matrices (gates), and result in an output vector.
The matrix acts as a function that transforms the input vector into a new output vector while preserving its norm.
When working with quantum operators, keep these properties in mind:
In the next section, we will explore eigenvalues and eigenvectors. These concepts allow us to determine what values we will actually see when we perform a measurement on these transformed states.
Was this section helpful?
© 2026 ApX Machine LearningEngineered with