IIT Question: Find the Colour of the 9 Hats

The mystery of Hat Colour

Nine IITians were sitting in a classroom. Their prof wanted to test them. One day he told all of his 9 students that he has 9 hats, colored either in red or black. He also added that he has at least one hat with red color and the no. of black hats is greater than the no. of red hats. He keeps those hats on their heads and ask them tell me how many red and black hats I have? Obviously students can not talk to each other or no written communication, or looking into each other eyes; no such stupid options.
Prof goes out and comes back after 20 minutes but nobody was able to answer the question. So he gave them 10 more minuets but the result was the same. So he decides to give them final 5 minutes. When he comes everybody was able to answer him correctly.
So what is the answer? and why?

The only options for (red, black) can be (1,8), (2,7), (3,6) or (4,5).

After first interval of 20 minutes :

Lets assume that their is 1 hat of red color and 8 hats of black color. The student with red hat on his head can see all 8 black hats, so he knows that he must be wearing a red hat.
Now we know that after first interval nobody was able to answer the prof that means our assumption is wrong.
So there can not be 1 red and 8 black hats.

After second interval of 10 minutes :

Assume that their are 2 hats of red color and 7 hats of black color. The students with red hat on their head can see all 7 black hats and 1 red hat, so they know that they must be wearing a red hat.
Now we know that after second interval nobody was able to answer the prof that means our assumption is again wrong.
So there can not be 2 red and 7 black hats.

After third interval of final 5 minutes :

Now assume that their is 3 hats of red color and 6 hats of black color. The students with red hat on their head can see all 6 black hats and 2 red hats, so they know that they must be wearing a red hat.
Now we know that this time everybody was able to answer the prof that means our assumption is right.
So there are 3 red hats and 6 black hats.

Now as everybody gave the answer so there can be a doubt that only those 3 students know about it how everybody came to know ?
Then here is what i think, the professor gave them FINAL 5 minutes to answer, so other guys will think that the professor expects the answer after 3rd interval (according to prof it must be solved after 3 intervals), so this is the clue for others.