I did some simple courses in discrete mathematics for personal interest but it has been awhile and certainly is not my cup of tea anymore so I would like to see fellow TL'ers solve this. Over the years I have seen a few math wiz members here so don't be shy, I know who you are!
Answer for the weaklings:
+ Show Spoiler +
Remember, Albert is told either May, June, July or August.
Bernard is told either 14, 15, 16, 17, 18 or 19
Let’s go through it line by line.
Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard doesn’t know too.
All Albert knows is the month, and every month has more than one possible date, so of course he doesn’t know when her birthday is. The first part of the sentence is redundant.
The only way that Bernard could know the date with a single number, however, would be if Cheryl had told him 18 or 19, since of the ten date options only these numbers appear once, as May 19 and June 18.
For Albert to know that Bernard does not know, Albert must therefore have been told July or August, since this rules out Bernard being told 18 or 19.
Line 2) Bernard: At first I don’t know when Cheryl’s birthday is, but now I know.
Bernard has deduced that Albert has either August or July. If he knows the full date, he must have been told 15, 16 or 17, since if he had been told 14 he would be none the wiser about whether the month was August or July. Each of 15, 16 and 17 only refers to one specific month, but 14 could be either month.
Line 3) Albert: Then I also know when Cheryl’s birthday is.
Albert has therefore deduced that the possible dates are July 16, Aug 15 and Aug 17. For him to now know, he must have been told July. Since if he had been told August, he would not know which date for certain is the birthday.
The answer, therefore is July 16.
Also video if you are TLDR