[Math] Pseudorandom Number Generator Using Uniform Random Variable

probabilityprobability distributionsrandomstatisticsuniform distribution

I am working out of Mathematical Statistics and Data Analysis by John Rice and ran into the following interesting problem I'm having trouble figuring out.

Ch 2 (#65)

How could random variables with the following density function be generated from a uniform random number generator?

$$f(x) = \frac{1 + \alpha x}{2}, \quad -1 \leq x \leq 1,\quad -1 \leq \alpha \leq 1$$

So I believe I'm suppose to use the following fact to solve the problem

Proposition D

Let U be uniform on [0, 1], and let X = $F^{-1}$(U). Then the cdf of X is F.

Proof

$$P(X \leq x) = P(F^{-1}(U) \leq x) = P(U \leq F(x)) = F(x)$$

That is, we can use uniform random variables to generate other random variables that will have cdf F

So my goal should then be to find a cdf and it's inverse then give as input to the inverse the uniform random variable. I've included my attempt.

Given $f(x) = \frac{1 + \alpha x}{2}$

$$F(X) = \int_{-1}^{x} \frac{1 + \alpha t}{2} dt \; = \; \frac{x}{2} + \frac{\alpha x}{4} + \frac{1}{2} – \frac{\alpha}{4}$$

$$4 \cdot F(X) – 2 + \alpha = 2x + \alpha x$$

$$F^{-1}(X) = \frac{4X – 2 + \alpha}{2 + \alpha}$$

So our random variable is, for example, T where

$$T = F^{-1}(U) = \frac{4U – 2 + \alpha}{2 + \alpha}$$

The answer in the back of the book is

$$X = [-1 + 2 \sqrt{1/4 – \alpha(1/2 – \alpha / 4 – U)}]/ \alpha$$

I'm not really sure where I went wrong. Any help?

Best Answer

The cdf appears to be wrong. When $-1\leq x\leq 1$, \begin{align*} F_X(x) &= \int_{-1}^{x} \frac{1 + \alpha t}{2} dt\\ &=\int_{-1}^x \frac{1}{2}+\frac{\alpha}{2}t\,dt\\ &=\frac{1}{2}[x+1]+\frac{\alpha}{4}[x^2-1]\\ \end{align*} Other than that, your approach seems fine.