In the given hcp lattice, Y atoms are present at 12 corners and 2 face centres.
∴ Number of Y atoms = \(\frac{1}{6}×12 +\frac{1}{2}×2 \) = 2+1= 3
There are 6 tetrahedral voids, the number of X atoms = \(\frac{1}{3}×6\) = 2
∴ Formula of the compound is X2Y3.