Problem: A table is ruled by equidistant parallel lines, 1 inch apart. A needle of length 1 inch is tossed at random on the table. What is the probability that it intersects a line?
Let's describe the distance from the needle-center to the nearest line by $D$ and the smallest angle between the needle and and that line by $A$ Drawing a figure leads to the conclusion that the needle intersects a line iff $D/\sin{A}\le 1/2.$
The "at random part" is a hint that the random variables $D\sim\text{unif}[0,1/2]$ and $A\sim\text{unif}[0,\pi/2]$ are independent.
Now my book states a corollary:
$$P((X,Y)\in B)=\int_{-\infty}^{\infty}P((x,Y)\in B)f_X(x) \ \text{d}x. \tag{1}$$
I wan't to compute $P\left(D/\sin{A}\le 1/2\right)$ using (1). But the problem is that I don't understand the corollary. What is $B$ in my case? And what is $P((x,Y)\in B)$?
I do understand that they fix $X=x$, and I can do the same by $A=a$ and write the following
$$P\left(\frac{D}{\sin{A}}\le \frac{1}{2}\right)=\int_{-\infty}^\infty P\left(\frac{D}{\sin{a}}\le \frac{1}{2}\right)f_A(a)\ \text{d}a.$$
With the knowledge that $f_A(a)=1/(\pi/2)=2/\pi$, $f_D(d)=2$ and
$$P\left(\frac{D}{\sin{a}}\le \frac{1}{2}\right)=P\left(D\le\frac{\sin{a}}{2}\right)=\int_0^{\sin{a}/2}2\ \text{d}d=\sin{a},$$
I finally obtain
$$P\left(\frac{D}{\sin{A}}\le \frac{1}{2}\right)=\frac{2}{\pi}\int_{0}^{\pi/2}\sin{a}\ \text{d}a=\frac{2}{\pi.}$$
Correct answer but I still don't really know what I'm doing here with the corrollary. My questions are in bold above.
Short answer:
Long answer:
To understand and appreciate everything in this question, we need to actually understand what P(A) means, what a random variable is, and the shorthand notation that we use.
Formally, you have some underlying outcome space, let's call it $\Omega$. (Think of a dice roll: your outcome set could be represented as $\{1, 2, 3, 4, 5, 6\})$. Now, $\Omega$ has subsets of outcomes that you can observe. (For instance, you can check whether the outcome is even or not. So, an event $A$ may be $A = \{2,4,6\}$.). So, when we write P(A), we are effectively measuring the size of a set. P(A) takes in a set (A) and returns a number between 0 and 1 to indicate the size (or the probability) of it.
Now, random variables are essentially functions that give (real) values to your outcomes. So, a natural random variable for dice rolls would be an "identity random variable" I such that when it takes an input $\omega \in \Omega$, it returns its value: $I(\omega) = \omega$. (here, since our inputs were real numbers to begin with, this mapping is OK). Another set of popular random variables is indicator random variables; these return 0 or 1 depending on some property of $\omega$. (For instance, for dice roll setting, you can have a random variable $E(\omega)$ that returns 1 if $\omega \in \{2,4,6\}$, and 0 otherwise. This random variable "indicates" whether $\omega$ was even or not).
Now, we always use a shorthand notation: $P(E = 1)$ itself would not mean anything; $E$ is a function and $1$ is a number, so "$E = 1$" is just a logical expression, that is true for some inputs, and false for some: it is not a set. We use this notation to indicate $P(\{\omega : E(\omega) = 1\})$, which is indeed well defined as above.
Now, let's go to your question: