Given there are 2 coloured socks, which is black and White
Let suppose 3 is choosen at random
then three conditions arises
1. all are black
2.all are white
3. either it will have 2 black and 1 white or it will have 2 white and 1 black
so in all the conditions as above mentioned we are getting atleast one pair of socks.
So, he must take out 3 to be sure that he has a matching pair.