Pairing function

Pairing function

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. In theoretical computer science they are used to encode a function defined on a vector of natural numbers "f":N"k" → N into a new function "g":N → N.

Definition

A pairing function is a primitive recursive bijection:pi:mathbb{N} imes mathbb{N} o mathbb{N}.

Cantor pairing function

The Cantor pairing function is a pairing function :pi:mathbb{N} imes mathbb{N} o mathbb{N}defined by :pi(k_1,k_2) := frac{1}{2}(k_1 + k_2)(k_1 + k_2 + 1)+k_2.

When we apply the pairing function to k_1 and k_2 we often denote the resulting number as langle k_1, k_2 angle ,.

This definition can be inductively generalized to the Cantor tuple function:pi^{(n)}:mathbb{N}^n o mathbb{N}as:pi^{(n)}(k_1, ldots, k_{n-1}, k_n) := pi ( pi^{(n-1)}(k_1, ldots, k_{n-1}) , k_n) ,.

Inverting the Cantor pairing function

Suppose we are given "z" with : z = langle x, y angle = frac{(x + y)(x + y + 1)}{2} + y

and we want to find "x" and "y". It is helpful to define some intermediate values in the calculation: : w = x + y !: t = frac{w(w + 1)}{2} = frac{w^2 + w}{2} : z = t + y !

where "t" is the triangle number of "w". If we solve the quadratic equation : w^2 + w - 2t = 0 !

for "w" as a function of "t", we get : w = frac{sqrt{8t + 1} - 1}{2}

which is a strictly increasing and continuous function when "t" is non-negative real. Since : t leq z = t + y < t + (w + 1) = frac{(w + 1)^2 + (w + 1)}{2}

we get that : w leq frac{sqrt{8z + 1} - 1}{2} < w + 1

and thus : w = leftlfloor frac{sqrt{8z + 1} - 1}{2} ight floor .

So to calculate "x" and "y" from "z", we do:: w = leftlfloor frac{sqrt{8z + 1} - 1}{2} ight floor : t = frac{w^2 + w}{2} : y = z - t !: x = w - y !.

Since the Cantor pairing function is invertible, it must be one-to-one and onto.

References

*mathworld|urlname=PairingFunction|author=Steven Pigeon|title=Pairing function


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Pairing-based cryptography — is the use of a pairing between elements of two groups to a third group to construct cryptographic systems. Usually the same group is used for the first two groups, making the pairing in fact a mapping from two elements from one group to an… …   Wikipedia

  • Computable function — Total recursive function redirects here. For other uses of the term recursive function , see Recursive function (disambiguation). Computable functions are the basic objects of study in computability theory. Computable functions are the formalized …   Wikipedia

  • Weil pairing — In mathematics, the Weil pairing is a construction of roots of unity by means of functions on an elliptic curve E , in such a way as to constitute a pairing (bilinear form, though with multiplicative notation) on the torsion subgroup of E . The… …   Wikipedia

  • Dirac delta function — Schematic representation of the Dirac delta function by a line surmounted by an arrow. The height of the arrow is usually used to specify the value of any multiplicative constant, which will give the area under the function. The other convention… …   Wikipedia

  • Origin and function of meiosis — Eukaryotes are organisms with a true nucleus in which the DNA genome is enclosed in a double membrane (e.g. fungi, protozoans, vertebrates, higher plants), in contrast to prokaryotes (bacteria and blue green algae) that lack a nuclear membrane.… …   Wikipedia

  • Gödel numbering for sequences — A Gödel numbering for sequences provides us an effective way to represent each finite sequence of natural numbers as a single natural number. Of course, the embedding is surely possible set theoretically, but the emphasis is on the effectiveness… …   Wikipedia

  • BLS (Cryptography) — In cryptography, the Boneh Lynn Shacham signature scheme allows a user to verify that a signer is authentic . The scheme uses a pairing function for verification and signatures are group elements in some elliptic curve. Working in an elliptic… …   Wikipedia

  • First-order logic — is a formal logical system used in mathematics, philosophy, linguistics, and computer science. It goes by many names, including: first order predicate calculus, the lower predicate calculus, quantification theory, and predicate logic (a less… …   Wikipedia

  • List of mathematics articles (P) — NOTOC P P = NP problem P adic analysis P adic number P adic order P compact group P group P² irreducible P Laplacian P matrix P rep P value P vector P y method Pacific Journal of Mathematics Package merge algorithm Packed storage matrix Packing… …   Wikipedia

  • Recursively enumerable set — In computability theory, traditionally called recursion theory, a set S of natural numbers is called recursively enumerable, computably enumerable, semidecidable, provable or Turing recognizable if: There is an algorithm such that the set of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”