~/tedtes/writing/math-foundations-for-reasoning-models

~/writing/math-foundations-for-reasoning-models $ ls

Sets, Relations, and Functions

Difference

Set difference keeps the elements in one set that are not in another set.

~/writing/math-foundations-for-reasoning-models $ cat topic.md

Difference

Definition

The difference between two sets keeps the elements that are in the first set but not in the second.

Example:

A = {1, 2, 3}
B = {2, 3, 4}

Difference:

A minus B = {1}

Difference removes from the first set anything found in the second set.


Order Matters

Set difference is directional.

Example:

A = {1, 2, 3}
B = {2, 3, 4}

Then:

A minus B = {1}
B minus A = {4}

These are not the same.

Difference depends on which set comes first.


Difference vs Intersection

Intersection keeps what two sets share.

Difference removes what they share from the first set.

Example:

A = {1, 2, 3}
B = {2, 3, 4}

Intersection:

{2, 3}

Difference:

A minus B = {1}

Intersection finds overlap; difference removes overlap from one side.


Difference As Filtering

Set difference can be understood as filtering.

Example:

All = {1, 2, 3, 4, 5}
Remove = {2, 4}

Difference:

All minus Remove = {1, 3, 5}

Difference keeps only elements that pass the "not in the second set" test.


Final Summary

  • Difference keeps elements in the first set that are not in the second.
  • Set difference is directional.
  • A minus B may differ from B minus A.
  • Difference is different from intersection.
  • Difference can be understood as filtering by non-membership.

~/writing/math-foundations-for-reasoning-models $ open

Continue the series.

Complement