Number of students preferring red = x/4
Number of students preferring blue = x/8
Then..............
Number of students remaining = x - [(x/4) + (x/8)]
=x - [(2x + x)/8)
= x - (3x/8)
= (8x - 3x)/8
= 5x/8
Number of students preferring the color green = (3/5) (5x/8)
= 3x/8
We also know that the total number of students preferring the color green is 15. So..
3x/8 = 15
3x = 15 8
x = (15 8)/3
= 5 8
= 40
So the total is 40 students