Home

pairs

A pair is a 2-tuple consisting of two elements that are regarded as a single unit for the purposes of discussion or computation. In mathematics, a distinction is made between ordered pairs, in which the sequence matters, and unordered pairs, where the two elements are considered without regard to order.

An ordered pair (a,b) records that a is the first element and b is the second. In

An unordered pair {a,b} contains exactly the two elements without specifying which is first. If a =

Beyond arithmetic and set theory, a pair often represents a point in a two-dimensional space, a two-component

In some contexts, pairs are used to encode or “pair up” elements, such as in pairing functions

set
theory,
ordered
pairs
can
be
defined
in
terms
of
sets,
for
example
Kuratowski’s
definition
(a,b)
=
{{a},{a,b}};
this
encodes
order
via
the
structure
of
the
set.
The
Cartesian
product
A×B
is
the
set
of
all
ordered
pairs
(a,b)
with
a
in
A
and
b
in
B.
A
fundamental
property
is
that
(a,b)
=
(c,d)
if
and
only
if
a=c
and
b=d;
in
particular,
(a,b)
≠
(b,a)
in
general
when
a
≠
b.
b,
the
unordered
pair
collapses
to
the
singleton
{a}.
Unordered
pairs
are
common
in
elementary
counting
and
in
the
study
of
sets
where
order
is
not
important.
vector,
or
a
simple
data
structure
with
two
elements.
In
computer
science,
pairs
(also
called
2-tuples
or
simply
pairs)
are
used
to
group
related
values,
and
many
programming
languages
provide
a
built-in
pair
type
or
a
generic
product
type.
that
map
two
inputs
to
a
single
output
or
in
database
keys
and
graph
representations.