Proof of Hardy inequality in $\mathbb{R}^n$

This is in Evans' PDE book, page 296 in the second edition. The following discussions on this proof may also be useful,

  1. Hardy's inequality
  2. A technical step in proving Hardy's inequality

However, it doesn't seem like the constant 4 is explicitly computed in Evans, and moreover it may be improved if the domain of $u$ is not convex. In the dimension 1 variant, it is optimal, and you can refer to Computing the best constant in classical Hardy's inequality. In higher dimensions, you may want to look at this paper On the best constant for Hardy's inequality in $\mathbb R^n$ by Marcus, Mizel and Pinchover, and its references.