TITLE: Invariant polynomials under diagonal action of the orthogonal group
QUESTION [5 upvotes]: Consider the diagonal action of the orthogonal group $O(n)$ on $\mathbb{R}^n\times\mathbb{R}^n$ defined as: $U\cdot (x,y) = (Ux,Uy)$ for $U\in O(n)$ and $x,y\in\mathbb{R}^n$. I am looking for a description of the algebra of polynomials in $\mathbb{R}[x,y]$ that are invariant under this action. That is, the subalgebra of all polynomials $p(x,y)$ such that $$p(Ux,Uy) = p(x,y)\, \quad \forall U\in O(n), \forall x, y\in\mathbb{R}^n.$$ 
I'll be interested in the generators of this invariant subalgebra, if possible. I have looked at several sources in Classical Invariant Theory but haven't found what I need yet. Any suggestion or references would be greatly appreciated.

REPLY [10 votes]: This is covered in Chapter 2, Section 9 (starting on page 52) in Weyl's The Classical Groups, Their Invariants and Representations.
As already answered, there you will find:
Theorem (Theorem 2.9.A) Every orthogonal invariant in vectors $x^1,...,x^m$ in $\mathbb{R}^n$ is expressible in terms of the $m^2$ scalar products $(x^i,x^j)$.