b = number of boys
g = number of girls
b-8 = (2/3)g (1)
2(g-8) = b (2)
Substitute LHS of (2) for 'b' in (1):
2(g-8)-8 = (2/3)g
2g-24 = (2/3)g
6g-72 = 2g
4g = 72
g = 18 -->(using (1) or (2))--> b = 20
There are 20 boys and 18 girls in the class
Check:
20 - 8 = 12 and 12 = (2/3)18 ((1) checks out)
2(18-8) = 2(10) = 20 = b ((2) checks out)