How old were each of Peter's children?

An easier number puzzle is as follows.
Two friends are chatting:
- Peter, how old are your children?
- Well Thomas, there are three of them and the product of their ages is 36.
- That is not enough ...
- The sum of their ages is exactly the number of beers we have drunk today.
- That is still not enough.
- OK, the last thing is that my oldest child wears a green cap.

How old were each of Peter's children?

Click here for Answer

The first clue is that the product is 36. Note that 36=3*3*2*2, so all posible combinations are:

6-3-2 (sum=11)
9-2-2 (sum=13)
4-3-3 (sum=10)
9-4-1 (sum=14)
12-3-1 (sum=16)
18-2-1 (sum=21)
6-6-1 (sum=13)

Note that only 9-2-2 and 6-6-1 give the same amount when added.
Obviously, the second man must know how many beers thay have drunk, so he knows the sum.
If he cannot decide yet it's only because the sum is 13 and there are two combinations that add up to 13.
And as we learned further that the oldest son wears a hat, it is clear that the correct combination of ages is 2-2-9, where there is exactly one of them the oldest one.
So the Age of Peter's Children is 2,2,9