  We show the linearity and injectivity of two maps $\phi_1$ and $\phi_2$
between certain subsets of matrix spaces that satisfy
$\operatorname{tr}(\phi_1(A)\phi_2(B))=\operatorname{tr}(AB)$. We apply it to
characterize maps $\phi_i$ ($i=1, \ldots, m$) satisfying $$\operatorname{tr}
(\phi_1(A_1)\cdots \phi_m(A_m))=\operatorname{tr} (A_1\cdots A_m)$$ on maps
$\mathcal{S}\to \mathcal{S}$ in which $\mathcal{S}$ is the set of $n$-by-$n$
general or Hermitian matrices for $m\ge 3$ and positive definite matrices for
$m\ge 2$, and on completely positive maps $M_n\to M_n$ for $m\ge 2$. Then we
give several equivalent characterizations of invertible completely positive
maps, that is, $\phi: M_n\to M_k$ and $\psi:M_k\to M_n$ such that
$\psi(\phi(A))=A$ for $A\in M_n$, and provide a comprehensive list of such
examples. These maps are connected to the trace-of-product preserving property
and are useful in quantum information theory. In addition, we show that a
linear map $\phi$ between matrix spaces satisfies $\phi(I)=I$ and
$\phi(A^k)=\phi(A)^k$ for a fixed integer $k\ge 2$ if and only if
$\phi(A^r)=\phi(A)^r$ for all $r\in {\mathbb Z}_+$. We characterize maps $\phi,
\psi: \mathcal{S} \to \mathcal{S}$ satisfying $\operatorname{tr}
(\phi(A)\psi(B))=\operatorname{tr} (AB)$ and $\operatorname{tr}
(\phi(A)\psi(B)^k)=\operatorname{tr} (AB^k)$ for a fixed $k\ge 2$, where
$\mathcal{S}$ is the set of general or Hermitian matrices.
