# Help showing that $(D \setminus A) \setminus (C \setminus B) = D \setminus (A \cup (B \cup C))$

I wanted to show that

$$(D \setminus A) \setminus (C \setminus B) = D \setminus (A \cup (B \cup C))$$

Since I did not know how to approach this, I let wolfram alpha do the work and got the following results: https://www.wolframalpha.com/input/?i=(D%5CA)%5C(C%5CB)%3DD%5C(A+union+B+union+C)

It says: undetermined (can be true or false).

So, it can be true or false. But on what does it depend whether the solution is true or false?

If I take for example the sets:

$$A=\{1,2,3,4,5\}$$ $$B=\{2,1,3,4,6\}$$ $$C=\{3,1,2,4,7\}$$ $$D=\{4,1,2,3,8\}$$

then $$(D \setminus A)\setminus (C\setminus B) = \{8\}$$ $$D \setminus (A \cup B \cup C) = \{8\}$$

But what would be cases, in which this relation does not hold?

• In the "input interpretation" at wolfram link, the expression you wrote has changed from what you have on left of first displayed equation in the post. – coffeemath Aug 14 at 10:10
• It still says the same thing at wolfram link-- i.e. the thing they computed was not $(D \setminus A) \setminus (C \setminus B).$ Can you re-do wolfram calculation to force the parenthesization you specified on the left side? – coffeemath Aug 14 at 10:21
• Thanks for noticing. I tried to force brackets, but alpha just removes them every time. I don't know how to change it. – holistic Aug 14 at 10:23

Well you found one example where it is true.

And here is an example where it is false:

$$A =\{0\}, B =\{1\}, C =\{1\}, D =\{1\}$$

Then $$(D \setminus A) = \{1\} \setminus \{0\} = \{1\}$$ and $$(C \setminus B) = \{1\} \setminus \{1\} = \emptyset$$.

Hence $$(D \setminus A) \setminus (C \setminus B) = \{1\} \setminus \emptyset = \{1\}$$.

However $$A \cup (B \cup C) = \{0\} \cup (\{1\} \cup \{1\}) = \{0, 1\}$$.

Hence $$D \setminus (A \cup (B \cup C)) = \{1\} \setminus \{0, 1\} = \emptyset$$.

So $$(D \setminus A) \setminus (C \setminus B) = \{1\} \neq \emptyset = D \setminus (A \cup (B \cup C))$$ in this particular case.

### However it is true that at least one part of the equality namely $$\boxed{D \setminus (A \cup (B \cup C)) \subseteq (D \setminus A) \setminus (C \setminus B)}$$ does always hold.

Proof: For let $$x \in D \setminus (A \cup (B \cup C)$$ be an arbitrary element.

Then $$x \in D$$ but $$x \notin A$$ and $$x \notin B$$ and $$x \notin C$$.

So firstly as $$x \in D$$ and $$x \notin A$$, we have $$x \in (D \setminus A)$$.

And secondly as $$x \notin C$$ we have in particular that $$x \notin (C \setminus B)$$ also.

Thus combining the results we get $$x \in (D \setminus A)$$ and $$x \notin (C \setminus B)$$ are both true or to say the same thing $$x \in (D \setminus A) \setminus (C \setminus B)$$.

Thus $$D \setminus (A \cup (B \cup C)) \subseteq (D \setminus A) \setminus (C \setminus B)$$ indeed.

$$A = C = \emptyset$$, $$B = D = \{1\}$$ is a counterexample.

You're not necessarily removing the elements of B from D in the LHS, but are in the RHS.

Sample:

A = {1} B = {2} C = {3} D = {1, 2, 3, 4, 5}

$$C\setminus B=\{3\}$$, so $$(D\setminus A)\setminus(C\setminus B)=\{2,4,5\}$$ but $$D\setminus(A\cup B\cup C)=\{4,5\}$$