Note that we can write r% as r/100
And a decrease of r% can be wriiten as (1 - r/100)...likewise, an increase of r% can be written as (1 + r/100)...and since the number of males and females in the class are equal after their respective decreases and increases, we have
30(1 - r/100) = 20(1 + r/100) distribute the 30 and 20
30 - 30r/100 = 20 + 20r/100 simplify the fractions
30 - 3r/10 = 20 +2r/10 add 3r/10 to both sides....subtract 20 from both sides
10 = 5r/10
10 = 1/2r multiply both sides by 2
20 = r
Note that if you "plug" 20 back in for r, the number of males = the number of females = 24