i went a more difficult way to solve it,
if x = the total number of hats, then x/4 are brown hats and 3x/4 are black hats
if you sell 2/3 of the hats, and since you don't know how many of those are black or brown luckily they give you the statement that 4/5 of the brown hats were sold off in that
so 2/3x = (x/4)*(4x/5) + Y(3x/4)
I let Y be the fraction of Black hats sold, and as you can see, I included the 3x/4 which is the amount of black hats originally.
2/3*x - 1/5*x = Y(3x/4)
7x/15 = Y(3x/4)
you end up with Y = 28/60 or 14/30, or in other words, the amount of black hats sold from the original 3/4.
but earlier we also figured out that 1/5*x is the amount of brown hats sold from the original 1/4. So i guess the tricky part is realizing you need to find out what is remaining after being sold. that would equal the original amount - the sold amount.
1/4*x - 1/5*x = the remaining brown hats = 1/20*x
3/4*x - 14/30*x = the remaining black hats = 45/60*x - 28/60*x = 17/60*x
the question asks for the ratio of remaining brown to total, so divide remaining brown / total
(1/20*x) / (1/20*x + 17/60*x)
x(3/60 + 17/60)
= 1/20*x / (x*20/60)
= 1/20 * 60/20 = 1/20 * 3 = 3/20