Buffons needle crossing both lines? Buffon's Needle Problem : Given a needle of length $l$ dropped on a plane ruled with parallel lines $t$ units apart, what is the probability that the needle will cross a line?

I am working out problems with  Buffon's needle in varying lengths.  Case A: Given a needle of length $7$, and lines spaced $4$ units apart, what is the probability that the needle crosses both the lines when dropped?  Case B: What if the needle of length $h$ and distance between lines $L$ was $2L < h <= 3L$, what is the probability of the needle crossing all three lines ?
Give the general formula of probability for both cases. Any help would be greatly appreciated.
 A: I'll use the variable names in your first sentence: $l$ is the needle length, and $t$ is the gap between lines.
Also, let random variables $\theta$ be the angle from the "positive $x$-axis" to the needle and $Y$ be the distance from the leftmost endpoint of the needle to the closest line to the left of that endpoint.

By symmetry of the needle either "pointing up" or "pointing down", we can assume $\theta$ is not negative. So we have $0\lt\theta\leq \pi/2\;$ and $0\lt Y\leq t$.
These two r.v.'s are independent and uniformly distributed. So their joint density function is $f_{\theta,Y}(\theta,y) = \dfrac{2}{\pi t}$.
(a) Here we assume $t\leq l\leq 2t$. Define event $C = $ "Needle crosses two lines". Event $C$ is only possible in the range $0\lt\theta\lt\cos^{-1}(t/l)$. For any $\theta$ in this range, $C$ occurs exactly when $2t-l\cos\theta\lt Y\lt t$. Therefore,
\begin{eqnarray*}
P(C) &=& \int_{\theta=0}^{\cos^{-1}(t/l)} \int_{y=2t-l\cos\theta}^{t} f_{\theta,Y}(\theta,y) \;dy\;d\theta \\
&=& \dfrac{2}{\pi t}\int_{0}^{\cos^{-1}(t/l)} (l\cos\theta - t) \;d\theta \\
&=& \dfrac{2}{\pi t} \bigg[l\sin\theta - t\theta\bigg]_{0}^{\cos^{-1}(t/l)} \\
&=& \dfrac{2}{\pi t} \left[\sqrt{l^2-t^2} - t\cos^{-1}(t/l)\right]. \\
\end{eqnarray*}
$$\\$$
(b) Similar working to above but here the assumption is that $2t\leq l\leq 3t$. Define event $C = $ "Needle crosses three lines". Event $C$ is only possible in the range $0\lt\theta\lt\cos^{-1}(2t/l)$. For any $\theta$ in this range, $C$ occurs exactly when $3t-l\cos\theta\lt Y\lt t$. Therefore,
\begin{eqnarray*}
P(C) &=& \int_{\theta=0}^{\cos^{-1}(2t/l)} \int_{y=3t-l\cos\theta}^{t} f_{\theta,Y}(\theta,y) \;dy\;d\theta \\
&=& \dfrac{2}{\pi t}\int_{0}^{\cos^{-1}(2t/l)} (l\cos\theta - 2t) \;d\theta \\
&=& \dfrac{2}{\pi t} \bigg[l\sin\theta - 2t\theta\bigg]_{0}^{\cos^{-1}(2t/l)} \\
&=& \dfrac{2}{\pi t} \left[\sqrt{l^2-4t^2} - 2t\cos^{-1}(2t/l)\right]. \\
\end{eqnarray*}
