Let no. of atoms of A be N
No. of octahedral voids = N
No. of tetrahedral voids= 2N
(i) There will be one atom of b in the octahedral void
(ii) There will be one atom of B in the tetrahedral void (1/2*2N)
Therefore, total 2 atoms of b for each atom of A
Therefore formula of the compound =AB2