Fraction of Space Filled by Hexagonal Close Packing

$r$
are arranging in a hexagonal close packing arrangement. We can take a unit cell as a a sphere with a sphere at each of the eight vertices (shared between eight other unit cells) and a sphere at the centre. The total volume occupied by the spheres is
$8 (\frac{4/3 \pi r^3}{8}) + \frac{4}{3} \pi r^3 = \frac{8}{3} \pi r^3$

The diagonal of the unit cell is
$4r$
so if so taking the unit cell to have side
$a$
and using Pythagoras Theorem in three dimensions,
$a^2+a^2+a^2=(4r)^2 \rightarrow a = \sqrt{4r}{\sqrt{3}}$

The fraction of the cell that is occupied by the spheres is
$\frac{8/3 \pi r^3}{(4r/ \sqrt{3}})^3 =\frac{\pi \sqrt{3}}{8}$