Artificial intelligent assistant

Maximizing the number of people who are a part of both categories Here's a question from a high school math contest: At Piper's high school reunion, the ratio of people who ate ice cream to people who ate cake was $3:2$. People who ate both ice cream and cake were included in both categories, and people who ate neither ice cream nor cake were not included in either category. If $50$ people were at the reunion, what is the maximum number of people who could have eaten both ice cream and cake? My approach is, let $3x$ be the number of people who ate ice cream and $2x$ for people who ate cake. We're trying to maximize $5x-50$ with $x<17$ which yields $30$ but that's not the right answer. Why? I don't know the right answer.

Your first idea is good. If there are $3x$ people who ate ice cream and $2x$ who ate cake, then $x$ is at most $16$, since $3x\leq 50$, the total number of people. So $2x$ is at most $32$. The best case scenario is obviously when all of those who ate cake also ate ice cream, in which case we would have $32$, which is the answer.

Your approach is wrong because $(3x)+(2x)-50$ is not, in fact, what you're trying to maximise. You're taking $$\text{ice-cream eaters}+\text{cake eaters}-\text{total},$$ which does not in fact correspond to the number of people who ate both, as you have implicitly assumed that no one ate neither. You can draw out a Venn Diagram to convince yourself of this.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b4bbb029935d2dab56abb373e0cba0e7