Matrix Multiplication
Applying a quantum gate to a qubit state is matrix-vector multiplication, the fundamental operation in quantum computing
Source: mortalapps.com- Matrix multiplication is the mathematical operation that represents applying a quantum gate to a qubit state.
- To multiply matrices $A$ and $B$, the number of columns in $A$ must equal the number of rows in $B$.
- Each element of the resulting matrix is calculated by taking the dot product of a row from the first matrix and a column from the second.
- Matrix-vector multiplication is a special case where a matrix transforms a vector into a new vector.
- Matrix multiplication is generally not commutative, meaning the order of operations matters significantly.
- This operation is fundamental to how quantum states evolve and how quantum circuits are simulated and executed.
Why This Matters
Applying a quantum gate to a qubit is the core action in quantum computation. Mathematically, this action is represented by matrix multiplication. When a quantum gate (which is a matrix) acts on a qubit's state (which is a vector), the result is a new state vector, obtained through matrix-vector multiplication.
Understanding matrix multiplication is absolutely fundamental because it describes how quantum states evolve. It's the engine that drives quantum circuits, allowing us to transform qubits from one superposition to another, entangle them, and ultimately perform computations.
By the end of this topic, you will understand the rules of matrix multiplication, how to perform it, and critically, how it represents the application of quantum gates to qubit states.
Core Intuition
Imagine you have a set of instructions for building a toy (a matrix) and a pile of raw materials (a vector). Matrix multiplication is like following those instructions step-by-step to assemble the toy. Each instruction in the matrix tells you how to combine specific parts of your raw materials to create a new component of the final toy.
Another way to think about it is combining transformations. If you first rotate an object, and then you stretch it, you've applied two transformations sequentially. Matrix multiplication allows you to combine these two separate transformation matrices into a single matrix that represents the *net effect* of both operations. The order matters: rotating then stretching might give a different result than stretching then rotating.
For matrix-vector multiplication, think of the matrix as a 'mixer' or 'blender.' It takes the ingredients (components of the input vector) and mixes them together according to its internal recipe (the matrix elements) to produce a new set of ingredients (components of the output vector).
Visualization
Technical Explanation
Matrix multiplication is a more complex operation than addition, and it's not element-wise. To multiply two matrices $A$ and $B$ to get $C = AB$, the number of columns in $A$ must equal the number of rows in $B$. If $A$ is an $m \times n$ matrix and $B$ is an $n \times p$ matrix, the resulting matrix $C$ will be an $m \times p$ matrix.
The element $C_{ij}$ (in the $i$-th row and $j$-th column of $C$) is found by taking the dot product of the $i$-th row of $A$ and the $j$-th column of $B$. This means you multiply corresponding elements and sum the results: $$C_{ij} = \sum_{k=1}^{n} A_{ik} B_{kj}$$
For example, if $A = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$ and $B = \begin{pmatrix} e & f \\ g & h \end{pmatrix}$, then $C = AB$ is: $$C = \begin{pmatrix} ae+bg & af+bh \\ ce+dg & cf+dh \end{pmatrix}$$
Matrix-Vector Multiplication: This is a special and very important case where the second 'matrix' is actually a column vector. If $A$ is an $m \times n$ matrix and $\vec{v}$ is an $n \times 1$ column vector, the result $A\vec{v}$ is an $m \times 1$ column vector. Each component of the resulting vector is the dot product of a row of $A$ with the vector $\vec{v}$.
For a $2 \times 2$ matrix $U$ (a quantum gate) and a $2 \times 1$ state vector $|\psi\rangle$: $$U |\psi\rangle = \begin{pmatrix} u_{11} & u_{12} \\ u_{21} & u_{22} \end{pmatrix} \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \begin{pmatrix} u_{11}\alpha + u_{12}\beta \\ u_{21}\alpha + u_{22}\beta \end{pmatrix}$$
Crucial Point: Matrix multiplication is generally not commutative, meaning $AB \neq BA$. The order in which you apply quantum gates matters significantly!