Incorrect result of PDF

The execution of the command

r = PDF[TransformedDistribution[x*y, {x \[Distributed] UniformDistribution[{0, 1}],
y \[Distributed] DiscreteUniformDistribution[{0, 1}]}], t]


$$\begin{cases} \frac{1}{2} & 01\lor t<0 \\ \text{Indeterminate} & \text{True} \end{cases}$$

brings an incorrect result in view of

Integrate[r, {t, -Infinity, Infinity}]


1/2

whereas I was learned this integral must equal one. This implies the discordance between

CentralMoment[TransformedDistribution[x*y, {x \[Distributed] UniformDistribution[{0, 1}],
y \[Distributed] DiscreteUniformDistribution[{0, 1}]}], 2]


5/48

and

Integrate[(t - 1/4)^2*r, {t, -Infinity, Infinity}]


7/96

In the above

Mean[TransformedDistribution[x*y, {x \[Distributed] UniformDistribution[{0, 1}],
y\[Distributed] DiscreteUniformDistribution[{0, 1}]}]]


1/4

and the the same definitions from Encyclopedia of Mathematics and Wiki are used.

I am sure that the PDF r does not exist because

CDF[TransformedDistribution[x*y, {x \[Distributed] UniformDistribution[{0, 1}],
y \[Distributed] DiscreteUniformDistribution[{0, 1}]}], t]


$$\begin{cases} \frac{1}{2} & t=0 \\ 1 & t\geq 1 \\ \frac{t+1}{2} & 0

is not an absolutely continuous function. Am I not right?

• It appears that Mathematica does not always play well when mixing continuous and discrete distributions (which is what you have). Notice that the initial pdf doesn't include the probability mass at zero (i.e., $t=0$ is not included). For example, the documentation for MixtureDistribution explicitly states that the distribution mixtures must be all continuous or all discrete.
– JimB
Nov 10 '21 at 15:14
• @JimB: Thank you for your response. I don't use MixtureDistribution. The documentation to TransformedDistribution does not states that the transformed distributions must be all [absolutely] continuous or all discrete. Also PDF[TransformedDistribution[x*y, {x \[Distributed] UniformDistribution[{0, 1}], y \[Distributed] DiscreteUniformDistribution[{2, 3}]}], t] is OK. Nov 10 '21 at 15:45
• BTW, the notion of PDF for a discrete distribution is not standard, e.g. Encyclopedia of Mathematics and Harald Cramér in Mathematical Methods of Statistics do not use it (Harald Cramér uses the notion "probability distribution".). Nov 10 '21 at 16:17
• I’m voting to close this question because it's essentially a bug report that should be directed to WRI. Tacking on "Am I right?" at the end doesn't really make it a question suited for Stack Exchange.
– chuy
Nov 10 '21 at 20:00
• @chuy: Disagree. This is a normal question. Maybe, something is not taken into account by me. Maybe, there is a workaround. Nov 11 '21 at 14:34