Separating $X$ from $Y$ in $E[(X^T Y))^p]$ for $p = 3$ and $4$? Let $X$ and $Y$ be random vectors with $X$ independent of $Y$. When dealing with terms of the form $E[(X^T Y)^p]$ for $p \ge 1$, it is very useful to be able to separate the $X$ from the $Y$.
For $p=1,2$, we have
$$
\begin{align}
E[X^T Y] &= E[X^T] E[Y], \\
E[(X^T Y)^2] &= Tr \left\{E \left[  X X^T \right] E\left[YY^T \right] \right\}.
\end{align}
$$
The second expression was proven here. I am wondering it is possible to obtain similar expressions for the cases $p=3$ and $p=4$ as some applications require us to go to fourth order:
$$
\begin{align}
E[(X^T Y)^3] &= \quad ? \\
E[(X^T Y)^4] &= \quad ? \\ 
\end{align}
$$
Does anyone know if it is possible to derive expressions that separate the $X$ from $Y$ in these cases? (Maybe a pattern will then become clear for all $p \ge 1$).
 A: The answer is that for nonnegative integer values $P$, it is in principle possible, but gets progressively more complicated as $P$ increases. To this end, one can write
\begin{align}
\mathbf{E} \left[ \left( X^T Y \right)^P\right] &= \mathbf{E} \left[ \left( \sum_{i = 1}^D X_i Y_i \right)^P \right] \\
&= \mathbf{E} \left[  \sum_{i_1 = 1}^D \sum_{i_2 = 1}^D \cdots \sum_{i_P = 1}^D \prod_{p = 1}^P X_{i_p} Y_{i_p} \right] \\
&= \sum_{i_1 = 1}^D \sum_{i_2 = 1}^D \cdots \sum_{i_P = 1}^D \mathbf{E} \left[   \prod_{p = 1}^P X_{i_p} Y_{i_p} \right] \\
&= \sum_{i_1 = 1}^D \sum_{i_2 = 1}^D \cdots \sum_{i_P = 1}^D \mathbf{E} \left[   \prod_{p = 1}^P X_{i_p}  \right] \cdot \mathbf{E} \left[   \prod_{p = 1}^P  Y_{i_p} \right].
\end{align}
However, the expressions like $\prod_{p = 1}^P X_{i_p}$ become more challenging to characterize concisely in closed form as $P$ grows.
For a concrete example, consider when $P = 3$, and assume that the coordinates of $X$ and $Y$ are each iid. The above expression can then be simplified to
\begin{align}
\sum_{i_1 = 1}^D \sum_{i_2 = 1}^D \sum_{i_3 = 1}^D \mathbf{E} \left[   \prod_{p = 1}^3 X_{i_p}  \right] \cdot \mathbf{E} \left[   \prod_{p = 1}^3  Y_{i_p} \right] &= D \cdot \mathbf{E} \left[ X^3 \right] \cdot \mathbf{E} \left[ Y^3 \right] \\
&+ 3D(D - 1) \cdot \mathbf{E} \left[ X \right] \cdot \mathbf{E} \left[ X^2 \right] \cdot \mathbf{E} \left[ Y \right] \cdot \mathbf{E} \left[ Y^2 \right] \\
&+ D(D-1)(D-2) \cdot \mathbf{E} \left[ X \right] ^3 \cdot \mathbf{E} \left[ Y \right]^3.
\end{align}
