So I got this question in my exam and I couldn't solve it. Later my professor gave me the solution but I'm not getting it properly. I guess my concepts on projection are not that strong. Can you please help me understand it?
Question: Give an example to show that if R and S are both n-ary relations, then $P_{i_1,i_2,\dots,i_m}(R \setminus S)$ may be different from $P_{i_1,i_2,...,i_m}(R) \setminus P_{i_1,i_2,...,i_m}(S)$.
Solution: Let $R = \{(a, b)\}$ and $S = \{(a, c)\}$, $n = 2, m = 1,$ and $i_1 = 1$; $P_1(R \setminus S) = \{(a)\}$, but $P_1(R) \setminus P_1(S) =\emptyset.$
Sets $R=\{(a,b)\}$ and $S=\{(a,c)\}$ are nonequal and have an empty intersection, so their set difference $R \setminus S$ is actually equal to the set $R$. This set is nonempty, so its projection is also nonempty.
However tuples $(a,b)$ and $(a,c)$ have the same first element, so when we make projections at first, we get the same set in both cases: $P_1(R) = P_1(S)$. Their set difference gives us an empty set in this case.