In our previous paper [EV2], to every finite-dimensional
representation of the quantum group we
attached the trace function with values in which was obtained by taking the (weighted) trace in a
Verma module of an intertwining operator. We showed that these
trace functions satisfy the Macdonald-Ruijsenaars and quantum
Knizhnik-Zamolodchikov-Bernard (qKZB) equations, their dual
versions, and the symmetry identity. In this paper, we show that
the trace functions satisfy the orthogonality relation and the
qKZB-heat equation. For , this statement is
the trigonometric degeneration of a conjecture from [FV3],
proved in [FV3] for the 3-dimensional irreducible .
We also establish the orthogonality relation and the qKZB-heat
equation for trace functions that were obtained by taking traces
in finite-dimensional representations (rather than in Verma
modules). If and ,
these functions are known to be Macdonald polynomials of type .
In this case, the orthogonality relation reduces to the Macdonald
inner product identities, and the qKZB-heat equation coincides
with the q-Macdonald-Mehta identity that was proved by Cherednik
[Ch2].