  The $U^2$ norm gives a useful measure of quasirandomness for real- or
complex-valued functions defined on finite (or, more generally, locally
compact) groups. A simple Fourier-analytic argument yields an inverse theorem,
which shows that a bounded function with a large $U^2$ norm defined on a finite
Abelian group must correlate significantly with a character. In this paper we
generalize this statement to functions that are defined on arbitrary finite
groups and that take values in M$_n(\mathbb C)$. The conclusion now is that the
function correlates with a representation -- though with the twist that the
dimension of the representation is shown to be within a constant of $n$ rather
than being exactly equal to $n$. There are easy examples that show that this
weakening of the obvious conclusion is necessary. The proof is much less
straightforward than it is in the case of scalar functions on Abelian groups.
  As an easy corollary, we prove a stability theorem for near representations.
It states that if $G$ is a finite group and $f:G\to$M$_n(\mathbb C)$ is a
function that is close to a representation in the sense that $f(xy)-f(x)f(y)$
has a small Hilbert-Schmidt norm (also known as the Frobenius norm) for every
$x,y\in G$, then there must be a representation $\rho$ such that $f(x)-\rho(x)$
has small Hilbert-Schmidt norm for every $x$. Again, the dimension of $\rho$
need not be exactly $n$, but it must be close to $n$. We also obtain stability
theorems for other Schatten $p$-norms. A stability theorem of this kind was
obtained for the operator norm by Grove, Karcher and Ruh in 1974 and in a more
general form by Kazhdan in 1982. (For the operator norm, the dimension of the
approximating representation is exactly $n$.)
