Math Fundamentals18 sections · 814 units
Open in Course

What Is a Set?

Unordered unique collection

A set is a collection of distinct items where order does not matter. Think of it like a bag of marbles: you can see which marbles are inside, but there is no "first" or "second" marble.

The set {1,2,3}\{1, 2, 3\} equals {3,2,1}\{3, 2, 1\} because sets ignore order. Also, {1,1,2}\{1, 1, 2\} equals {1,2}\{1, 2\} because sets have no duplicates.

Sets work differently than arrays. In an array, [1,2,3][1, 2, 3] differs from [3,2,1][3, 2, 1] because position matters. Sets throw away that information.