  We prove an exact formula for the variance of the divisor function over short
intervals in $\mathcal{A} := \mathbb{F}_q [T]$, where $q$ is a prime power. A
slight adaption of the proof allows us to obtain an exact formula for
correlations of the form $d(A) d(A+B)$, where we average both $A$ and $B$ over
certain intervals in $\mathcal{A}$. We also consider correlations of the form
$d(KQ+N) d (N)$, where $Q$ is prime and $K$ and $N$ are averaged over certain
intervals. If $\mathrm{deg } K < \mathrm{deg } Q -1$, then these correlations
appear in the off-diagonal terms for the fourth moment of Dirichlet
$L$-functions. We consider the case $\mathrm{deg } K \geq \mathrm{deg }Q -1$
and obtain an exact formula for the correlations. Further, we demonstrate that
$d(KQ+N)$ and $d (N)$ are uncorrelated for the given ranges of $K$ and $N$. Our
approach to these problems is to use the orthogonality relations of additive
characters on $\mathbb{F}_q$ to translate the problems to ones involving the
ranks of Hankel matrices over $\mathbb{F}_q$. Most of the paper is dedicated to
proving several results regarding the rank and kernel structure of these
matrices, and thus demonstrating their number-theoretic properties. We briefly
discuss extending our method to moments higher than the second (the variance)
over intervals; to the $k$-th divisor function; and to correlations of the
divisor function with applications to moments of Dirichlet $L$-functions in
function fields.
