Let $w$ and $d$ be positive real numbers. A point $x$ and a point $y$ are selected at random from the closed interval $[0,w]$ of the real number line. What is the probability that the distance between $x$ and $y$ is less than $d$? (Your answer should be a formula in terms of $w$ and $d$.)
My solution : The distance between $x$ and $y$ is less than $d$ if and only if $|x - y| < d$. Geometrically, this means that we are looking for the probability that the points $x$ and $y$ lie within a strip of width $2d$ centered on the diagonal of the square $[0,w] \times [0,w]$.
The diagonal has length $\sqrt(w^2 + w^2) = \sqrt(2)w$, so the area of the square is $w^2$, and the area of the strip is $2dw$.
Thus, the probability that $|x - y| < d$ is the ratio of the area of the strip to the area of the square:
$P(|x - y| < d)$ = (area of strip) / (area of square) = $\frac{2dw}{w^2} = \frac{2d}{w}$.
Therefore, the probability that the distance between $x$ and $y$ is less than $d$ is $2d/w$
Is my solution correct?.
Thank you.