Let $X$ be a geometric random variable with the following distribution: \begin{align} \mathbb P\{X=x\}=p^x(1-p) \end{align} where $$x=0,1,2,...$$ The random variable $$W=\cos{\frac{2\pi X}{N}}$$ for some integer $N$. Compute the probability mass function of $W$. You should consider the case when $N$ is odd or $N$ is even separately.
My attempt:
Let $$Y=\frac{2\pi X}{N}$$ Although $W=\cos{\frac{2\pi X}{N}}=\cos{Y}$ is not a monotone function, it can be divided into a finite number of regions in which it is monotone. Due to the symmetry of the cosine function, it is sufficient to consider the case where $y\in[0,\pi]$ and then scale the density with factor $n$, where $n$ denotes the number of regions.
If $y\in[0,\pi]$, or equivalently $x\in[0,\frac{N}{2}]$ then $W=\cos{\frac{2\pi X}{N}}=\cos{Y}$ is a one-to-one function, and we can now compute the inverse transformation: \begin{align} x=\frac{N}{2\pi}\arccos{w} \end{align} The probability mass function of $W$ in this special case is: \begin{align} f_W(w)&=f_X\bigg(\frac{N}{2\pi}\arccos{w}\bigg)\\ &=p^{\frac{N}{2\pi}\arccos{w}}(1-p) \end{align} In the general case, we have: \begin{align} f_W(w)=np^{\frac{N}{2\pi}\arccos{w}}(1-p) \end{align} If $N$ is even, we count the point $w=-1$ twice each time we add regions, hence we need to subtract it: \begin{align} f_W(w)&=n\bigg[p^{\frac{N}{2\pi}\arccos{w}}(1-p)-p^{\frac{N}{2}}(1-p)\bigg]\\ &=n(1-p)\bigg(p^{\frac{N}{2\pi}\arccos{w}}-p^{\frac{N}{2}}\bigg) \end{align}
My questions:
My answer looks quite messy so I am not sure if it is correct or not. If someone can comment on that or suggest other simpler methods for solving it would be greatly appreciated. Thank you!
I would approach the problem this way.
The variable $W$ can take on only $\left\lfloor\frac N2\right\rfloor+1$ values $W_x$ with $x=0\dots\left\lfloor\frac N2\right\rfloor$.
If $N$ is odd the probability of the value $w_x$ is $$ \mathbb P(W=w_x)= \begin{cases}\displaystyle (1-p)\sum_{k=0}^{\infty}p^{kN}\\ \displaystyle (1-p)\left[\sum_{k=0}^{\infty}p^{kN+x}+\sum_{k=1}^{\infty}p^{kN-x}\right]\\ \end{cases}= \frac{1-p}{1-p^N}\begin{cases}\displaystyle\vphantom{\sum_{k=0}^{\infty}} 1,& x=0,\\ \displaystyle\vphantom{\sum_{k=0}^{\infty}} p^x+p^{N-x},& x=1\dots\frac{N-1}2.\\ \end{cases} $$ The case of even $N$ is left to you.