Consider two randomly chosen vectors $(a,b)$ and $(c,d)$ within the unit square, where $a, b, c,$ and $d$ are chosen uniformly from $[0,1]$. What is the expected angle between the vectors?
Here's what I have so far. The angle between any two positive vectors $<a,b>$ and $<c, d>$ is $\arccos{\frac{ac + bd}{\sqrt{(a^2 + b^2)(c^2 + d^2)}}}$. We just need to find the average value of this function over $a, b, c,d$ in range $[0,1]$. This is equivalent to the quadrupal integral $$\iiiint_V \arccos{\frac{ac + bd}{\sqrt{(a^2 + b^2)(c^2 + d^2)}}} \,da\,db\,dc\,dd$$.
I can't find any way to compute this. I entered this into Mathematica and it wasn't able to output even a decimal approximation. I tried all the usual substitions to reduce this into a double integral but none of them worked. Converting to polar coordinates didn't work out nicely either. For one, the bounds become harder to work with and the jacobian is pretty nasty, so converting doesn't seem like it would help me. Probably the difficult part is working with the $\arccos$ function. I have no idea how to deal with it.
Is it possible that there is an analytic solution to this integral? Even if someone found a numerical approximation, it would help me out.
Attempt to compute the 4-d integral is a wrong approach.
For this sort of problem, the first thing to do is minimize the numbers of variable you need to work with as much as possible. In this case, you can work with the angles of the two vectors directly.
Let
The average angle you want is the expected value of $|\theta_1 - \theta_2| = \theta_M - \theta_m$,
To compute this, we need the CDF for $\theta_m$ and $\theta_M$.
$$\begin{align} \verb/CDF/_{\theta_m}(\theta) &\stackrel{def}{=} \verb/P/[ \theta_m \le \theta ] = \verb/P/[ \theta_1 \le \theta \lor \theta_2 \le \theta ]\\ &= 1 - \verb/P/[\theta_1 > \theta \land \theta_2 > \theta ] = 1 - \verb/P/[\theta_1 > \theta]\verb/P/[\theta_2 > \theta]\\ &= 1 - (1 - f(\theta))^2\\ \verb/CDF/_{\theta_M}(\theta) &\stackrel{def}{=} \verb/P/[ \theta_M \le \theta ] = \verb/P/[ \theta_1 \le \theta \land \theta_2 \le \theta ] = \verb/P/[\theta_1 \le \theta]\verb/P/[\theta_2 \le \theta ]\\ &= f(\theta)^2 \end{align}$$
This allows us to express the average angle as an integral
$$\begin{align}\mathcal{A} \stackrel{def}{=} \verb/E/\big[ |\theta_1 - \theta_2| \big] & = \verb/E/[\theta_M - \theta_m] = \int_0^\frac{\pi}{2} \theta (\verb/CDF/'_{\theta_M} - \verb/CDF/'_{\theta_m}) d\theta\\ &= \int_0^{\frac{\pi}{2}} \theta [ f^2(\theta) - 1 + (f(\theta)-1)^2 ]' d\theta\\ &= 2 \int_0^{\frac{\pi}{2}} \theta [ f(\theta)(f(\theta)-1) ]' d\theta \end{align} $$ Integrate by part and notice $f(\theta) + f(\frac{\pi}{2} - \theta) = 1$, we find
$$\mathcal{A} = 2 \int_0^{\pi/2} f(\theta)(1 - f(\theta)) d\theta = 4\int_0^{\pi/4} f(\theta)(1 - f(\theta)) d\theta$$ It is easy to see $\;f(\theta) = \frac12\tan\theta\;$ for $\;\theta \in [0,\frac{\pi}{4}]$. Change variable to $t = \tan\theta$ and integrate, the end result is:
$$\mathcal{A} = \int_0^1 \frac{t(2-t)}{1+t^2} dt = \frac{\pi}{4} + \log(2) - 1$$