If I have an array of $n$ numbers in the range [0,1) and have the following events for $y$:
for $i=1$ to $n$ :
generate a new number $y$ in [0,1) uniformly and independent of previous
if $y\ge0.5$ then
toss a fair coin
if the coin turns up "HEADS" then
$y=y-0.5$
I need to find out what is the probability that y is in the range [0,1/n)
My solution:
$1/2+1/2\cdot1/2=3/4$ - the first 1/2 is the probability when y is not greater than 0.5. The second $1/2\cdot1/2$ is the probability when $y>0.5$ AND because of the fair coin - we have 1/2 change of being HEADS.
Is it the correct way ? Do I need to add n into the equation? Please correct me if I am wrong. Thanks!
Assume $n$ is fixed beforehand. Then for each $y$ probability that it will be in range [$0,1/n$) is
$$\frac{3}{4}*(\frac{1/n}{1/2})=\frac{3}{4}*\frac{2}{n}=\frac{3}{2n}$$
because with probability $\frac{3}{4}$ $y$ is a random number from [$0,1/2$) and there with probability $\frac{1/n}{1/2}$ it belongs to the range [$0,1/n$).
Hereby:
1. Probability that all $y \in$ [$0,1/n$) is equal to $$(\frac{3}{2n})^n$$ 2. Probability that exists $y \in$ [$0,1/n$) is equal to:$$1-(1-\frac{3}{2n})^n$$ which is $1-$ probability that all $y \in$ [$1/n,1$)