Mathwords logoMathwords

Backslash — Definition, Formula & Examples

Backslash is the symbol \setminus used to denote set difference. When you write ABA \setminus B, it means the set of all elements that are in AA but not in BB.

For sets AA and BB, the expression ABA \setminus B denotes the relative complement of BB in AA, defined as AB={x:xA and xB}A \setminus B = \{x : x \in A \text{ and } x \notin B\}.

Key Formula

AB={x:xA and xB}A \setminus B = \{x : x \in A \text{ and } x \notin B\}
Where:
  • AA = The original set you start with
  • BB = The set whose elements you remove from A
  • xx = An arbitrary element being tested for membership

How It Works

Place the backslash symbol between two sets. The set on the left is your starting set, and the set on the right contains the elements you want to remove. Go through each element of the left set and keep it only if it does not appear in the right set. The result is a new set containing the "leftover" elements. Some textbooks use a minus sign (ABA - B) instead, but the backslash notation is more common in formal mathematics because it avoids confusion with subtraction of numbers.

Worked Example

Problem: Let A = {1, 2, 3, 4, 5} and B = {2, 4, 6}. Find A \ B.
Identify shared elements: Check which elements of A also appear in B.
AB={2,4}A \cap B = \{2, 4\}
Remove them from A: Keep every element of A that is not in B. Remove 2 and 4 from A.
AB={1,3,5}A \setminus B = \{1, 3, 5\}
Answer: AB={1,3,5}A \setminus B = \{1, 3, 5\}

Why It Matters

Set difference appears frequently in probability, where you compute P(AB)P(A \setminus B) to find the probability of event AA occurring without event BB. It is also central to proofs in discrete mathematics and is used in database queries to exclude specific records from results.

Common Mistakes

Mistake: Assuming A \ B equals B \ A.
Correction: Set difference is not commutative. A \ B removes elements of B from A, while B \ A removes elements of A from B. These generally produce different sets.