Set Interview Question, Any Creative Way to solve?
Solution 1:
In my opinion, in the case of only 3 sets, it is most straightforward to draw the corresponding Venn diagram
and find out the resulting subset when you apply the operations on both sides of your equalities. In an interview, I think it would show sense of intuition; you shouldn't be afraid of drawing little diagrams for simple math questions.
EDIT: After thinking about it, this is more about pragmatism than intuition. Here you won't have to find the right trick, or use too much brainpower, and you will be able to apply this even if put under the stress of the interview.
Which is not to say you won't find other answers helpful if you have to actually prove/disprove the predicates, or if you want to show that you are, in fact, able to find tricks.
Solution 2:
To think through things quickly, you can see that $A-(C\cup B) = (A-B)-C$ is true, because on the left, you're taking a set $A$ and getting rid of anything in either $C$ or $B$, while on the right, you're taking $A$, first getting rid of anything in $B$, and then getting rid of anything in $C$. The next two are similar (so similar, in fact, that it would slow me down wondering why they would, in effect, ask the same question three times in a row). Finally, $A-(B\cup C)=(B-C)-A$ has to be false (in general) because on the left you only have stuff in $A$ while on the right you're getting rid of $A$.
Note, none of this constitutes rigorous proof. I'm just addressing the OP's request for a quick way to assess the equalities.
Solution 3:
The first three are all the same (with the sets relabeled). Looking at the first, the set is elements in $A$ that are not in $B$ or $C$. So the first three are all true.
The fourth is false in general. All we need is a single counter example. Suppose $A$ is non-empty, but $B,C$ are both empty. Then the lefthand side is just $A$ and is non-empty, but the righthand side is empty.
Solution 4:
Indicator functions can be used. In general:
- $1_{A^c}=1-1_A$
- $1_{A\cap B}=1_A1_B$
This can be used to find:
- $1_{A\cup B}=1_A+1_B-1_A1_B$
- $1_{A-B}=1_A-1_A1_B$
Application on first:
$1_{A-(C\cup B)}=1_A-1_A(1_C+1_B-1_C1_B)$ $1_{(A-B)-C}=1_{A-B}-1_{A-B}1_C=(1_A-1_A1_B)-(1_A-1_A1_B)1_C$
Both result in $1_A-1_A1_C-1_A1_B+1_A1_B1_C$ so the sets are equal.