WOLFRAM|DEMONSTRATIONS PROJECT

Approximation by Rationals

​
choose x
1.41421
choose q
3
calculate p automatically
find p such that p/q ∈ (x-1/2q, x+1/2q)
1
This Demonstration illustrates that any real number can be approximated by a rational number to within an error equal to half its denominator. In symbols, for any real
x
and natural number
q
, there is a natural number
p
such that
|x-p/q|<1/2q
.
This can be seen by partitioning the real line into the half-open intervals
[p/q,(p-1)/q)
of length
1/q
,
p∈
. The number
x
must fall into such an interval.