Quantum Computing Master Course — 013. Unitary Matrices
Lesson 013: Unitary Matrices
Smartyfy Quantum Computing Master Course
Starting point and objectives
A valid pure-state vector has norm one. An ideal reversible quantum transformation must send every such input to another normalized state while retaining the information needed to reverse the transformation. Unitary matrices achieve this. By the end, you should verify unitarity using an adjoint product or orthonormal columns, prove that inner products are preserved, and find the inverse of a unitary matrix.
We work with finite-dimensional complex vectors and square matrices. Nested lists specify matrix rows; a named vector is a column. The identity I has ones on its diagonal and zeros elsewhere. For two coordinates it is [[1, 0], [0, 1]].
The defining test
A square matrix U is unitary when U†U = UU† = I. Its adjoint is therefore its inverse: U† undoes U, and U undoes U†. For a finite square matrix, either identity implies the other, but calculating both can be a useful error check in a small example.
Do not replace the adjoint with a transpose unless the entries are real. A real unitary matrix is usually called an orthogonal matrix. The broader unitary definition allows complex phases. IBM’s single-system course states these equivalent finite-dimensional tests and relates them to pure-state transformations.
The square-matrix assumption matters. A tall rectangular matrix can satisfy V†V = I and preserve lengths while mapping into a larger space. It is then an isometry, not a unitary matrix between two spaces of the same dimension. We will use square operators here so the inverse acts on the entire output space.
Worked example: a real rotation
Consider R = [[3/5, −4/5], [4/5, 3/5]]. Since R is real, R† = [[3/5, 4/5], [−4/5, 3/5]]. Multiplication gives diagonal entries 9/25 + 16/25 = 1. The upper-right entry is −12/25 + 12/25 = 0, and the lower-left is also zero. Thus R†R = I, proving unitarity.
Apply R to |0⟩ = [1, 0]. The output is [3/5, 4/5], with squared norm 9/25 + 16/25 = 1. Its computational-basis probabilities are 9/25 and 16/25. A unitary preserves total probability, but it need not preserve each probability separately. It can move amplitude between coordinates.
Checking this one input alone would not prove unitarity. For example, [[1, 0], [0, 2]] preserves the norm of |0⟩ but doubles the norm of |1⟩. The matrix identity proves the property for every input simultaneously.
Why inner products survive
Let u and v be any compatible columns, not necessarily normalized. Their transformed inner product is (Uu)†(Uv). Reversing the product when taking the adjoint gives u†U†Uv. Unitarity replaces the middle U†U with I, leaving u†v. Therefore every complex inner product is unchanged.
Taking u = v proves norm preservation: ||Uv||^2 = v†U†Uv = v†v = ||v||^2. Taking orthogonal u and v gives zero before and after, so orthogonality also survives. More generally, both magnitude and phase of their inner product are preserved, not just its absolute value.
This algebra explains why a unitary cannot map two different orthogonal states to exactly the same vector. Identical normalized outputs would have inner product one, whereas the original orthogonal inputs have inner product zero. Reversible transformations cannot erase that distinction. Measurements and discarded subsystems require a more general description, so not every physical quantum process is a unitary operation on the system being considered.
The column test
Write U’s columns as c_1, c_2, and so on. Entry ij of U†U is c_i†c_j. For this product to be I, every column must have norm one, and every pair of different columns must be orthogonal. This condition is called having orthonormal columns. MIT’s complex-matrices material develops this connection.
Both parts matter. Columns [1, 0] and [1, 0] are individually normalized but not orthogonal. The resulting matrix sends [1, −1] to zero. Conversely, [2, 0] and [0, 3] are orthogonal but not normalized; their matrix changes lengths. “Orthonormal” is a combined requirement, not another word for either condition alone.
![An equal-scale real coefficient plot shows columns c1=[3/5,4/5] and c2=[−4/5,3/5] ending on the unit circle at a right angle. Both squared norms are1 and their inner product is−12/25+12/25=0, proving R†R=I for this square real rotation matrix.](https://smartyfy.mrindigi.com/wp-content/uploads/2026/10/quantum-013-unitary-column-test.png)
Worked example: complex entries and an inverse
Let U = [[1, i], [i, 1]]/sqrt(2). Its columns have squared norm (1 + 1)/2 = 1. Their inner product is (i + (−i)·1)/2 = 0. Hence U is unitary. Its adjoint is U† = [[1, −i], [−i, 1]]/sqrt(2), which differs from U.
The input |0⟩ becomes [1, i]/sqrt(2). Applying U† gives [(1 + (−i)i)/2, (−i + i)/2] = [1, 0]. Applying U again would instead produce [0, i]. Being unitary does not mean being your own inverse; the adjoint is the guaranteed inverse.
Products of unitaries remain unitary: (UV)†(UV) = V†U†UV = V†V = I. Undoing a sequence requires reversing its order and undoing each step. If V acts first and U second, the combined transformation is UV and its inverse is V†U†.
Numerical software checks identities with a tolerance because floating-point arithmetic may produce tiny residuals. The Qiskit Operator reference includes an is_unitary check. A numerical pass is evidence at the chosen tolerance; exact arithmetic in these small examples gives an exact mathematical proof.
Practice exercises with worked solutions
-
Exercise 1. Is S = [[1, 0], [0, i]] unitary? Find its inverse.
Solution. S† = [[1, 0], [0, −i]]. Their product has diagonal entries 1 and (−i)i = 1, with zero off-diagonal entries. Therefore S†S = I, and S inverse is S†. In particular, S is unitary despite having a nonreal diagonal entry.
-
Exercise 2. Is M = [[1, 1], [0, 0]] unitary, even though each column has norm one?
Solution. The columns have inner product one, so M†M = [[1, 1], [1, 1]], not I. Also, M sends the normalized vector [1, −1]/sqrt(2) to zero. Either calculation disproves unitarity.
-
Exercise 3. Let u = [1, 1]/sqrt(2) and v = [1, i]/sqrt(2). Calculate their inner product before and after S.
Solution. Initially u†v = (1 + i)/2. Su = [1, i]/sqrt(2) and Sv = [1, −1]/sqrt(2). Their inner product is (1 + (−i)(−1))/2 = (1 + i)/2. Its imaginary part is preserved too.
-
Exercise 4. Unitary A acts first, then unitary B. Give the combined inverse and show cancellation.
Solution. The combined matrix is BA, whose inverse is A†B†. Multiplying (A†B†)(BA) gives A†(B†B)A = A†IA = I. B† acts first on the final output, undoing the most recent step.
Knowledge check
-
1. Which condition must hold for every square unitary matrix U? A. U + U† = I. B. U†U = I. C. Every entry is positive. D. U = I.
Answer: B. This identity guarantees the adjoint is the inverse.
-
2. Which must be preserved by U? A. Each amplitude. B. Each basis probability. C. Every inner product. D. Every coordinate’s sign.
Answer: C. Coordinates may change, but the inner-product calculation cancels U†U.
-
3. Normalized columns alone are: A. Sufficient. B. Impossible. C. Sufficient only with real entries. D. Insufficient.
Answer: D. Different columns must also be orthogonal.
-
4. The inverse of UV is: A. U†V†. B. V†U†. C. UV. D. U + V.
Answer: B. Reverse the order and invert each factor.
-
5. Does unitarity require U = U†? A. Yes. B. Only with two dimensions. C. No. D. Only with complex entries.
Answer: C. The complex worked example is unitary and has a distinct adjoint.
Pitfalls and summary
Do not infer unitarity from one successful input, normalized columns without orthogonality, or a familiar-looking matrix. Compute the adjoint correctly and test the identity. A unitary preserves inner products and has inverse U†, but need not preserve individual amplitudes or be self-inverse. Next we study Hermitian matrices, whose defining equality is different.
Primary sources and further study
The explanations and assessments were composed for this course. These references verify the definitions and optional software terminology. No executable lesson code, hardware, or account is required.