# Generating a sample of Epanechnikov Kernel

So I am really struggling with this problem and could use some help.

Consider the Epanechnikov kernel given by $$f_e(x)=\frac{3}{4}\left( 1-x^2 \right)$$

According to Devorye and Gyofri to generate a sample of a distribution having $f_e$ as its density function we can use the following method

1. Generate iid $U_1,U_2,U_3 \sim \operatorname{Uniform}(-1,1)$.
2. If $\left| U_3\right| \geq \left| U_2\right|$ and $\left| U_3\right| \geq \left| U_1\right|$, deliver $U_2$; otherwise deliver $U_3$.

I have to prove this works. I thought this was related to either the acceptance-rejection method or maybe order statistics. I have spent a fair bit of time trying both approaches but I am stuck. Any pointers will be greatly appreciated.

• Please correct: Devroye and Györfi (and possibly Lugosi). – Did Sep 24 '15 at 8:54

$(U_1,U_2,U_3)$ is a random point in the cube $[-1,1]^3$. Let $V$ be the distribution generated by the given algorithm: it is obviously a symmetric distribution supported on $[-1,1]$. If we take some $\alpha\in[0,1]$, the probability that $|V|\leq \alpha$ is given by the probability that $\max(|U_1|,|U_2|)\leq|U_3|$ and $|U_2|\leq \alpha$, plus the probability that $\max(|U_1|,|U_2|)>|U_3|$ and $|U_3|\leq \alpha$, hence by:
$$\int_{0}^{\alpha}\left(\int_{0}^{u_2}(1-u_2)\,du_1+\int_{u_2}^{1}(1-u_1)\,du_1\right)\,du_2+ \int_{0}^{\alpha}(1-u_3^2)\,du_3$$ that is $\frac{3\alpha-\alpha^3}{2}$. That gives: $$\mathbb{P}[0\leq V\leq \alpha] = \frac{3\alpha-\alpha^3}{4}$$ and by differentiating with respect to $\alpha$ we get that the PDF of $V$ is given by $\frac{3}{4}(1-x^2)$, as wanted.