If I have two operators or finite-dimensional matrices $A$ and $B$, how can I quantify the amount to which they commute or don't commute? (I would consider it a big plus if it is computable easily for finite complex-valued matrices $A, B \in \mathbb C^{n\times n}$.)

Let me try the obvious thing here: by definition if $A$ and $B$ commute, then the commutator $[A, B] = AB-BA = 0$. Naively would use some sort of functional like an operator norm to reduce this to a number that could potentially behave like a metric. The first thing I thought of was the trace, but clearly that doesn't work since $\mathrm{tr } [A, B] =\mathrm{tr } (AB-BA) = \mathrm{tr }AB - \mathrm{tr }AB = 0$ always. One could then turn to, say, the Frobenius norm of $[A, B]$. What is known about the maximal (or supremal) value of such norms?

Are there quantifiers of noncommutativity that can also account for higher-order effects, e.g. cases where $[A, B] \ne 0$ but $[A, [A,B]] = 0$? This should be "less" non-commuting than if $[A, B] \ne 0$ and $[A, [A,B]] \ne 0$ and $[B, [A,B]] \ne 0$ but, say, $[A, [B, [A, B]]] = 0$.

For those who prefer a free algebraic setting, the question can be framed as: how free is a non-free algebra? Is there a sensible way to measure proximity to a free algebra? What if I had an algebra where $AB=BA$ is the only one relation that makes it not a free algebra; is there a sense it is "less free" or "more free" than an algebra where $ABABAB=BAA$ is the only such relation, or example.

Motivation: it is sometimes said that free probability is the study of "maximally" non-commuting objects. I would like to know if this statement can be made precise in the sense of how one can define "maximally non-commuting" in a sensible fashion.

maximally non commutingas «they generate a free algebra.» – Mariano Suárez-Alvarez♦ May 11 '12 at 17:48