Inclusion-Exclusion Principle

<p><a href="https://www.prepswift.com/quizzes/quiz/prepswift-inclusion-exclusion-principle" target="_blank">Inclusion-Exclusion Principle Exercise</a></p><p>There&#39;s this awesome formula known as the <strong><span style="color:#8e44ad;">Inclusion-Exclusion Principle</span></strong>. Imagine we have two sets, Set $A$ and Set $B$. We can use the formula below to solve GRE-type problems.</p> <p><span style="font-size:22px;">$$total = |A| + |B| - both + neither$$</span></p> <p>Recall that those vertical lines in the case of sets don&#39;t mean absolute value. Rather, they mean the number of elements in Set $A$ or the number of elements in Set $B$. Honestly though, I usually just write it like this. Be a rebel.</p> <p>$$total = A + B - both + neither$$</p> <p><strong><span style="color:#e74c3c;">Example 1</span></strong></p> <p>In a certain classroom of $46$ students, $40$ bring a backpack, $24$ bring a lunchbox, and $4$ bring neither. How many bring both?</p> <p>$$46 = 40 + 24 - both + 4$$</p> <p>$$46 = 68 - both$$</p> <p>$$22 = both$$</p> <p><strong><span style="color:#e74c3c;">Example 2</span></strong></p> <p>A certain school with $120$ students offers only two foreign language classes: German and French. If $70$ of the students are studying German and $90$ are studying French, with $12$ studying neither, how many students at the school are learning only one foreign language?</p> <p><u><strong>Note</strong></u>: Read the question above carefully. They&#39;re asking us to calculate the sum of the number of students studying ONLY German (not French too) and the number of students studying ONLY French (not German too).</p> <p>$$120 = 70 + 90 - both + 12$$</p> <p>$$both = 52$$</p> <p>If $52$ are studying both, that means that $70 - 52 = 18$ students are studying only German and $90 - 52 = 38$ students are studying only French, so we get:</p> <p>$$18 + 38 = 56$$</p> <p style="text-align: center;"><em>Students studying only one foreign language (not both)</em></p>