Find example of random variable $\xi$ and continuous function $g$ such that $g \circ \xi$ has discrete distribution Recently I was trying to see if there exist such interesting example:
Let there be such a random variable $\xi$, that it has probability density function $p(x)$. Is it posible that if I compose it with continuous function $g$ I would get random variable $g(\xi) \not\equiv c \in \mathbb{R}$ that would have discrete distribution.
I was trying hard but could not come up with example of such random variable and continuous function. I would love to listen some examples or explanation why it is not possible. Thanks in advance!
 A: You are not putting enough restrictions to make the problem "difficult" :D , even if it is an interesting observation.
Just choose a bimodal pdf where the two modes are separated by an interval where the pdf is zero. You can also choose $p(x)$ to be continuous, even if this is not a restriction of the OP. Let the support of the first mode be $I_1=(-\infty,a]$ and of the second $I_2=[b,+\infty)$ with $b>a$.
Now it is clear that you can have a function g continuos sending $I_1$ to a constant, $I_2$ to another constant and in between it just connects the two "branches". Again, continuity clearly permits it.
The composition $g \circ X$ is than a r.v. with a discrete distribution, since it has a discrete codomain.
Probably the problem becomes more challanging if you replace the continuity condition with smoothness (both of the p.d.f. and of g), but also in that case I think you can build similar counterexamples, using Bump functions : https://en.wikipedia.org/wiki/Bump_function
A: Let $$p(x) := \begin{cases} \frac 12 & x \in [-1,0] \\
\frac 12 & x \in [1,2] \\
0 & x \not \in [-1,0] \cup [1,2]
\end{cases}$$
and $$g(x) := \begin{cases} 0 & x \le 0 \\
x & x \in [0,1] \\
1 & x \ge 1. \end{cases}$$
Then $g(\xi)$ is a Bernoulli random variable with $P(g(\xi) = 0)  = P(g(\xi) = 1)= \frac 12$.
