Math equation.The sample sizes in each group (n sub i) are computed as follows. First, multiply "p", the proportion in each group times 1 minus p. Add this quantities together from the two groups. Then take th result and multiply it times the square of Z divided by E, where E is the desired margin of error.