TITLE: What is the expected length of the hypotenuse formed by bending a unit length randomly at a right angle?
QUESTION [6 upvotes]: This is easy enough to simulate and find the answer is somewhere around .812. However I am not finding it so easy to solve the integral involved which I believe is...
$$\int_0^1 \sqrt{x^2+(1-x)^2} dx$$
I don't seem to get the right answer if I use this derivation. Bonus points for finding the expected area which is a much easier problem!

REPLY [2 votes]: Use the substitution $u=x-\frac{1}{2}$
$$\int_{-\frac{1}{2}}^{\frac{1}{2}} \sqrt{\left(u+\frac{1}{2}\right)^2+\left(u-\frac{1}{2}\right)^2}du = \int_{-\frac{1}{2}}^{\frac{1}{2}} \sqrt{2u^2 + \frac{1}{2}}du = 2\sqrt{2}\int_0^{\frac{1}{2}} \sqrt{u^2+\frac{1}{4}}du$$ 
Then there are two ways to approach this problem, either let $u=\frac{1}{2}\tan\theta$ or $u=\frac{1}{2}\sinh t$. Personally I find the second one easier as it doesn't require an integration by parts
$$ \frac{1}{\sqrt{2}} \int_0^{\sinh^{-1}\left(1\right)} \cosh^2 t dt = \frac{1}{2\sqrt{2}} \int_0^{\sinh^{-1}\left(1\right)} 1 + \cosh(2t) dt = \frac{1}{2\sqrt{2}}\Biggr[t + \frac{1}{2}\sinh(2t)\Biggr]_0^{\sinh^{-1}\left(1\right)}$$
$$=\frac{1}{2\sqrt{2}}\Biggr[t + \sinh(t)\cosh(t)\Biggr]_0^{\sinh^{-1}\left(1\right)}=\frac{1}{2\sqrt{2}}\Biggr[t + \sinh(t)\sqrt{1+\sinh^2(t)}\Biggr]_0^{\sinh^{-1}\left(1\right)}$$
$$ = \frac{\sinh^{-1}\left(1\right)}{2\sqrt{2}} + \frac{1}{2} \approx 0.8116$$
by using the hyperbolic identities $\cosh(2t) = \cosh^2(t) + \sinh^2(t)$ and $\cosh^2(t)-\sinh^2(t) = 1$.