How can one compute each of the following matrices, explicitly:


$$\int\_{O(n)} e^{g}dg$$ or
$$\int\_{O(n)} g^{n}dg \;\;\;\;n\in \mathbb{N} \;\;n>1$$
What is the explicite entries of the resulting matrices, for $n=2$?


Moreover, for $n,m\in \mathbb{Z}$ define the linear operator $T\_{n,m}$ on $M\_{n}(\mathbb{R})$ as follow:
$$T\_{n,m}(A)=\int\_{O(n)}g^{n}Ag^{m}$$
Under what suficcient and necessary condition, $T\_{n,m}$ is conjugate to $T\_{n',m'}$? Is there an explicit formulation for $T\_{n,m}$?


The integration is based on the Haar measear defined on orthogonal group $O(n)$.



Some calculus in the orthogonal group $O(n)$
let me work out the comments a bit further, starting from the identity (equation 8.2 from [Diaconis and Evans](http://statweb.stanford.edu/~cgates/PERSI/papers/functionals.pdf), correcting an earlier [paper](http://statweb.stanford.edu/~cgates/PERSI/papers/random_matrices.pdf) by Diaconis and Shahshahani)


$$\int\_{{\rm O}(n)}{\rm tr}\,g^p\,dg=\begin{cases}
0&{\rm if}\;\;p\;\;\text{is an odd integer}\\
1&{\rm if}\;\;p\;\;\text{is an even integer}
\end{cases}
$$


so the second integral of the OP evaluates to
$$\int\_{{\rm O}(n)}g^p\,dg=\begin{cases}
0&{\rm if}\;\;p\;\;\text{is an odd integer}\\
n^{-1}\mathbb{1}&{\rm if}\;\;p\;\;\text{is an even integer}
\end{cases}
$$


Taylor expansion of the exponent in the first integral of the OP and term-by-term integration gives
$$
\int\_{{\rm O}(n)}e^g\,dg=n^{-1}\mathbb{1}\sum\_{p=0}^\infty \frac{1}{(2p)!}=\frac{\cosh 1}{n}\mathbb{1}
$$


now for the third integral of the OP, we need the fourth-order tensor
$$\int\_{{\rm O}(n)}(g^p)\_{ij}(g^q)\_{kl}\,dg=a\_{pq}(n)\delta\_{ij}\delta\_{kl}+b\_{pq}(n)\delta\_{ik}\delta\_{jl}+c\_{pq}(n)\delta\_{il}\delta\_{jk}$$
so that the required integral takes the form
$$\int\_{{\rm O}(n)}g^p Ag^q\,dg=a\_{pq}(n)A+b\_{pq}(n)A^{\rm t}+c\_{pq}(n)\mathbb{1}\,{\rm tr}\,A
$$
by taking traces I find, using again equation 8.2 from [Diaconis and Evans](http://statweb.stanford.edu/~cgates/PERSI/papers/functionals.pdf), that
$$na\_{pq}(n)+nb\_{pq}(n)+n^2 c\_{pq}(n)=\int\_{{\rm O}(n)}{\rm tr}\,g^{p+q}\,dg=\begin{cases}
0&{\rm if}\;\;p+q\;\;\text{is an odd integer}\\
1&{\rm if}\;\;p+q\;\;\text{is an even integer}
\end{cases}
$$
$$n^2a\_{pq}(n)+nb\_{pq}(n)+nc\_{pq}(n)=\int\_{{\rm O}(n)}({\rm tr}\,g^p)({\rm tr}\,g^q)\,dg=\begin{cases}
{\rm min}\,(p,2n)&{\rm if}\;\;p=q\;\;{\rm odd}\\
{\rm min}\,(p,2n)+1&{\rm if}\;\;p=q\;\;{\rm even}\\
1&{\rm if}\;\;p\neq q\;\;\text{both even}\\
0&{\rm otherwise}
\end{cases}
$$
$$na\_{pq}(n)+n^2 b\_{pq}(n)+nc\_{pq}(n)=\int\_{{\rm O}(n)}{\rm tr}\,g^{|p-q|}\,dg=\begin{cases}
0&{\rm if}\;\;p+q\;\;\text{is an odd integer}\\
1&{\rm if}\;\;p+q\;\;\text{is an even integer}
\end{cases}
$$
Three equations with three unknowns solves the third integral.


