Exercise from set theory I don't know how I may use the sets algebra in this problem
I need someone help me, in the following exercise, prove that:
$$ (A \cup X = A \cup Y) \wedge (A \cap X = A\cap Y) \Leftrightarrow X=Y $$
best regards
 A: First, suppose that $A\cup X=A\cup Y$ and $A\cap X=A\cap Y$. 
Statement: $X\subset Y$. Indeed, if $x\in X$ then $x\in X\subset A\cup X=A\cup Y$, and so
$$x\in A \text{  or  } x\in Y .$$ 
If $x\in Y$, then we concluse the statement, but if $x\in A$, then as by assumption we have $x\in X$, we concluse that $x\in A\cap X=A\cap Y$, then $x\in Y$.
In any case it follows that $x\in Y$, i.e. we concluse that $X\subset Y$.
Analogously we proof that $Y\subset X$. Then, we obtain that $X=Y$.
The converse is trivial.
Hope that helps.
A: The implication in the $\Longleftarrow$ direction is obvious.
For the other direction, assume $X \neq Y$. Then there exist a point $p$ that is in one and not the other. We can without loss of generality assume that $p\in X$ but $p\notin Y$.
Now, if $p \in A$, then $p \in A\cap X$ but $p\notin A\cap Y$, so the intersections are unequal. If $p\notin A$, then $p\in A\cup X$, but $p\notin A\cup Y$. In either case either the unions are unequal or the intersections are unequal, and we have the result by contrapositivity (modus tollens).
A: Here's a pretty direct proof:
$$X\setminus A=(X\cup A)\setminus A=(Y\cup A)\setminus A=Y\setminus A$$
Therefore
$$X=(X\setminus A)\cup(X\cap A)=(Y\setminus A)\cup(Y\cap A)=Y$$
The other implication is trivial.
