9
$\begingroup$

Let A be a set of finite elements.

$A=\{1,2,3,4,5\}$

If I want to remove one element and show I removed one element, how should I do?

Pseudo mathematical notation:

$A - \{2\} = \{1,3,4,5\}$

Thank you very much!

n

  • 0
    I have the impression that people prefer A/B, or other, to A - B as in *some* instances A - B *might* be defined as {x = a - b| a in A and b in B} (although when they *do* mean it in that way, they usually define it as such explicitly).2015-11-16

1 Answers 1

7

Your notation above is actually used in set theory.

In general if you have two sets $A$ and $B$, the difference $A - B$ is the set

$A - B = \{x \in A : x \notin B\}$

Also, note that $\{1, 2, 3, 4, 5\} - \{2, 6\} = \{1,3,4,5\}$. $B$ need not be a subset of $A$.

  • 7
    One reason to prefer $A \setminus B$ is that I've also seen $A - B$ occasionally used for the set $\{a-b: a \in A, b \in B\}$. That is, by that definition $\{1,2,3,4,5\} - \{2,6\} = \{-5,-4,-3,-2,-1,0,1,2,3\}$. Of course, there's no problem as long as you explain which definition you're using, but $A \setminus B$ avoids that ambiguity completely.2011-09-18