Closed-form formula for $E_{x}[\max(u^\top x,0)\max(v^\top x ,0)]$ where $u,v$ are fixed vectors in $\mathbb R^d$ and $x$ is uniform on the sphere Let $x$ be uniformly distributed on the unit-sphere in $\mathbb R^d$ and let $u,v$ be fixed nonparallel vectors in $\mathbb R^d$

Question. Is there a closed-form formula for $f(u,v) := \mathbb E_{x}[\max(u^\top x,0)\max(v^\top x ,0)]$ ?

Due to rotationational symmetry of the distribution of $x$, my guess is that $f(u,v)$ admits a simple expression in terms of the angle between $u$ and $v$.
 A: We can look at normalized vector: $f(u,v) = ||u||\cdot||v||\cdot f\Big(\frac{u}{||u||}, \frac{v}{||v||}\Big)$, so let us assume that $u$ and $v$ are normalized. Then we can write $v = \rho u + \sqrt{1-\rho^2} u_2$ with $\rho = (u^Tv) \in [-1,1]$ and $u_2$ unitary orthogonal to $u$, and then complete $(u,u_2)$ into an orthogonal base of $\mathbb{R}^d$, and look at coordinates $(x_1,...,x_d)$ in that base.

Initial remarks:

*

*the volume $V_k$ of the unit ball $B_k$ in $\mathbb{R}^k$ is $V_k = \frac{\pi^{k/2}}{\Gamma(k/2+1)}$


*the density of $(R, \theta)$ s.t. $(R\cos(\theta), R\sin(\theta))$ is uniformly distributed on the unit disk is $\frac{R}{\pi}dRd\theta$

\begin{align*}
f(u,v) & = \displaystyle{\int_{B_d}} \max(x_1, 0)\max\big(\rho x_1 + (1-\rho)x_2, 0\big)\frac{dx_1...dx_d}{V_d} \\
 & = \displaystyle{\int_0^1} \displaystyle{\int_{-\pi}^{\pi}} \max(r\cos(\theta),0)\max(\rho r\cos(\theta) + \sqrt{1-\rho^2}r\sin(\theta),0) \cdot r d\theta \cdot \frac{(1-r^2)^{d/2-1} V_{d-2}}{V_d} dr \\
 & = \displaystyle{\int_{-\pi}^{\pi}} \max(\cos(\theta),0)\max(\rho \cos(\theta) + \sqrt{1-\rho^2}\sin(\theta), 0)d\theta \cdot \displaystyle{\int_0^1} r^3 (1-r^2)^{d/2-1} dr \cdot \frac{d}{2 \pi}\end{align*}
where $(1-r^2)^{(d-2)/2} V_{d-2}$ stems from the integration over $x_3,...,x_d$ with $(x_1,...,x_d) \in B_d$ and $x_1^2+x_2^2=r^2$, and on the last line we use our formula for $V_d$ and $V_{d-2}$.
Let us compute the two integrals. The second one is simpler:
$$\displaystyle{\int_0^1} r^3(1-r^2)^{d/2-1}dr = \Big[-\frac{(1-r^2)^{d/2} \big(2 + dr^2\big)}{d(d+2)}\Big]_0^1 = \frac{2}{d(d+2)}$$
In the first integral, the integrand is non zero iff $\theta \in \big[-\frac{\pi}{2}, \frac{\pi}{2}\big]$ and $\rho \cos(\theta) + \sqrt{1-\rho^2} \sin(\theta)$, so iff $\theta \in \big[0, \frac{\pi}{2}\big]$ or $-\mbox{Arctan}\big(\frac{\rho}{\sqrt{1-\rho^2}}\big) \le \theta \le 0$. Let us denote $\theta_0 = -\mbox{Arctan}\big(\frac{\rho}{\sqrt{1-\rho^2}}\big)$.
Thus the integral is \begin{align*} \displaystyle{\int_{\theta_0}^{\frac{\pi}{2}}} \rho \cos(\theta)^2 + \sqrt{1-\rho^2} \cos(\theta)\sin(\theta)d\theta & = \frac{2\sqrt{1-\rho^2}\cos(\theta_0)^2 + \rho(\pi - 2\theta_0 - \sin(2\theta_0))}{4} \\
 & = \frac{\rho \pi + 2\sqrt{1-\rho^2} + 2\rho \mbox{Arctan}\big(\frac{\rho}{\sqrt{1-\rho^2}}\big)}{4} \end{align*}
To conclude, $$\mbox{with } \rho = \frac{(u^Tv)}{\sqrt{(u^Tu)(v^Tv)}}, \quad f(u,v) = \sqrt{(u^Tu)(v^Tv)} \cdot \frac{\rho \pi + 2\sqrt{1-\rho^2} + 2\rho \mbox{Arctan}\big(\frac{\rho}{\sqrt{1-\rho^2}}\big)}{4(d+2)\pi}.$$

Nota bene: if it can make you any less dubious about the previous computations, I made some Python simulations with $d=2$ and $d=3$ and Monte-Carlo simulations coincide with the theoretical formula.
A: Disclaimer. This is just to simplify @chamd's answer and make it more "recognisable", and draw some links to standard machine-learning theory terminology (kernel methods).
So, @chamd's has proved that $f(u,v) = \|u\|\|v\|\phi(\frac{u^\top v}{\|u\|\|v\|})$,
where $\phi:[-1,1] \to \mathbb R$ is defined by $\phi(t) = \dfrac{\pi t + 2 \sqrt{1-t^2} + 2t\arctan(\frac{t}{\sqrt{1-t^2}})}{4(d+2)\pi}$.
We're in the $uv$-plane and $t \in [-1,1]$ is nothing but the height a point  $P=(\sqrt{1-t^2},t)$ on the unit circle in this plane. The angle pointint the positive $v$ axis ray $OP$ is given by $\theta = \arctan(t/\sqrt{1-t^2})$. By inspecting the geometry of the situation (basically drawing a diagram on a piece of paper...), it is evident that we can rewrite $\theta = \arccos(t)$. Thus, we can rewrite the function $\phi$ as
$$
\begin{split}
\phi(t) &= \dfrac{\pi t + 2 \sqrt{1-t^2} + 2t\arccos(t)}{4\pi} = \frac{t(\pi + 2\arccos(t)) + 2\sqrt{1-t^2}}{4\pi}\\
&= \frac{t(\pi - \arccos(t)) + \sqrt{1-t^2}}{2\pi}\\
&= \frac{t\arccos(-t) + \sqrt{1-t^2}}{2\pi}.
\end{split}
$$
Now is the time for the harvest.

*

*The second line in the above display is nothing but the main ingredient in so-called arc-cosine kernels: these is the kernel for the Gaussian process which emerges when one looks at infinite-width limit of neural networks with ReLU activations, width the weights initialized at random. More precisely, $f \sim (1/(d+2))K_{ReLU}$.

*Noting that, for large $d$, (1) The individual coordinates of a point sampled uniformy at random the unit sphere in $\mathbb R^d$ is roughly distributed as $\mathcal N(0,1/d)$, and (2) The pairwise correlations of the coordinates is approximately zero, we could have expected $f(u,v)$ to be approximately equal to $\mathbb E_{z \sim \mathcal N(0,1/d)}[\max(u^\top z, 0)\max(v^\top z, 0)] = (1/d)K_{ReLU}(u,v)$.

