Let $X_1 = U(0,1)$ and $X_2 = U(0,1)$. $X_1$ and $X_2$ are independent. Then $f(x_{1}, x_{2})=1, {0}\le{x_1}\le{1}, {0}\le{x_2}\le{1}$.

Let $Y_1 = \arctan(X_{2}/X_{1})$, $Y_2 = X_2$. I need to find the density function $g(y_1)$.

Here's what I've done so far.

$X_{2}/X_{1} = \tan(Y_{1})$ $X_{1} = X_{2} / \tan(Y_{1}) = X_{2}\cot(Y_{1})$

Since $X_{2}=Y_{2}$, $X_{1}=Y_{2}\cot(Y_{1})$.

The Jacobian of the transformation is give by the matrix $J = \begin{bmatrix} \frac{\partial{y_2\cot(y_1)}}{\partial{y_1}} & \frac{\partial{y_2\cot(y_1)}}{\partial{y_2}} \\ \frac{\partial{y_2}}{y_1} & \frac{y_2}{y_2} \end{bmatrix} = \begin{bmatrix} -y_{2}\csc^{2}(y_{1}) & \cot(y_1) \\ 0 & 1 \end{bmatrix}$. So, $\det(J)= -y_{2}\csc^{2}(y_{1})$.

At this point, I am kinda lost. I know that I need to compute $g(y_1, y_2)$, find its domain, and then integrate with respect to $y_2$. I do not understand how to find the joint density $g(y_1, y_2)$, could you please help?

  • $\begingroup$ The change of variable formula indicates how to get from $f(x_1,x_2)$ to $g(y_1,y_2)$:$$g(y) = f\big(h^{-1}(y)\big) \left| \frac{d}{dy} \big(h^{-1}(y)\big) \right|$$ $\endgroup$
    – Xi'an
    Apr 4 at 6:54

2 Answers 2


Find the distribution function of $Y_1$ with a picture, then differentiate it.

Observe that because $(X_1,X_2)$ lies in the first quadrant and $Y_1$ is the angle subtended by this point, $0\le Y_1 \le \pi/2.$ Moreover, for any possible value $\theta$ in this interval, the event $Y_1 \le \theta$ is the region in the unit square bounded above by the line at angle $\theta,$ highlighted in this diagram:

enter image description here

Because $(X_1,X_2)$ is uniformly distributed on the unit square, the probability of any event equals its area.

Clearly when $0\le \theta\le \pi/4,$ where this event is a triangle, its area is half its height:

$$\Pr(Y_1 \le \theta) = \frac{1}{2}\tan\theta, \quad \theta \le \pi/4.$$

Its derivative is $\sec^2(\theta)/2.$

When $\pi/4\le\theta\le \pi/2,$ the event is the complement of a triangle, immediately giving

$$\Pr(Y_1 \le \theta) = 1 - \frac{1}{2}\cot\theta, \quad \pi/4 \le \theta \le \pi/2.$$

Its derivative is $\csc^2(\theta)/2 = \sec^2(\pi/2-\theta)/2.$

Combining these results into a common formula gives

$$g(\theta) = \frac{1}{2}\sec\left(\min\left(\theta, \frac{\pi}{2}-\theta\right)\right)^2,\quad 0\le\theta\le\frac{\pi}{2}.$$

Of course $g\equiv 0$ for all other arguments.

To illustrate $g,$ here is a histogram of a million realizations of $Y_1$ (computed with the R code n <- 1e6; y <- atan2(x2 <- runif(n), x1 <- runif(n))) over which the graph of $g$ is plotted in red.

enter image description here


The transformation from $(x_1,x_2)$ to $(y_1,y_2)$ is given by $h(x_1,x_2) = (h_1(x_1,x_2),h_2(x_1,x_2))^t = \left(\arctan(\frac{x_2}{x_1}), x_2\right)^t$. The jacobian matrix $J(x_1,x_2)$ is given by:

$$ J(x_1,x_2) = \begin{bmatrix} \frac{\partial h_1}{\partial x_1} & \frac{\partial h_1}{\partial x_2} \\ \frac{\partial h_2}{\partial x_1} & \frac{\partial h_1}{\partial x_2} \end{bmatrix} = \begin{bmatrix} \frac{-x_2}{x_1^2 + x_2^2} & \frac{x_1}{x_1^2 + x_2^2} \\ 0 & 1 \end{bmatrix}, $$

with the absolute value of the determinant $|J(x_1,x_2)| = \frac{x_2}{x_1^2 + x_2^2}$.

As mentioned by Xi'an in the comments, you can find the density probability function $g(y_1,y_2)$ of $(Y_1,Y_2)$ with the following formula: $$ g(y_1,y_2) = \frac{f(x_1,x_2)}{|J(x_1,x_2)|}|_{(x_1,x_2) = h^{-1}(y_1,y_2)} = \frac{x_1^2 + x_2^2}{x_2}|_{(x_1,x_2) = h^{-1}(y_1,y_2)}, $$

$$ = \frac{y_2^2\cot(y_1)^2 + y_2^2}{y_2} = y_2(\cot(y_1)^2 + 1), $$

where $f(x_1,x_2)$ is the probability density function of $(X_1,X_2)$. Note that this works only for bijective transformations (mapping) $h(x_1,x_2)$.

  • $\begingroup$ To find the marginal of $Y_1,$ then, you would integrate out $y_2$ in $g,$ giving $(\cot(y_1)^2+1)/2.$ Clearly that's not correct for $y_1 \le \pi/4:$ it blows up near $y_1=0.$ For $\pi/2\le y_1\le \pi/2$ it can also be expressed as $\sec(\pi/2-y_1)^2/2,$ which is correct. $\endgroup$
    – whuber
    Apr 4 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.