This is from an exercise which my friend and my can't fully wrap our heads around.
Given $X\sim Exp(\lambda)$ what is the distribution of $Y = X - \texttt{floor(}{X}\texttt{)}$
Approach: Compute pdf of $\texttt{floor(}{X}\texttt{)}$ like in this question and then use the formula for computing the difference of two random variables $f_y(y) = \int_0^{\infty} f_X(x)*f_{\texttt{floor(}{X}\texttt{)}}(y-x) dx$
Unfortunately, this integral diverges for $f_{\texttt{floor(}{X}\texttt{)}} = \lambda e^{-\lambda(y-x+1)}$ and $f_X(x) = \lambda e^{-\lambda x}$
Thank you for other approaches and ideas!
A possible approach. Use the law of total probability and partition based on the value of $\lfloor X\rfloor$. Indeed for $y\in [0,1)$, $$ \begin{align*} P(Y\leq y)&=\sum_{k=0}^\infty P(X-\lfloor X\rfloor\leq y, \lfloor X\rfloor=k)\tag{0}\\ &=\sum_{k=0}^\infty P(X\leq k+ y, k\leq X<k+1)\\ &=\sum_{k=0}^\infty P(k\leq X\leq k+y)\\ &=\sum_{k=0}^\infty e^{-\lambda k}-e^{-\lambda(k+y)}\\ &=\sum_{k=0}^\infty e^{-\lambda k}(1-e^{-\lambda y})\\ &=\frac{1-e^{-\lambda y}}{1-e^{-\lambda}} \end{align*} $$ where in (0) we used the law of total probability. Differentiating we get that the density is given by $$ f(y)=\frac{\lambda e^{-\lambda y}}{1-e^{-\lambda}} $$ for $y\in [0,1)$ and equal to zero otherwise.