A hexagonal closed packing (hcp) unit cell has an ABAB type of packing. For calculating the packing fraction we require the volume of the unit cell.
Volume of hcp lattice = (Base area) $\cdot$ (Height of unit cell)
Each hexagon has a side = $2\cdot r$
Base area = $6$ (Area of small equilateral triangles making up the hexagon)
$$=6 \cdot \frac{\sqrt{3}}{4}\times(2r)^2$$
$$=6 \cdot \sqrt{3} \cdot r^2$$
Hence, volume $= 6 \cdot \sqrt{3} \cdot r^2 $ (Height of unit cell)
This is the point where I am stuck. How do I find out the height of the unit cell?
I searched in textbooks and found out that height $= 4r \cdot \sqrt{\frac{2}{3}}$. Can you please explain why is this so?