On distribution of angle $Z$ for a random triangle I've been thinking about this question: suppose I draw a random point uniformly from a triangle with vertices $(1,0)$, $(0,0)$ and $(0,1)$. Let $(X,Y)$ be the coordinate of the point and $Z$ ($0\leq Z\leq\frac{\pi}{4}$) be the angle pictured in this figure.$Z$" />
I am interested in finding the conditional density of $X|Z$, but I am not sure whether I am correct:
Finding the joint density of $X$ and $Y$ is straightforward, which is $f(x,y)=1/S_{\Delta}=2$, where $S_{\Delta}=1/2$ is the area of the triangle. The conditional density of $X|Y$ is $f(x|y)=2/(\int_y^1 2dx)=\frac{1}{1-y}$.The conditional expectation of $X|Y$ is $E[X|Y]=\int_y^1 x\frac{1}{1-y}dx=\frac{y+1}{2}$. To find the joint density of $X$ and $Z$, I'm thinking of using change of variables $(x,y)\mapsto(x,z)$ for the joint densities, where $\tan z=\frac{y}{x}$. I calculated the Jacobian, but it seems to messy for me. Are there any ways to find the joint density of $X$ and $Z$ as well as the marginal density for $Z$?
Another question I'm interested in is whether $p(x|Y=0)$ and $p(x|Z=0)$ are the same. Geometrically, they both mean the point lands on the $x$-axis. If they are different, what is the intuition behind this?
Thank you.
 A: Intuitively, we should expect that $X$ and $Z$ will be independent in this case, so the conditional distribution of $X|Z$ should be identical to the marginal distribution of $X$.  To confirm that this is the case, we can start with the joint density of the original coordinates, which is:
$$f_{X,Y}(x,y) = 2 \cdot \mathbb{I}(0 \leqslant y \leqslant x \leqslant 1).$$
Using the transformation $y = x \tan z$ we then get the joint density:$^\dagger$
$$\begin{align}
f_{X,Z}(x,z)
&= f_{X,Y}(x,y) \bigg| \frac{dy}{dz} \bigg| \\[6pt]
&= 2 \cdot \mathbb{I}(0 \leqslant y \leqslant x \leqslant 1) \bigg| \frac{dy}{dz} \bigg| \\[6pt]
&= 2 \cdot \mathbb{I}(0 \leqslant x \tan z \leqslant x \leqslant 1) \bigg| \frac{d}{dz} x \tan z \bigg| \\[6pt]
&= 2 \cdot \mathbb{I} \Big( 0 \leqslant x \leqslant 1, 0 \leqslant z \leqslant \frac{\pi}{4} \Big) \bigg| \frac{x}{\cos^2 z} \bigg| \\[6pt]
&= \frac{2x}{\cos^2 z} \cdot \mathbb{I} \Big( 0 \leqslant x \leqslant 1, 0 \leqslant z \leqslant \frac{\pi}{4} \Big). \\[6pt]
\end{align}$$
Since all the terms in this joint density are separable, this confirms that $X$ and $Z$ are independent with marginal densities:
$$f_{X}(x) = 2x \cdot \mathbb{I}(0 \leqslant x \leqslant 1)
\quad \quad \quad \quad \quad 
f_{Z}(z) = \frac{1}{\cos^2 z} \cdot \mathbb{I} \Big( 0 \leqslant z \leqslant \frac{\pi}{4} \Big).$$
Since these random variables are independent, we have $f_{X|Z}(x|z) = 2x \cdot \mathbb{I}(0 \leqslant x \leqslant 1)$.  The conditional density $f_{X|Z}(x|0)$ will not be equal to the conditional density $f_{X|Y}(x|0)$ in this problem (the latter is a point-mass distribution on zero).

$^\dagger$ For this transformation I have simplified things by using the one-dimensional Jacobian for the mapping $y \mapsto z$.  If you instead use the two-dimensional Jacobian for the mapping $(x,y) \mapsto (x,z)$ you get the same result:
$$\begin{align}
\Bigg| \frac{\partial (x,y)}{\partial (x,z)} \Bigg| 
&= \det \begin{bmatrix} 1 & \tan z \\ 0 & \frac{x}{\cos^2 z} \end{bmatrix} \\[6pt]
&= 1 \times \frac{x}{\cos^2 z} - 0 \times \tan z \\[6pt]
&= \frac{x}{\cos^2 z}. \\[6pt]
\end{align}$$
