Matrix Multiplication
Matrix multiplication combines two matrices by taking the dot product of rows from the first matrix with columns from the second. Each entry in the result is the sum of elementwise products between a row of the first and a column of the second. It only works when the number of columns in the first matrix equals the number of rows in the second.

Quantum Computing Isn't Weird. It Is Just Matrix Multiplication
And this is what makes it weird
A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit diagrams are useful, but they also convey a false mental model. They suggest step-by-step updates, as with classic code. Initialize a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State do this, then that, then read a value.
This post is accompanied by a PDF file summarizing the key points.
However, the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit does not work in this way. This is because it is not a list of commands that are executed step by step. Instead, the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit defines a mathematical operator
Learn more about Quantum Circuit means applying this operator to the initial state.
Accordingly, Quantum Computing is a different kind of computation that builds upon the phenomena of Quantum Mechanics.
Learn more about Quantum Computing can be summarized with a single equation:
This is not shorthand. This equation is the full computation written in one line.
The result of this equation is a A complex number is a number that has two parts: a real part and an imaginary part, written as
Learn more about Complex Number That number is the In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude for the outcome
Here:
is the bra corresponding to the A basis state in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states are and ; any other qubit state is a superposition of these. In systems with multiple qubits, basis states are all possible combinations of s and s (e.g., , , , and ), forming an orthonormal basis for the system’s Hilbert space.
Learn more about Basis State. When multiplied with a A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector it computes the projection In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude onto outcome. is the A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State It is a A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as. Vectors are used to represent quantities like velocity, force, or displacement.
Learn more about Vector of A complex number is a number that has two parts: a real part and an imaginary part, written as, where . The real part behaves like ordinary numbers, while the imaginary part represents a direction perpendicular to the real axis on the complex plane. Complex numbers let us represent and calculate quantities involving square roots of negative numbers.
Learn more about Complex Number called In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude These numbers are not probabilities yet, but they relate to them.is the state before the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit runs. In practice it is usually the A basis state in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states areand ; any other qubit state is a superposition of these. In systems with multiple qubits, basis states are all possible combinations of s and s (e.g., , , , and ), forming an orthonormal basis for the system’s Hilbert space.
Learn more about Basis State. is the state after the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit finishes.is the operator defined by the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit Mathematically, it is a single matrix formed by multiplying together the matrices for every gate in the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit in the exact order they are applied.
To make this idea concrete, we will use one small Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit example depicted in ?. It is simple, but it contains the core ideas of order, In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude manipulation, and projective In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement
This A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit has one A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit and three A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator, then The Z-gate changes the phase of the
Learn more about Z-Gate then The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator again.
At first glance, the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit diagram depicted in ? looks like a sequence of steps. That visual impression is exactly where intuition goes wrong.

When we the QuantumCircuit(1, 1), we are not running anything. We are defining the space the computation will live in. With one A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit that space is two-dimensional.
Each of the following lines a A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate We start with a Hadamard gate, followed by the Z gate, and end with a Hadamard gate.
Finally, we the qubit.
Applying a gate does not mean executing a command in a sequence of commands.
This is because a A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate is not an instruction but a matrix. So, the The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator corresponds to a fixed
Learn more about Z-Gate corresponds to another fixed
The The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator is represented by
The Z gate is represented by
Applying a gate simply means including its matrix as a factor in a matrix product.
Each gate you add changes the product, not by updating a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State but by extending the operator that will eventually act on the state.
After all three lines have been written, the circuit defines the following single operator:
This is the standard theoretical definition of a A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit A circuit is a product of A **unitary operator** is a linear operator ( U ) on a complex vector space that satisfies ( U^\dagger U = UU^\dagger = I ), meaning it preserves inner products. In simpler terms, it preserves the **length** and **angle** between vectors—so it represents a **reversible, norm-preserving transformation**. In quantum mechanics, unitary operators describe the evolution of isolated systems because they conserve probability.
Learn more about Unitary Operator such as the The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator, the The Z-gate changes the phase of the
Learn more about Z-Gate, and the The Hadamard operator, often denoted H, is a single-qubit quantum gate that creates an equal superposition of
Learn more about Hadamard Operator again. Altogether, the A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
Learn more about Quantum Circuit itself is a A **unitary operator** is a linear operator ( U ) on a complex vector space that satisfies ( U^\dagger U = UU^\dagger = I ), meaning it preserves inner products. In simpler terms, it preserves the **length** and **angle** between vectors—so it represents a **reversible, norm-preserving transformation**. In quantum mechanics, unitary operators describe the evolution of isolated systems because they conserve probability.
Learn more about Unitary Operator

At this stage, nothing has happened to a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State No In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude have changed. No probabilities exist yet. You have only specified which linear transformation will be applied to a A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State when the circuit is finally executed.
So, only when this operator is multiplied with an initial state does the computation actually take place.
The key line to run the computation is this one:
This tells Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit to take the default initial A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State
Learn more about Quantum Circuit
Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit is computing:
Mathematically, this is
Here, the column A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as
Learn more about Vector on the right is the initial state
Learn more about
This makes the meaning concrete: Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit multiplies three matrices together to form a single operator, and then multiplies that operator with the initial state A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as
Learn more about Vector to produce the final state.
Moreover, this is exactly why the phrase “the order of gates matters” is so often misunderstood.
When people hear that order matters, they instinctively reach for a familiar explanation. They assume gates must be commands that run one after another, changing the state step by step. Order matters in classical programs, so it must matter here for the same reason.
But that intuition is backwards.
The order does not matter because gates are commands. The order matters because Matrix multiplication combines two matrices by taking the dot product of rows from the first matrix with columns from the second. Each entry in the result is the sum of elementwise products between a row of the first and a column of the second. It only works when the number of columns in the first matrix equals the number of rows in the second.
Learn more about Matrix Multiplication is not The commutative property means that changing the order of numbers in an operation doesn’t change the result. It applies to addition and multiplication:
Learn more about Commutative Property
In plain language, the order of multiplication changes the result.
In code, swapping two lines does not make a small tweak. It defines a different operator
Since the output state is defined by
changing
Once you see the circuit as a matrix product instead of a command sequence, order stops being a programming concern and becomes a mathematical necessity.
Measuring the A quantum state is the complete mathematical description of a quantum system, containing all the information needed to predict measurement outcomes. It’s usually represented by a wavefunction or a state vector in a Hilbert space. The state defines probabilities, not certainties, for observable quantities like position, momentum, or spin.
Learn more about Quantum State is another place where intuition quietly breaks. At first, In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement appears as something completely different from the rest of the computation. A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate feel mathematical. In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement feels physical. As if the quantum math stops and reality takes over.
That is the wrong picture.
In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement does not replaces Matrix multiplication combines two matrices by taking the dot product of rows from the first matrix with columns from the second. Each entry in the result is the sum of elementwise products between a row of the first and a column of the second. It only works when the number of columns in the first matrix equals the number of rows in the second.
Learn more about Matrix Multiplication It is yet another linear operation applied to the final state.

Suppose, we have the state at the end of the circuit,
Learn more about Complex Number In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude of the state
To extract probabilities, Quantum mechanics is the branch of physics that describes the behavior of matter and energy at atomic and subatomic scales.
Learn more about Quantum Mechanics tells us to project the state onto the In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement basis. For a single A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit measured in the The computational basis is the standard set of basis states used to describe qubits in quantum computing. These are typically
Learn more about Computational Basis those A basis state in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states are
Learn more about Basis State are:
Mathematically, In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement asks two questions:
- What is the overlap of
with is a basis state.
Learn more about - What is the overlap of
with is a basis state.
Learn more about
That overlap is computed using an An inner product is a mathematical operation that takes two vectors and returns a single number measuring how similar or aligned they are. In Euclidean space, it’s the sum of the products of corresponding components (e.g.,
Learn more about Inner Product
For example, the In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude for outcome
This is a Matrix multiplication combines two matrices by taking the dot product of rows from the first matrix with columns from the second. Each entry in the result is the sum of elementwise products between a row of the first and a column of the second. It only works when the number of columns in the first matrix equals the number of rows in the second.
Learn more about Matrix Multiplication A row A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as
Learn more about Vector multiplied by a column A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as
Learn more about Vector
The probability of measuring
Likewise for outcome
In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
Learn more about Measurement is Linear algebra is the branch of mathematics that studies vectors, vector spaces, and linear transformations between them. It provides tools for solving systems of linear equations and understanding geometric operations like rotations, projections, and scaling. Its core objects—matrices and vectors—form the basis for much of modern computation, physics, and machine learning.
Learn more about Linear Algebra followed by squaring.
And that's the full structure of a quantum computation. Nothing mystical is happening.
From beginning to end, quantum computation is only Linear algebra is the branch of mathematics that studies vectors, vector spaces, and linear transformations between them. It provides tools for solving systems of linear equations and understanding geometric operations like rotations, projections, and scaling. Its core objects—matrices and vectors—form the basis for much of modern computation, physics, and machine learning.
Learn more about Linear Algebra It is a sequence of multiplications.
- The circuit composes quantum operators by multiplying their matrices
- Applying the circuit multiplies the circuit matrix with the A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as
. Vectors are used to represent quantities like velocity, force, or displacement.
Learn more about Vector to produce In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude - In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually
or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement multiplies row A vector is a mathematical object that has both magnitude (size) and direction. It’s often represented as an arrow or as an ordered list of numbers (components) that describe its position in space, such as. Vectors are used to represent quantities like velocity, force, or displacement.
Learn more about Vector with the final state to extract In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude - Squaring those In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude produces probabilities.
That sounds restrictive. It sounds like it removes intuition. In reality, it removes the wrong intuition. The classical idea of mutable state does not apply. What replaces it is stricter and more predictive.