- TikTok
- Asam deoksiribonukleat
- Uji t Student
- Pairing function
- Pairing-based cryptography
- Gödel numbering for sequences
- Weil pairing
- Hilbert's paradox of the Grand Hotel
- Function (mathematics)
- Computably enumerable set
- Pairing heap
- Ordinal notation
- Base pair
- Generalizations of pairing function - Mathematics Stack Exchange
- Generalization of Cantor Pairing function to triples and n-tuples
- elementary set theory - Proving the Cantor Pairing Function …
- What is Gödel's pairing function on ordinals? - MathOverflow
- Pairing function - Mathematics Stack Exchange
- How do pairing functions (don't) work for negative values?
- What pairing function coincides with the Gödel pairing on the …
- Create unique number from 2 numbers - Mathematics Stack …
- Is the Cantor Pairing function guaranteed to generate a unique …
- analysis - Cantor Pairing Function - How was this derived ...
Pairing function GudangMovies21 Rebahinxxi LK21
In mathematics, a pairing function is a process to uniquely encode two natural numbers into a single natural number.
Any pairing function can be used in set theory to prove that integers and rational numbers have the same cardinality as natural numbers.
Definition
A pairing function is a bijection
π
:
N
×
N
→
N
.
{\displaystyle \pi :\mathbb {N} \times \mathbb {N} \to \mathbb {N} .}
= Generalization
=More generally, a pairing function on a set
A
{\displaystyle A}
is a function that maps each pair of elements from
A
{\displaystyle A}
into an element of
A
{\displaystyle A}
, such that any two pairs of elements of
A
{\displaystyle A}
are associated with different elements of
A
{\displaystyle A}
, or a bijection from
A
2
{\displaystyle A^{2}}
to
A
{\displaystyle A}
.
Instead of abstracting from the domain, the arity of the pairing function can also be generalized: there exists an n-ary generalized Cantor pairing function on
N
{\displaystyle \mathbb {N} }
.
Hopcroft and Ullman pairing function
Hopcroft and Ullman (1979) define the following pairing function:
⟨
i
,
j
⟩
:=
1
2
(
i
+
j
−
2
)
(
i
+
j
−
1
)
+
i
{\displaystyle \langle i,j\rangle :={\frac {1}{2}}(i+j-2)(i+j-1)+i}
, where
i
,
j
∈
{
1
,
2
,
3
,
…
}
{\displaystyle i,j\in \{1,2,3,\dots \}}
. This is the same as the Cantor pairing function below, shifted to exclude 0 (i.e.,
i
=
k
2
+
1
{\displaystyle i=k_{2}+1}
,
j
=
k
1
+
1
{\displaystyle j=k_{1}+1}
, and
⟨
i
,
j
⟩
−
1
=
π
(
k
2
,
k
1
)
{\displaystyle \langle i,j\rangle -1=\pi (k_{2},k_{1})}
).
Cantor pairing function
The Cantor pairing function is a primitive recursive pairing function
π
:
N
×
N
→
N
{\displaystyle \pi :\mathbb {N} \times \mathbb {N} \to \mathbb {N} }
defined by
π
(
k
1
,
k
2
)
:=
1
2
(
k
1
+
k
2
)
(
k
1
+
k
2
+
1
)
+
k
2
{\displaystyle \pi (k_{1},k_{2}):={\frac {1}{2}}(k_{1}+k_{2})(k_{1}+k_{2}+1)+k_{2}}
where
k
1
,
k
2
∈
{
0
,
1
,
2
,
3
,
…
}
{\displaystyle k_{1},k_{2}\in \{0,1,2,3,\dots \}}
.
It can also be expressed as
π
(
x
,
y
)
:=
x
2
+
x
+
2
x
y
+
3
y
+
y
2
2
{\displaystyle \pi (x,y):={\frac {x^{2}+x+2xy+3y+y^{2}}{2}}}
.
It is also strictly monotonic w.r.t. each argument, that is, for all
k
1
,
k
1
′
,
k
2
,
k
2
′
∈
N
{\displaystyle k_{1},k_{1}',k_{2},k_{2}'\in \mathbb {N} }
, if
k
1
<
k
1
′
{\displaystyle k_{1}
, then
π
(
k
1
,
k
2
)
<
π
(
k
1
′
,
k
2
)
{\displaystyle \pi (k_{1},k_{2})<\pi (k_{1}',k_{2})}
; similarly, if
k
2
<
k
2
′
{\displaystyle k_{2}
, then
π
(
k
1
,
k
2
)
<
π
(
k
1
,
k
2
′
)
{\displaystyle \pi (k_{1},k_{2})<\pi (k_{1},k_{2}')}
.
The statement that this is the only quadratic pairing function is known as the Fueter–Pólya theorem. Whether this is the only polynomial pairing function is still an open question. When we apply the pairing function to k1 and k2 we often denote the resulting number as ⟨k1, k2⟩.
This definition can be inductively generalized to the Cantor tuple function
π
(
n
)
:
N
n
→
N
{\displaystyle \pi ^{(n)}:\mathbb {N} ^{n}\to \mathbb {N} }
for
n
>
2
{\displaystyle n>2}
as
π
(
n
)
(
k
1
,
…
,
k
n
−
1
,
k
n
)
:=
π
(
π
(
n
−
1
)
(
k
1
,
…
,
k
n
−
1
)
,
k
n
)
{\displaystyle \pi ^{(n)}(k_{1},\ldots ,k_{n-1},k_{n}):=\pi (\pi ^{(n-1)}(k_{1},\ldots ,k_{n-1}),k_{n})}
with the base case defined above for a pair:
π
(
2
)
(
k
1
,
k
2
)
:=
π
(
k
1
,
k
2
)
.
{\displaystyle \pi ^{(2)}(k_{1},k_{2}):=\pi (k_{1},k_{2}).}
= Inverting the Cantor pairing function
=Let
z
∈
N
{\displaystyle z\in \mathbb {N} }
be an arbitrary natural number. We will show that there exist unique values
x
,
y
∈
N
{\displaystyle x,y\in \mathbb {N} }
such that
z
=
π
(
x
,
y
)
=
(
x
+
y
+
1
)
(
x
+
y
)
2
+
y
{\displaystyle z=\pi (x,y)={\frac {(x+y+1)(x+y)}{2}}+y}
and hence that the function π(x, y) is invertible. It is helpful to define some intermediate values in the calculation:
w
=
x
+
y
{\displaystyle w=x+y\!}
t
=
1
2
w
(
w
+
1
)
=
w
2
+
w
2
{\displaystyle t={\frac {1}{2}}w(w+1)={\frac {w^{2}+w}{2}}}
z
=
t
+
y
{\displaystyle z=t+y\!}
where t is the triangle number of w. If we solve the quadratic equation
w
2
+
w
−
2
t
=
0
{\displaystyle w^{2}+w-2t=0\!}
for w as a function of t, we get
w
=
8
t
+
1
−
1
2
{\displaystyle w={\frac {{\sqrt {8t+1}}-1}{2}}}
which is a strictly increasing and continuous function when t is non-negative real. Since
t
≤
z
=
t
+
y
<
t
+
(
w
+
1
)
=
(
w
+
1
)
2
+
(
w
+
1
)
2
{\displaystyle t\leq z=t+y
we get that
w
≤
8
z
+
1
−
1
2
<
w
+
1
{\displaystyle w\leq {\frac {{\sqrt {8z+1}}-1}{2}}
and thus
w
=
⌊
8
z
+
1
−
1
2
⌋
.
{\displaystyle w=\left\lfloor {\frac {{\sqrt {8z+1}}-1}{2}}\right\rfloor .}
where ⌊ ⌋ is the floor function.
So to calculate x and y from z, we do:
w
=
⌊
8
z
+
1
−
1
2
⌋
{\displaystyle w=\left\lfloor {\frac {{\sqrt {8z+1}}-1}{2}}\right\rfloor }
t
=
w
2
+
w
2
{\displaystyle t={\frac {w^{2}+w}{2}}}
y
=
z
−
t
{\displaystyle y=z-t\!}
x
=
w
−
y
.
{\displaystyle x=w-y.\!}
Since the Cantor pairing function is invertible, it must be one-to-one and onto.
= Examples
=To calculate π(47, 32):
47 + 32 = 79,
79 + 1 = 80,
79 × 80 = 6320,
6320 ÷ 2 = 3160,
3160 + 32 = 3192,
so π(47, 32) = 3192.
To find x and y such that π(x, y) = 1432:
8 × 1432 = 11456,
11456 + 1 = 11457,
√11457 = 107.037,
107.037 − 1 = 106.037,
106.037 ÷ 2 = 53.019,
⌊53.019⌋ = 53,
so w = 53;
53 + 1 = 54,
53 × 54 = 2862,
2862 ÷ 2 = 1431,
so t = 1431;
1432 − 1431 = 1,
so y = 1;
53 − 1 = 52,
so x = 52; thus π(52, 1) = 1432.
= Derivation
=The graphical shape of Cantor's pairing function, a diagonal progression, is a standard trick in working with infinite sequences and countability. The algebraic rules of this diagonal-shaped function can verify its validity for a range of polynomials, of which a quadratic will turn out to be the simplest, using the method of induction. Indeed, this same technique can also be followed to try and derive any number of other functions for any variety of schemes for enumerating the plane.
A pairing function can usually be defined inductively – that is, given the nth pair, what is the (n+1)th pair? The way Cantor's function progresses diagonally across the plane can be expressed as
π
(
x
,
y
)
+
1
=
π
(
x
−
1
,
y
+
1
)
{\displaystyle \pi (x,y)+1=\pi (x-1,y+1)}
.
The function must also define what to do when it hits the boundaries of the 1st quadrant – Cantor's pairing function resets back to the x-axis to resume its diagonal progression one step further out, or algebraically:
π
(
0
,
k
)
+
1
=
π
(
k
+
1
,
0
)
{\displaystyle \pi (0,k)+1=\pi (k+1,0)}
.
Also we need to define the starting point, what will be the initial step in our induction method: π(0, 0) = 0.
Assume that there is a quadratic 2-dimensional polynomial that can fit these conditions (if there were not, one could just repeat by trying a higher-degree polynomial). The general form is then
π
(
x
,
y
)
=
a
x
2
+
b
y
2
+
c
x
y
+
d
x
+
e
y
+
f
{\displaystyle \pi (x,y)=ax^{2}+by^{2}+cxy+dx+ey+f}
.
Plug in our initial and boundary conditions to get f = 0 and:
b
k
2
+
e
k
+
1
=
a
(
k
+
1
)
2
+
d
(
k
+
1
)
{\displaystyle bk^{2}+ek+1=a(k+1)^{2}+d(k+1)}
,
so we can match our k terms to get
b = a
d = 1-a
e = 1+a.
So every parameter can be written in terms of a except for c, and we have a final equation, our diagonal step, that will relate them:
π
(
x
,
y
)
+
1
=
a
(
x
2
+
y
2
)
+
c
x
y
+
(
1
−
a
)
x
+
(
1
+
a
)
y
+
1
=
a
(
(
x
−
1
)
2
+
(
y
+
1
)
2
)
+
c
(
x
−
1
)
(
y
+
1
)
+
(
1
−
a
)
(
x
−
1
)
+
(
1
+
a
)
(
y
+
1
)
.
{\displaystyle {\begin{aligned}\pi (x,y)+1&=a(x^{2}+y^{2})+cxy+(1-a)x+(1+a)y+1\\&=a((x-1)^{2}+(y+1)^{2})+c(x-1)(y+1)+(1-a)(x-1)+(1+a)(y+1).\end{aligned}}}
Expand and match terms again to get fixed values for a and c, and thus all parameters:
a = 1/2 = b = d
c = 1
e = 3/2
f = 0.
Therefore
π
(
x
,
y
)
=
1
2
(
x
2
+
y
2
)
+
x
y
+
1
2
x
+
3
2
y
=
1
2
(
x
+
y
)
(
x
+
y
+
1
)
+
y
,
{\displaystyle {\begin{aligned}\pi (x,y)&={\frac {1}{2}}(x^{2}+y^{2})+xy+{\frac {1}{2}}x+{\frac {3}{2}}y\\&={\frac {1}{2}}(x+y)(x+y+1)+y,\end{aligned}}}
is the Cantor pairing function, and we also demonstrated through the derivation that this satisfies all the conditions of induction.
Other pairing functions
The function
P
2
(
x
,
y
)
:=
2
x
(
2
y
+
1
)
−
1
{\displaystyle P_{2}(x,y):=2^{x}(2y+1)-1}
is a pairing function.
In 1990, Regan proposed the first known pairing function that is computable in linear time and with constant space (as the previously known examples can only be computed in linear time if multiplication can be too, which is doubtful). In fact, both this pairing function and its inverse can be computed with finite-state transducers that run in real time. In the same paper, the author proposed two more monotone pairing functions that can be computed online in linear time and with logarithmic space; the first can also be computed offline with zero space.
In 2001, Pigeon proposed a pairing function based on bit-interleaving, defined recursively as:
⟨
i
,
j
⟩
P
=
{
T
if
i
=
j
=
0
;
⟨
⌊
i
/
2
⌋
,
⌊
j
/
2
⌋
⟩
P
:
i
0
:
j
0
otherwise,
{\displaystyle \langle i,j\rangle _{P}={\begin{cases}T&{\text{if}}\ i=j=0;\\\langle \lfloor i/2\rfloor ,\lfloor j/2\rfloor \rangle _{P}:i_{0}:j_{0}&{\text{otherwise,}}\end{cases}}}
where
i
0
{\displaystyle i_{0}}
and
j
0
{\displaystyle j_{0}}
are the least significant bits of i and j respectively.
In 2006, Szudzik proposed a "more elegant" pairing function defined by the expression:
ElegantPair
[
x
,
y
]
:=
{
y
2
+
x
if
x
<
y
,
x
2
+
x
+
y
if
x
≥
y
.
{\displaystyle \operatorname {ElegantPair} [x,y]:={\begin{cases}y^{2}+x&{\text{if}}\ x
Which can be unpaired using the expression:
ElegantUnpair
[
z
]
:=
{
{
z
−
⌊
z
⌋
2
,
⌊
z
⌋
}
if
z
−
⌊
z
⌋
2
<
⌊
z
⌋
,
{
⌊
z
⌋
,
z
−
⌊
z
⌋
2
−
⌊
z
⌋
}
if
z
−
⌊
z
⌋
2
≥
⌊
z
⌋
.
{\displaystyle \operatorname {ElegantUnpair} [z]:={\begin{cases}\left\{z-\lfloor {\sqrt {z}}\rfloor ^{2},\lfloor {\sqrt {z}}\rfloor \right\}&{\text{if }}z-\lfloor {\sqrt {z}}\rfloor ^{2}<\lfloor {\sqrt {z}}\rfloor ,\\\left\{\lfloor {\sqrt {z}}\rfloor ,z-\lfloor {\sqrt {z}}\rfloor ^{2}-\lfloor {\sqrt {z}}\rfloor \right\}&{\text{if }}z-\lfloor {\sqrt {z}}\rfloor ^{2}\geq \lfloor {\sqrt {z}}\rfloor .\end{cases}}}
(Qualitatively, it assigns consecutive numbers to pairs along the edges of squares.) This pairing function orders SK combinator calculus expressions by depth.
This method is the mere application to
N
{\displaystyle \mathbb {N} }
of the idea, found in most textbooks on Set Theory,
used to establish
κ
2
=
κ
{\displaystyle \kappa ^{2}=\kappa }
for any infinite cardinal
κ
{\displaystyle \kappa }
in ZFC.
Define on
κ
×
κ
{\displaystyle \kappa \times \kappa }
the binary relation
(
α
,
β
)
≼
(
γ
,
δ
)
if either
{
(
α
,
β
)
=
(
γ
,
δ
)
,
max
(
α
,
β
)
<
max
(
γ
,
δ
)
,
max
(
α
,
β
)
=
max
(
γ
,
δ
)
and
α
<
γ
,
or
max
(
α
,
β
)
=
max
(
γ
,
δ
)
and
α
=
γ
and
β
<
δ
.
{\displaystyle (\alpha ,\beta )\preccurlyeq (\gamma ,\delta ){\text{ if either }}{\begin{cases}(\alpha ,\beta )=(\gamma ,\delta ),\\[4pt]\max(\alpha ,\beta )<\max(\gamma ,\delta ),\\[4pt]\max(\alpha ,\beta )=\max(\gamma ,\delta )\ {\text{and}}\ \alpha <\gamma ,{\text{ or}}\\[4pt]\max(\alpha ,\beta )=\max(\gamma ,\delta )\ {\text{and}}\ \alpha =\gamma \ {\text{and}}\ \beta <\delta .\end{cases}}}
≼
{\displaystyle \preccurlyeq }
is then shown to be a well-ordering such that every element has
<
κ
{\displaystyle {}<\kappa }
predecessors, which implies that
κ
2
=
κ
{\displaystyle \kappa ^{2}=\kappa }
.
It follows that
(
N
×
N
,
≼
)
{\displaystyle (\mathbb {N} \times \mathbb {N} ,\preccurlyeq )}
is isomorphic to
(
N
,
⩽
)
{\displaystyle (\mathbb {N} ,\leqslant )}
and the pairing function above is nothing more than the enumeration of integer couples in increasing order.
Citations
= Notes
== Footnotes
== References
=Steven Pigeon. "Pairing Function". MathWorld.
Lisi, Meri (2007). "Some Remarks on the Cantor Pairing Function". Le Matematiche. LXII: 55–65.
Regan, Kenneth W. (December 1992). "Minimum-Complexity Pairing Functions". Journal of Computer and System Sciences. 45 (3): 285–295. doi:10.1016/0022-0000(92)90027-G. ISSN 0022-0000.{{cite journal}}: CS1 maint: date and year (link)
Szudzik, Matthew (2006). "An Elegant Pairing Function" (PDF). szudzik.com. Archived (PDF) from the original on 25 November 2011. Retrieved 16 August 2021.
Szudzik, Matthew P. (1 June 2017). "The Rosenberg-Strong Pairing Function". arXiv:1706.04129 [cs.DM].
Jech, Thomas (2006). Set Theory. Springer Monographs in Mathematics (The Third Millennium ed.). Springer-Verlag. doi:10.1007/3-540-44761-X. ISBN 3-540-44085-2.
Hopcroft, John E.; Ullman, Jeffrey D. (1979). Introduction to Automata Theory, Languages, and Computation (1st ed.). Addison-Wesley. ISBN 0-201-02988-X.
Stein, Sherman K. (1999). Mathematics: The Man-Made Universe (3rd ed.). Dover. ISBN 9780486404509.
Kata Kunci Pencarian:

Pairing function - Alchetron, The Free Social Encyclopedia

Pairing function - HandWiki

5. (Pairing function.) A pairing function p is a | Chegg.com

Pairing Function Ordered Pair Countable Set Natural Number PNG, Clipart ...

Helping students with pair programming

Helping students with pair programming

Solved Determine whether the pairing is a function, If it is | Chegg.com
Solved Choose the correct pairing of the function and its | Chegg.com

Solved Choose the correct pairing of the function and its | Chegg.com
Solved Choose the correct pairing of the function and its | Chegg.com

A Beginner's Wine and Food Pairing Chart | Wine Folly

The pairing procedure | Download Scientific Diagram
pairing function
Daftar Isi
Generalizations of pairing function - Mathematics Stack Exchange
After nesting the $2^x(2y+1)-1$ pairing function into its linear variable some finite number of times, the final linear component will have to be 0 eventually for any finite starting integer. I think this arbitrary-dimensional tupling function based on that pairing function might be an example of what you are talking about:
Generalization of Cantor Pairing function to triples and n-tuples
Jul 29, 2015 · The pairing function takes two numbers as input and returns one: $ \mathbb{N} \times \mathbb{N} \to \mathbb{N}$ So what do you do with, say, a 3-tuple? Pick 2 items, use the pairing function to turn that into 1. Now use the pairing function again to turn your two remaining items into 1. More formally
elementary set theory - Proving the Cantor Pairing Function …
Dec 14, 2011 · Stack Exchange Network. Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
What is Gödel's pairing function on ordinals? - MathOverflow
Nov 11, 2012 · A pairing function like this is needed when one develops constructibility using the Gödel functions (as opposed to the nowadays more common development using definability). And if I remember correctly, Gödel's book used the Gödel functions while his paper in the Proceedings of the National Academy used definability (or did I get that ...
Pairing function - Mathematics Stack Exchange
Is there any pairing function that could encode two positive, natural numbers, with values ranging from $0$ to $3000$, into a single natural number with a value less or equal to $65535$?
How do pairing functions (don't) work for negative values?
Aug 31, 2022 · I've been exploring the idea of using Szudzik's pairing function as a rolling hash. I have a series of integers as in: $ 1,2,3,4,5 $ The idea is to apply the pairing function (nice online implementation here) to integers, using the result as the first input to …
What pairing function coincides with the Gödel pairing on the …
Jan 2, 2021 · Noah Schweber is correct (of course). Gödel's pairing function is a pairing function on the natural numbers. It just also extends beyond them. Once you get the basic idea of these functions, it is easy to come up with new ones. Just pick some path through all the lattice points and invert it. For example, this path provides another pairing ...
Create unique number from 2 numbers - Mathematics Stack …
Mar 20, 2018 · Google pairing function. As I mentioned in the similar question, there are also other pairing functions besides the well-known one due to Cantor. For example, see this "elegant" pairing function, which has the useful property that it orders many expressions by depth.
Is the Cantor Pairing function guaranteed to generate a unique …
Sep 21, 2017 · I recently learned that for natural numbers, the Cantor Pairing function allows one to output a unique natural number from any combination of two natural numbers. According to wikipedia, it is a
analysis - Cantor Pairing Function - How was this derived ...
Mar 17, 2019 · Could someone give some insight into its derivation? I've seen the exercise before in my past classes, but we were always given the pairing function beforehand. I mapped out the integer lattice for this function, and I can see why it works, but how exactly did Cantor come up with the general function? Did he use the same method I attempted?