TITLE: Compute integral $\int_0^1\int_0^1\int_0^1 \sqrt{x^2+y^2+z^2} \,\mathrm{d}x\mathrm{d}y\mathrm{d}z$
QUESTION [7 upvotes]: How to Compute 
$$\int_0^1\int_0^1\int_0^1 \sqrt{x^2+y^2+z^2} \,\mathrm{d}x\mathrm{d}y\mathrm{d}z $$
The Mathematica 9.01 give a result is $$-\frac{\pi}{24}+\frac{1}{4}(\sqrt{3}+\log(7+4\sqrt{3})).$$ I want to know how to get it.

REPLY [3 votes]: You are computing the average distance from a vertex in a unit hypercube. Assuming that $X,Y,Z$ are three independent random variables, uniformly distributed over $(0,1)$, and computing the probability density function of $W=X^2+Y^2+Z^2$ (that is a piecewise-simple function), it follows that
$$\mathbb{E}[\sqrt{W}] = \color{red}{\frac{\sqrt{3}}{4}+\frac{\log(2+\sqrt{3})}{2}-\frac{\pi}{24}}=0.960591956455\ldots $$
As an alternative, you may just integrate $\sqrt{x^2+y^2+z^2}$ with respect to $x$ first, getting
$\frac{1}{2} x \sqrt{x^2+y^2+z^2}+\frac{1}{2} \left(y^2+z^2\right) \log\left(x+\sqrt{x^2+y^2+z^2}\right)$, then integrate the resulting expression with respect to $y$ and $z$. Lengthy but perfectly doable.