🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz

How do quantum computers perform matrix multiplication?

Quantum computers perform matrix multiplication by leveraging quantum gates, which are fundamentally mathematical operations represented as unitary matrices. When a sequence of quantum gates is applied to qubits, the overall effect is equivalent to multiplying their corresponding matrices in reverse order. For example, applying Gate A followed by Gate B results in the combined operation ( B \times A ), where ( \times ) denotes matrix multiplication. This is because quantum operations are applied from right to left in mathematical notation, mirroring the order of execution. Each qubit’s state is a vector in a complex Hilbert space, and quantum gates transform these states through matrix multiplication, enabling computations that can scale exponentially with the number of qubits.

To illustrate, consider a simple system with two qubits. A Hadamard gate (H) applied to the first qubit and a Pauli-X gate applied to the second can be represented as ( H \otimes X ), where ( \otimes ) denotes a tensor product. If another gate, like a CNOT (controlled-NOT), is applied afterward, the total operation becomes ( \text{CNOT} \times (H \otimes X) ). Here, the CNOT’s 4x4 matrix multiplies the 4x4 matrix of ( H \otimes X ). Quantum algorithms decompose large operations into such gate sequences, ensuring that the resulting matrix multiplication represents the desired computation. This approach is particularly efficient for certain linear algebra tasks, as quantum parallelism allows simultaneous processing of all input states via superposition.

However, quantum matrix multiplication has limitations. First, quantum gates must be unitary, meaning only invertible operations (with ( U^\dagger U = I )) can be directly implemented. Non-unitary operations, like arbitrary classical matrices, require workarounds such as embedding them into larger unitary matrices using ancilla qubits. Second, extracting results via measurement collapses quantum states, limiting output visibility. While quantum algorithms like HHL (Harrow-Hassidim-Lloyd) exploit these principles for solving linear systems, practical matrix multiplication on current hardware remains constrained by noise and qubit coherence. Developers must carefully map classical matrix problems to quantum-friendly forms, balancing gate depth and error rates.

Like the article? Spread the word