Expectation value of a function of a random variable with known properties Disclaimer: I am not well versed in probability theory, so I apologize off the bat if I'm missing some terminology. I also could have missed another post about this due to my lack of knowledge.
Setup: Consider a disk of radius R, and a point p a fixed distance d above the center of the disk. If I take a uniformly distributed sampling of points within the disk, X, I am interested in the PDF and expectation value of the angle created between the radial vector to X, and from X to p, let's call the angle $\theta$.
Image of setup.
So far: I have found the PDF and expectation value of the radius of X
$$ P_r[X]=\frac{2r}{R^2},\, E_r[X]=\frac{2}{3}R $$
Because the map from $r$ to $\theta$ is injective, $\tan(\theta)=d/r$, the probability of getting an angle, $\theta_0$, should be the same as the probability of the distance, $r_0$, associated to it.
$$P_\theta[\Theta] = P_r[X(\theta)]$$
with $\theta \in \Theta$. This then gives
$$P_\theta[\Theta] = \frac{2r(\theta)}{R^2} = \frac{2d}{R^2 \tan(\theta)}$$
Using $r(\theta)=d\tan(\theta)$.
Now, to find the expectation value of $\Theta$, we take
$$E_\theta[\Theta]=\int_0^{\theta_c} \theta P_\theta[\Theta] = \int_0^{\theta_c} \theta\frac{2d}{R^2 \tan(\theta)} d\theta = \frac{2d}{R^2} \int_0^{\theta_c} \frac{\theta}{\tan(\theta)}d\theta$$
Where $\theta_c$ is the lower bound of $\theta$ due to the finite radius of the disk, $\tan(\theta_c)=d/R$. I couldn't figure out how to do this integral, so I turned to WolframAlpha. The given result is a complicated, complex function involving the polyalgorithm function. 
I created a Monte Carlo simulation to help validate my results. The results related to $P_r$ agree with my calculations, and the results for the angle agree with what I expected intuitively (i.e. A high probability of a small angle, with a tangent-like decrease towards $\theta = \pi/2$).
Monte Carlo simulation results with R=d=1 for 10,000 sample points. Bottom-left: Radial distribution of samples. Bottom-right: Angular distribution of samples.
Issues: 


*

*Evaluating to see if $P_\theta[\Theta]$ is valid by integrating from $\theta_c$ to $\pi/2$ and expecting to get 1
\begin{align}
\int_{\theta_c}^{\pi/2} \frac{2d}{R^2 \tan(\theta)}d\theta &= \frac{2d}{R^2} \int_{\theta_c}^{\pi/2} \frac{d\theta}{\tan(\theta)} \\
&= \frac{2d}{R^2} \Big[\log(\sin(\theta))\Big]_{\theta_c}^{\pi/2} \\
&= \frac{2d}{R^2}\Big[log(1)-\log(\sin(\theta_c))\Big] \\
&= -\frac{2d}{R^2} \log\Big(\frac{d}{R^2+d^2}\Big)
\end{align}
Which does not appear to be 1, meaning $P_\theta$ is not a valid PDF.

*$E[\Theta]$ seems like it should be a simple, real-valued function, which it isn't.
Thoughts: It seems like there should be a way to use the information I know about $P_r$, and $E_r$ to find simple expression for $P_\theta$ and $E_\theta$ given $r(\theta) = d/\tan(\theta)$, but I haven't figured out how to do it.
Thanks!
 A: When calculating the density of a function of a random variable, you can't just plug in the inverse function into the density. You forgot to consider the functional determinant, see here.
In this case, the complicated formula is not necessary. Note that for $0 \le x \le R$ we have
$$P(r \le x) = \int_0^x \frac{2r}{R^2} \, dr = \frac{x^2}{R^2}$$
This yields the following CDF for the angle $\theta$:
$$P(\theta \le x) = P(\arctan(\tfrac{d}{r}) \le x) = P(d/\tan(x) \le r) = 1 - \frac{d^2}{\tan^2(x) R^2}$$
for $\arctan\big(\tfrac{d}{R}\big) \le x < \frac{\pi}{2}$.
Note that for $x \ge \frac{\pi}{2}$ the CDF has a value of $1$, while it has a value of $0$ for $x < \arctan\big(\tfrac{d}{R}\big)$. You can now determine the PDF of $\theta$ by differentiating the CDF.
If you are mainly interested in the moments, you don't need to calculate the PDF. If $X$ is a nonnegative random variable, the following formula lets you calculate an arbitrary $p$-th moment for $p > 0$:
$$E[X^p] = E\Big[\int_0^\infty I\{X > x\} px^{p - 1} \, dx\Big] = p\int_0^\infty x^{p - 1} E[I\{X > x\}] \, dx = p \int_0^\infty x^{p - 1} P(X > x) \, dx$$
For example, the expectation of $\theta$ is
$$E[\theta] = \int_0^\infty P(\theta > x) \, dx = \int_0^\infty 1 - P(\theta \le x) \, dx = \int \limits_0^{\arctan\big(\tfrac{d}{R}\big)} 1 + \int \limits_{\arctan\big(\tfrac{d}{R}\big)}^{\pi/2} \frac{d^2}{R^2 \tan^2(x)} \, dx \\
= \arctan\big(\tfrac{d}{R}\big) + \frac{d^2}{R^2} \left(\frac{R}{d} + \arctan\big(\tfrac{d}{R}\big) - \frac{\pi}{2}\right)$$
(See Wolfram alpha).
