= Solution
Use the uniform proposal on $[1,7]$, with density $g=1/6$. The <triangular distribution> peaks at $x=3$ with height $1/3$, so the optimal constant for this proposal is $M=2$. At each attempt take two fresh pseudo-random uniforms $U,V$, and propose $Y=1+6U$. The <rejection method> accepts according to
$$
\boxed{V\le\begin{cases}(Y-1)/2,&1\le Y\le3,\\(7-Y)/4,&3<Y\le7.\end{cases}}
$$
Indeed these bounds are $f(Y)/(2g(Y))=3f(Y)$. Part (a) proves that the accepted value has the required density. Acceptance probability is $1/2$, so the method needs two proposal attempts on average, and hence four uniforms on average if each attempt uses two. The validity of the ideal algorithm presumes independent uniform draws; merely belonging to $[0,1]$ does not by itself make a pseudo-random sequence uniform or independent.
Back to article page