Function satisfying $f(v,w) = f(Uv,Uw)$ for any vectors $v,w$ and unitary $U$ 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}$? 
 A: Yes. This is obvious if $V=0$. Suppose $V\ne0$. Pick a fixed unit vector $u\in V$. We consider three cases:


*

*$v=0$. Let $U$ be a unitary transform such that $w=\|w\|Uu$. Then $f(0,w)=f(U(0),U(\|w\|u))=f(0,\|w\|u)$. Hence it is a function in $\|w\|$.

*$v\ne0$ and $w$ is a scalar multiple of $v$. Let $U$ be any unitary transform such that $Uu=\frac{v}{\|v\|}$. Then
$$
f(v,w)
=f\left(U(\|v\|u),\ U\left(\frac{\langle w,v\rangle}{\|v\|}u\right)\right)
=f\left(\|v\|u,\ \frac{\langle w,v\rangle}{\|v\|}u\right)
$$
is a function of $\|v\|$ and $\langle w,v\rangle$.

*If $v$ and $w$ are linearly independent, $V$ is at least two-dimensional. Therefore, there exists a unit vector $u^\perp$ that is normal to $u$. Let $a=\frac{\langle w,v\rangle}{\|v\|}, b=\sqrt{\|w\|^2-\frac{|\langle w,v\rangle|^2}{\|v\|^2}}$. Then $w=a\frac{v}{\|v\|}+bv^\perp$ for some unit vector $v^\perp$ normal to $v$. Let $U$ be any unitary transform that maps $u$ to $\frac{v}{\|v\|}$ and $u^\perp$ to $v^\perp$. Then
$$
f(v,w)
=f\left(U(\|v\|u),\ U\left(au+bu^\perp\right)\right)
=f\left(\|v\|u,\ au+bu^\perp\right)
$$
is a function of $\|v\|,a$ and $b$. In turn, it is a function of $\|v\|,\|w\|$ and $\langle w,v\rangle$.

