Question: Why am I getting a negative pdf?

Hello,

I plot a pdf of the average of two iid random variables, and get that it is negative. What am I doing wrong?

Here is an example:

restart;
with(plots);
with(Statistics);
X1 := RandomVariable(BetaDistribution(4, 4));
X2 := RandomVariable(BetaDistribution(4, 4));
plot([PDF(X1, t), PDF(0.5*X1 + 0.5*X2, t)], t = 0 .. 1, color = [red, blue], legend = ["PDF X1", "PDF average"]);

Please Wait...