Two discrete RVs \(X\) and \(Y\) are independent if
\[ p_{X, Y}(x, y) = p_X(x) \cdot p_{Y}(y), \;\; \text{for all $x$ and $y$.} \]
Two continuous RVs \(X\) and \(Y\) are independent if
\[ f_{X, Y}(x, y) = f_X(x) \cdot f_{Y}(y), \;\; \text{for all $x$ and $y$.} \]
Let \((X, Y)\) be a random point on the unit square.
Its joint PDF:
\[ \begin{aligned} f_{X, Y}(x, y) &= \begin{cases} 1, & \text{if $x, y \in [0, 1]$,} \\ 0, & \text{otherwise.} \end{cases} \end{aligned} \]
Let \((X, Y)\) be a random point on the unit square.
\[ \begin{aligned} f_{X, Y}(x, y) &= \begin{cases} 1, & \text{if $x, y \in [0, 1]$,} \\ 0, & \text{otherwise.} \end{cases} \end{aligned} \]
\[ \small{ \begin{aligned} f_{X}(x) &= \begin{cases} 1, & \text{if $x \in [0, 1]$,} \\ 0, & \text{otherwise.} \end{cases} \end{aligned} } \]
\[ \small{ \begin{aligned} f_{Y}(y) &= \begin{cases} 1, & \text{if $y \in [0, 1]$,} \\ 0, & \text{otherwise.} \end{cases} \end{aligned} } \]
\[ f_{X, Y}(x, y)=f_{X}(x) \cdot f_{Y}(y) \]
\(X\) and \(Y\) are independent.

\[ \begin{aligned} f_{X}(x) &= \begin{cases} \frac{1}{d/2}, & \text{if $0 < x < \frac{d}{2}$,} \\ 0, & \text{otherwise.} \end{cases} \\ \\ f_{\Theta}(\theta) &= \begin{cases} \frac{1}{\pi/2}, & \text{if $0 < \theta < \frac{\pi}{2}$,} \\ 0, & \text{otherwise.} \end{cases} \\ \end{aligned} \]
By independence of \(X\) and \(\Theta\), we have
\[ \begin{aligned} f_{X, \Theta}(x, \theta) &= f_{X}(x) \cdot f_{\Theta}(\theta) \\ \\ &= \begin{cases} \frac{4}{\pi d}, & \text{if $0 < x < \frac{d}{2}, 0 < \theta < \frac{\pi}{2}$,} \\ 0, & \text{otherwise.} \end{cases} \end{aligned} \]
When does the needle intersect with a line?

The needle intersects with a line if and only if \(x < \frac{l}{2}\sin \theta\).
\[ \small{ \begin{aligned} &\text{P}(\text{intersect}) \\ &= \text{P}(X < \frac{l}{2}\sin \Theta) \\ &=\iint \limits_{x < \frac{l}{2}\sin \theta} f_{X, \Theta}(x, \theta)dx d\theta \\ &=\iint \limits_{x < \frac{l}{2}\sin \theta} \frac{4}{\pi d}dx d\theta \\ &=\frac{4}{\pi d}\int _0^{\pi/2} \int _0^{\frac{l}{2}\sin \theta} dx d\theta \\ \end{aligned} } \]
\[ \small{ \begin{aligned} &=\frac{4}{\pi d}\int _0^{\pi/2} \frac{l}{2}\sin \theta \; d\theta \\ &=\frac{2l}{\pi d}\int _0^{\pi/2}\sin \theta \; d\theta \\ &=\frac{2l}{\pi d} (-\cos \theta) \bigg |_0^{\pi/2} \\ &=\frac{2l}{\pi d} (0-(-1)) \\ &=\frac{2l}{\pi d} \\ \end{aligned} } \]
To simplify, let \(l=d/2\).
\[ \text{P}(\text{intersect})=\frac{2l}{\pi d}=\frac{2(d/2)}{\pi d}=\frac{1}{\pi} \]
\[ \text{P}(\text{intersect})\approx \frac{\text{# of intersections}}{\text{# of needles}} \]
\[ \pi \approx \frac{\text{# of needles}}{\text{# of intersections}} \]
\[ \pi \approx \frac{\text{# of needles}}{\text{# of intersections}} \]
