Maybe, if you posted the entire problem.
Hi everyone,
I am trying to calculate the PDF of Y-Z given that Y>Z. Random variables Y and Z are independent and uniformly distributed over the interval [0,1].
I have tried calculating |Y-Z| (the PDF is basically a half triangle with height 2 and width 1), but I do not think this is correct. I think that the restriction Y>Z creates a situation where the random variables are not independent, so convolution is not valid.
In trying to understand this problem, I created a Matlab script to look at the empirical PDF. The result is clearly not linear like we would expect from |Y-Z|, but it has a quadratic form of some kind. The Matlab code is listed below.
Any ideas for solving this?
==========================================
clear;
clc;
out = [];
for rounds = 1:30000;
y = rand;
z = rand;
while y<z
z = rand;
end
out = [out y-z];
end
[pdf,xout] = hist(out,100);
pdf = pdf/sum(pdf);
stem(xout,pdf)