Let $O\_n$ be the (real) orthogonal group of $n$ by $n$ matrices.
I am interested in the following sequence which showed up in a calculation I was doing
$$a\_k = \int\_{O\_n} (\text{Tr } X)^k dX$$
where the integral is taken with respect to the normalized Haar measure on $O\_n.$ I noticed some work of Dianconis et al. covers a more general set of moments, but essentially the formulas I saw only seem to hold for small $k.$ For the case of $O\_2$ the sequence looks like $a\_{2k} = \frac{1}{2}\binom{2k}{k},$ which can be calculated by hand since $O\_2$ has some special structure.


I was hoping there would be some general known formula (since, if I recall correctly, this calculates the multiplicity the trivial representation in a tensor power the standard representation of $O\_n$), or that it might be in the OEIS, but I don't know exactly what to look for, and don't know enough small terms to search.



Moments of the trace of orthogonal matrices

> 
> [Pastur and Vasilchuk](https://link.springer.com/article/10.1007/s00220-004-1231-3) have extended the result of [Diaconis and Evans](https://statistics.stanford.edu/sites/default/files/2000-24.pdf) for $a\_{2k}$ from $2k\leq n/2$ to $2k\leq n-1$:
> 
> 
> $$a\_{2k}=\pi^{-1/2}2^{k}\Gamma(k+1/2)\;\;\text{for}\;\;2k\leq n-1\quad\quad[\*]$$
> 
> 
> 


As suggested by Liviu Nicolaescu, for small $n$ you might directly integrate over the probability distribution of the eigenvalues in $O\_n$, which you can find [here.](https://en.wikipedia.org/wiki/Circular_ensemble#Generalizations) (This is the socalled "circular real ensemble" of random matrices.) 


$\bullet$ For $n=2$ one reproduces the result 
$$a\_{2k}=\frac{1}{\pi}\int\_0^{\pi/2}dx\,(2\cos x)^{2k}=\tfrac{1}{2}(2k)!(k!)^{-2}$$
you quoted above, which agrees with $[\*]$ for $k=1$ and $k=2$. (For $k=3$ it gives $10$ instead of $15$.)


$\bullet$ For $n=3$ one obtains
$$a\_{2k}=\frac{1}{2\pi}\int\_0^{2\pi}dx\,(1-\cos x)(1+2\cos x)^{2k}$$
which evaluates to
$$a\_2=1,\;\; a\_4=3,\;\; a\_6=15,\;\; a\_8=91,\;\;a\_{10}=603,\;\;a\_{12}=4213$$
in agreement with the [series](https://oeis.org/A099251/b099251.txt) of Qiaochu Yuan's answer. The formula $[\*]$ for $a\_{2k}$ holds for $k\leq 3$ (for $k=4$ it gives $105$ instead of $91$).


$\bullet$ For $n=4$ one finds
$$a\_{2k}=\frac{1}{8\pi^2}\int\_0^{2\pi}dx\int\_0^{2\pi}dy\,(\cos x-\cos y)^2(2\cos x+2\cos y)^{2k}$$
$$\quad\quad+\frac{1}{2\pi}\int\_0^{2\pi}dz\,(1-\cos^2 z)(2\cos z)^{2k}$$
which evaluates to
$$a\_2=1,\;\;a\_4=3,\;\;a\_6=15,\;\;a\_8=105,\;\;a\_{10}=903,\;\;a\_{12}=8778.$$
Now the formula $[\*]$ for $a\_{2k}$ holds for $k\leq 4$ (for $k=5$ it gives $945$ instead of $903$).


$\bullet$ Continuing with $n=5$, we have
$$a\_{2k}=\frac{1}{2\pi^2}\int\_0^{2\pi}dx\int\_0^{2\pi}dy\,(1-\cos x)(1-\cos y)(\cos x-\cos y)^2(1+2\cos x+2\cos y)^{2k}$$
which evaluates to
$$a\_2=1,\;\;a\_4=3,\;\;a\_6=15,\;\;a\_8=105,\;\;a\_{10}=945,\;\;a\_{12}=10263.$$
The formula $[\*]$ for $a\_{2k}$ holds for $k\leq 5$ (for $k=6$ it gives $10395$ instead of $10263$).



> 
> I am now tempted to $$\text{conjecture}\quad\quad a\_{2k}=\pi^{-1/2}2^{k}\Gamma(k+1/2)=(2k-1)!!\;\;\text{for}\;\;k\leq n\quad\quad[\*\*]$$
>  thus doubling the range of validity of $[\ast]$. Is it true?
> 
> 
> 


