Solution (source code)

= Solution

For a smooth compactly supported $u$, expand the nonnegative square
$$
0\leq\int_{\mathbb R^3}
\left|\nabla u+\frac{x}{2|x|^2}u\right|^2dx.
$$
Since $\nabla\cdot(x/|x|^2)=|x|^{-2}$ in three dimensions, <integration by parts> turns the cross term into $-\frac12\int|u|^2/|x|^2$. Hence
$$
\int_{\mathbb R^3}\frac{|u|^2}{|x|^2}dx
\leq4\int_{\mathbb R^3}|\nabla u|^2dx.
$$
Density extends this <Hardy inequality in Euclidean space> to $H^1(\mathbb R^3)$.