HOME

TheInfoList



OR:

In mathematics, rational reconstruction is a method that allows one to recover a
rational number In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ra ...
from its value modulo a
sufficiently large In the mathematical areas of number theory and analysis, an infinite sequence or a function is said to eventually have a certain property, if it doesn't have the said property across all its ordered instances, but will after some instances have pa ...
integer An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
.


Problem statement

In the rational reconstruction problem, one is given as input a value n \equiv r/s\pmod. That is, n is an integer with the property that ns\equiv r\pmod. The rational number r/s is unknown, and the goal of the problem is to recover it from the given information. In order for the problem to be solvable, it is necessary to assume that the modulus m is sufficiently large relative to r and s. Typically, it is assumed that a range for the possible values of r and s is known: , r, < N and 0 < s < D for some two numerical parameters N and D. Whenever m > 2ND and a solution exists, the solution is unique and can be found efficiently.


Solution

Using a method from
Paul S. Wang Paul S. Wang is a Chinese-American computer scientist, researcher, author, consultant, and academic. He is Professor Emeritus of Computer Science at Kent State University. Wang's expertise lies in automation of mathematical computation. He has co ...
, it is possible to recover r/s from n and m using the
Euclidean algorithm In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an ...
, as follows.. One puts v = (m,0) and w = (n,1). One then repeats the following steps until the first component of ''w'' becomes \leq N. Put q = \left\lfloor\right\rfloor, put ''z'' = ''v'' − ''qw''. The new ''v'' and ''w'' are then obtained by putting ''v'' = ''w'' and ''w'' = ''z''. Then with ''w'' such that w_\leq N, one makes the second component positive by putting ''w'' = −''w'' if w_<0. If w_2 and \gcd(w_1,w_2)=1, then the fraction \frac exists and r = w_ and s = w_, else no such fraction exists.


References

{{reflist Number theoretic algorithms