# Matrix Multiplication and Heisenberg Uncertainty Principle

We now understand that Matrix multiplication is not commutative (Why?). What has this have to do anything with Quantum Mechanics ?

Behold the commutator operator:
$[\hat{A}, \hat{B}] = \hat{A}\hat{B} - \hat{B}\hat{A}$

where $\hat{A},\hat{B}$ are operators that are acting on the wavefunction $\psi$. This is equal to 0 if they commute and something else if they don’t.

One of the most important formulations in Quantum mechanics is the Heisenberg’s Uncertainty principle and it can be written as the commutation of the momentum operator (p) and the position operator (x):

$[\hat{p}, \hat{x}] = \hat{p}\hat{x} - \hat{x}\hat{p} = i\hbar$

If you think of p and x as some Linear transformations. (just for the sake of simplicity).

This means that measuring distance and then momentum is not the same thing as measuring momentum and then distance. Those two operators do not commute! You can sort of visualize them in the same way as in the post.

But in Quantum Mechanics, the matrices that are associated with $\hat{p}$ and $\hat{x}$ are infinite dimensional. ( The harmonic oscillator being the simple example to this )

$\hat{x} = \sqrt{\frac{\hbar}{2m \omega}} \begin{bmatrix} 0 & \sqrt{1} & 0 & 0 & \hdots \\ \sqrt{1} & 0 &\sqrt{2} & 0 & \hdots \\ 0 & \sqrt{2} & 0 &\sqrt{3} & \hdots \\ 0 & 0 & \sqrt{3} & 0 & \hdots \\ \vdots & \vdots & \vdots & \vdots \end{bmatrix}$

$\hat{p} = \sqrt{\frac{\hbar m \omega}{2}} \begin{bmatrix} 0 & -i & 0 & 0 & \hdots \\ i & 0 & -i \sqrt{2} & 0 & \hdots \\ 0 & i\sqrt{2} & 0 &\-i \sqrt{3} & \hdots \\ 0 & 0 & i\sqrt{3} & 0 & \hdots \\ \vdots & \vdots & \vdots & \vdots \end{bmatrix}$

# Why on earth is matrix multiplication NOT commutative ? – Intuition

One is commonly asked to prove in college as part of a linear algebra problem set that matrix multiplication is not commutative. i.e If A and B are two matrices then :

$AB \neq BA$

But without getting into the Algebra part of it, why should this even be true ? Let’s use linear transformations to get a feel for it.

If A and B are two Linear Transformations namely Rotation and Shear. Then it means that.

$(Rotation)(Shearing) \neq (Shearing)(Rotation)$

Is that true? Well, lets perform these linear operations on a unit square and find out:

(Rotation)(Shearing)

(Shearing)(Rotation)

You can clearly see that the resultant shape is not the same upon the two transformations. This means that the order of matrix multiplication matters a lot ! ( or matrix multiplication is not commutative.)