TAOCP 3.3.3 Exercise 22

Let $s(x)=\{ax+\theta\}, \qquad 0\le \theta<1,$ where $a$ is an integer and $x$ is uniformly distributed on $[0,1)$.

Section 3.3.3: Theoretical Tests

Exercise 22. [M22] Let $a$ be an integer, and let $0 \le \theta < 1$. If $x$ is a random real number, uniformly distributed between 0 and 1, and if $s(x) = {ax + \theta}$, what is the probability that $s(x) < x$? (This is the "real number" analog of Theorem P.)

Verified: no
Solve time: 1m23s


Solution

Let

$s(x)={ax+\theta}, \qquad 0\le \theta<1,$

where $a$ is an integer and $x$ is uniformly distributed on $[0,1)$.

We seek the probability

$P=\Pr(s(x)<x).$

Since $a$ is an integer,

$$$$

Hence

$$$$

is equivalent to

$$$$

or

$$$$

Let

$$$$

For each integer $k$, the condition $\lfloor ax+\theta\rfloor=k$ holds precisely when

$$$$

On this interval, the inequality $\lfloor ax+\theta\rfloor>b x+\theta$ becomes

$$$$

Therefore the set of $x$ satisfying $s(x)<x$ is

$$ \left[\frac{k-\theta}{a},,\frac{k+1-\theta}{a}\right) \cap \left[0,\frac{k-\theta}{b}\right), $$

for those integers $k$ with $0\le k<a$.

Assume first that $a>1$. Since $b=a-1>0$, the interval contributes exactly when

$$$$

that is, when $k>\theta$. Because $0\le\theta<1$ and $k$ is integral, this means

$$$$

For $1\le k\le a-1$ the length of $E_k$ is

$$

\frac{k-\theta}{a(a-1)}. $$

Hence

$$

\sum_{k=1}^{a-1} \frac{k-\theta}{a(a-1)}

\frac{1}{a(a-1)} \left( \sum_{k=1}^{a-1}k-(a-1)\theta \right). $$

Using

$$ \sum_{k=1}^{a-1}k=\frac{a(a-1)}2, $$

we obtain

$$ P

\frac{1}{a(a-1)} \left( \frac{a(a-1)}2-(a-1)\theta \right)

\frac12-\frac{\theta}{a}. $$

Now consider $a=1$. Then

$$$$

If $0\le x<1-\theta$, then $s(x)=x+\theta>x$.

If $1-\theta\le x<1$, then $s(x)=x+\theta-1<x$.

Therefore

$$ P=\theta. $$

The formula obtained above for $a>1$ also gives

$$ P=\frac12-\frac{\theta}{a}. $$

Combining the two cases yields the real-number analog of Theorem P:

$$ \Pr\bigl({ax+\theta}<x\bigr)

\frac12-\frac{\theta}{a}, \qquad a>1. $$

Thus the required probability is

$$ \boxed{\frac12-\frac{\theta}{a}}. $$