TITLE: Is there a formula for the expansion coefficients of powers of an inner product?
QUESTION [11 upvotes]: I would like to expand the following expression
$$\left(\sum_{i,j=1}^N \,x_i A_{ij} x_j\right)^n$$
where $\mathbf A$ is a symmetric $N\times N$ matrix, $\mathbf {x}$ is an $N$-component vector, and $n$ is a non-negative integer power.  The expansion of this expression yields a homogeneous polynomial of order $2n$ in the $x_k$.
What is the coefficient of the term $x_1^{p_1} x_2^{p_2} \cdots x_N^{p_N}$ for $p_1 + p_2 + \cdots + p_N = 2n$ in the expansion of this expression?
Has the formula been worked out before?

REPLY [2 votes]: Here is an answer using the symmetry of the inner product and based upon the multinomial theorem.
From the multinomial theorem
\begin{align*}
\left(\sum_{i=1}^Nx_i\right)^n=\sum_{k_1+k_2+\cdots+k_N=n}\binom{n}{k_1,k_2,\ldots,k_N}
\prod_{t=1}^{N}x_t^{k_t}\tag{1}
\end{align*}

we obtain
  \begin{align*}
\left(\sum_{i,j=1}^Nx_iA_{i,j}x_j\right)^n&=\left(\sum_{i=1}^NA_{i,i}x_i^2+2\sum_{1\leq i<j\leq N} A_{i,j}x_ix_j\right)^n\tag{2}\\
&=\sum_{k=0}^n\binom{n}{k}\left(\sum_{i=1}^NA_{i,i}x_i^2\right)^k
\left(\sum_{1\leq i<j\leq N}A_{i,j}x_ix_j\right)^{n-k}2^{n-k}\tag{3}
\end{align*}
  with
  \begin{align*}
\left(\sum_{i=1}^NA_{i,i}x_i^2\right)^k&=\sum_{k_1+k_2+\cdots+k_N=k}
\binom{k}{k_1,k_2,\ldots,k_N}\prod_{t=1}^NA_{t,t}^{k_t} x_t^{2k_t}\\
\left(\sum_{1\leq i<j\leq N}A_{i,j}x_ix_j\right)^{n-k}&=
\sum_{l_{1,2}+l_{1,3}+\cdots+l_{N-1,N}=n-k}\binom{n-k}{l_{1,2},l_{1,3},\ldots,l_{N-1,N}}
\prod_{1\leq u<v\leq N}\left(A_{u,v}x_ux_v\right)^{l_{u,v}}
\end{align*}

Comment:

In (2) we use the symmetry $A_{i,j}=A_{j,i},1\leq i<j\leq N$ and separate  sums accordingly.
In (3) we apply the binomial theorem and prepare this way the application of the multinomial theorem for two parts.