Let's say 'x' to number of the students in the smaller class. Since the larger one is 6 more than the smaller one, its number would be 'x+6'. So their sum is equal to
\(x+x+6=2x+6\) and we know total is 50 so:
\(2x+6=50\\ 2x=50-6\\ 2x=44\\ x=\frac { 44 }{ 2 } \\ x=22\)
x is 22 so the larger number 'x+6' is equal to : \(x+6=22+6=28\)