If I have a function $f: V\times V\to \mathbb{R}$ where $V$ is an inner product space over $\mathbb{R}$ and for all unitary matrices $U \in \mathcal{L}(V)$ I have
$$f(v,w) = f(Uv,Uw)$$
can I conclude that $f$ is a function of the inner products $v\cdot w, v\cdot v, w\cdot w$ alone? I am motivated to ask this because I do not know of any other ways to combine two vectors into a real number which is invariant under $v\to U v$ (i.e. orthonormal basis independent). But I am failing to find a way to prove it. How about if the target space is not necessarily $\mathbb{R}$?
Yes. This is obvious if $V=0$. Suppose $V\ne0$. Pick a fixed unit vector $u\in V$. We consider three cases: