Let P1 be the population of NY that achieves the same population density

Let P2 be the population of Illinois that achieves the same population density

we want,

P1/50000 = P2/80000

=> P1 = (5/8)P2

Now P1 + P2 = 20 000 000 + 12 000 000 = 32 000 000

=> (5/8)P2 + P2 = 32 000 000

=> (13/8)P2 = 32 000 000

=> P2 ~= 19 692 308

=> P1 ~= 12307693

So the amount of people that have to move from NY is: 20 000 000 - 12 307 693 = 7 692 307