# Collection - Set

A set is:

The objects element of the set have the same type.

A set is an unordered collection in which each value occurs at most once.

The mathematical concept of a set is a group of unique items, meaning that the group contains no duplicates.

Sets are one of the most fundamental concepts in mathematics. Developed at the end of the 19th century, set theory is now a ubiquitous part of mathematics, and can be used as a foundation from which nearly all of mathematics can be derived.

In mathematics education, elementary topics such as Venn diagrams are taught at a young age, while more advanced concepts are taught as part of a university degree.

The familiar Venn Diagrams is used:

• in mathematics education to introduce elementary element of set theory such as “set intersection” and “set union”
• illustrate simple set relationships

Sets are fundamental to logic, mathematics, and computer science, but also practical in everyday applications in business and systems.

## 3 - Examples

### 3.1 - In Programming language

Some real-world examples of sets include the following:

• The set of uppercase letters 'A' through 'Z'
• The set of nonnegative integers {0, 1, 2 …}
• The set of reserved Java programming language keywords {'import', 'class', 'public', 'protected'…}
• A set of people (friends, employees, clients, …)
• The set of records returned by a database query
• The set of Component objects in a Container
• The set of all pairs
• The empty set {}

### 3.2 - In Computer Science

• The idea of a "connection pool" is a set of open connections to a database server.
• Web servers have to manage sets of clients and connections.
• File descriptors provide another example of a set in the operating system.

## 4 - Basic properties of sets

The basic properties of sets:

• Sets contains only one instance of each item
• Sets may be finite or infinite
• Sets can define abstract concepts

## 5 - Operator

### 5.1 - In

$\in$: indicates that an object belongs to a set (equivalently, that the set contains the object).

For example: $1 \in \{1,2,3,4\}$

### 5.2 - Subset

: “A is a subset of B”. This means A and B are sets, and every element of A is also an element of B.

### 5.3 - Equality

: Two sets are equal if they contain exactly the same elements. (There is no order among elements of a set.)

A convenient way to prove that A and B are equal is to prove that each is a subset of the other. The proof often consists of two parts:

1. a proof that and
2. a proof that .

## 6 - Property

### 6.1 - Cardinality

Any set has only one size (its cardinality or length)

If a set S is not infinite, to denote the number of elements or cardinality of the set.

For example, the set has a cardinality of 4.

If A and B are finite sets then |A x B| = |A| x |B|.

## 7 - Operation

### 7.1 - Cartesian Product

The cartesian product is the set of all pairs (a, b) where and .

Example:

A = {1, 2}
B = {a, b}
A x B = {(1,a), (1,b), ((1,c), (2,a), (2,b), (2,c)}

The cartesian product in named for Rene Descartes.

## 8 - Set expression

### 8.1 - Set of Non-negative number

In Mathese, “the set of non-negative numbers” is written like this:

where:

• The colon stands for “such that”
• the part before the colon specifies the elements of the set, and introduces a variable to be used in the second part
• the part after the colon: defines a filter rule

The above notation can also be shortened if x is wel known :

### 8.2 - Another example

Another example where the set consists of and

### 8.3 - Tuple

Tuples examples in set expression:

• The set expression of all pairs of real numbers in which the second element of the pair is

the square of the first can be written:

of abbreviated:

• The set expression of triples consisting of nonnegative real numbers.