Let $Z = ||X-Y||_2^2$ where $X$ and $Y$ are two points selected uniformly-randomly and independently on the unit circle. I'm trying to find the PDF of $Z$.
It is very similar to this question but answers over there are too clever for me. So here is what I did:
Since we are on the unit circle, if we switch to polar coordinates, both $X$ and $Y$ can be characterized by the angle. So, $$ X = \begin{bmatrix}cos(\theta_x)\\sin(\theta_x)\end{bmatrix}\ \ \ Y = \begin{bmatrix}cos(\theta_y)\\sin(\theta_y)\end{bmatrix}$$
where $\theta_x$ and $\theta_y$ are both $\sim Unif(0, 2\pi)$. Now the squared $L_2$ norm becomes
\begin{align*}
||X-Y||_2^2 & =
(cos(\theta_x)-cos(\theta_y))^2 + (sin(\theta_x)-sin(\theta_y))^2 \\[7pt]
& = 2 – 2(cos(\theta_x)cos(\theta_y)+sin(\theta_x)sin(\theta_y)) \\[7pt]
& = 2 – 2cos(\theta_x – \theta_y)
\end{align*}
I can now formulate the CDF of $Z$:
\begin{align*}
P(Z\leq z) & = P(||X-Y||_2^2 \leq z) \\[10pt]
& = P(2 – 2cos(\theta_x – \theta_y) \leq z) \\[7pt]
& = P(cos(\theta_x – \theta_y) \geq \frac{2-z}{2})
\end{align*}
Now I take $arccos$ of both terms:
\begin{align*}
P(Z\leq z) & = P(\theta_x – \theta_y \leq arccos(\frac{2-z}{2}))
\end{align*}
And I think this corresponds to the area of the white trapezoid below, where axes represent $\theta_x$ and $\theta_y$, red & blue lines are boundaries for $(0, 2\pi)$ and green line is $\theta_x – \theta_y = arccos(\frac{2-z}{2})$:
which gives
$$ F_Z(z) =
\begin{cases}
0 & \text{ for } z \leq 0\\[7pt]
4\pi^2 – \frac{1}{2} (2\pi – arccos(\frac{2-z}{2}))^2 & \text{ for } 0 \lt z \lt 4\\[7pt]
1 & \text{ for } z \geq 4\\
\end{cases}$$
but this can't be true because $F_Z(z)$ is not continous at either end. I suspect I failed with the $arccos$ operation, any thoughts on how can I correct the steps?
Best Answer
Not repeating all the steps that you have already done correctly.
$\theta = \theta_x - \theta_y$ is the angle measured between the two randomly chosen points on the circle from its center.
Please note $\theta$ is uniformly distributed between $0$ and $\pi$.
Formulating the CDF of $Z$ -
\begin{align*} F_Z(z) \equiv P(Z\leq z) & = P(||X-Y||_2^2 \leq z) \\[10pt] & = P((2 - 2cos \theta) \leq z) \\[7pt] & = P(cos \theta \geq \frac{2-z}{2}) \\[7pt] & = P(cos \theta \geq \frac{2-z}{2}) \\[7pt] & = P(\theta \leq \arccos\frac{2-z}{2}) \\[7pt] \end{align*}
We know
$$F_{\theta}(\theta) = \begin{cases} \frac{\theta}{\pi} & 0 \leq \theta \leq \pi \\[7pt] 0 & \text{ otherwise } \\ \end{cases}$$
So,
$$F_{Z}(z) = \begin{cases} \frac{1}{\pi} \arccos\frac{2-z}{2} & 0 \leq z \leq 4 \\[7pt] 0 & \text{ otherwise } \\ \end{cases}$$
So, pdf $ = \frac{1}{\pi} \frac{d(\arccos\frac{2-z}{2})}{dz} = \frac{1}{\pi} \frac{1}{\sqrt {4z-z^2}} \text { } (0 \leq z \leq 4)$