# Finding the joint pdf using the Jacobian

Say I have two signals one which has the form $$X(t) = cos(100t + \Theta)$$ where $$\Theta$$ is a R.V. uniformly distributed between $$0$$ and $$2\pi$$ and another which has the form $$Y(t) = cos(100t + \Psi)$$ where $$\Psi$$ is uniformly distributed between $$0$$ and $$2\pi$$ as well as independent to $$\Theta$$. Given the sum of the two signals, $$Z(t) = X(t)+Y(t)$$ can be expressed as $$Z(t) = A cos(100t + \phi)$$

Find the joint pdf of magnitude and phase $$A$$ and $$\phi$$?

My attempt:

I use the sum to product trig identity to get $$A = 2 cos(\frac{\Theta - \Psi}{2})$$ $$\phi = \frac{\Theta - \Psi}{2}$$

I compute the Jacobian and get $$-sin(\frac{\Theta - \Psi}{2})$$. Trying to make everything in terms of $$A$$ and $$\phi$$ by finding the inverses: $$\Theta = cos^{-1}(\frac{A}{2}) + \phi$$ $$\Psi = -(\cos^{-1}(\frac{A}{2}) - \phi)$$ $$f_{A\phi}(a, \varphi) = \frac{f_{\Theta\Psi}(cos^{-1}(\frac{a}{2})+ \phi, \phi - cos^{-1}(\frac{a}{2}))}{|-sin(\frac{\Theta - \Psi}{2})|}$$

Because of independence (why? I get lost at this step) $$= \frac{(\frac{1}{2\pi})(\frac{1}{2\pi})}{|-sin(cos^{-1}(\frac{a}{2}))|}$$

And the bounds are

$$0 < cos^{-1}(\frac{a}{2}) + \phi < 2\pi$$

$$0 < \phi - cos^{-1}(\frac{a}{2}) < 2\pi$$

Besides being unclear in the last type of why/what independence rule is being applied there I think the answer is obviously wrong? As I should get $$\int_{-\infty}^{\infty} f_{A\phi}(a, \varphi) da = 1$$ but I get $$\int_{0}^{2\pi} f_{A\phi}(a, \varphi) da \approx 0.17135$$ which is not $$1$$ unless I am checking the joint pdf incorrectly?

I also want to find $$Pr(A \le \frac{1}{2}) = \int_{0}^{\frac{1}{2}} f_{A\phi}(a, \varphi) da \approx 0.012801$$ but that probability seems too small though I know intuition tends to be wrong with probability.

Any guidance or correction is appreciated.

The independence is between uniform random variables $$\Theta$$ and $$\Psi$$, as was given in the problem setup.

\begin{align}f_{\Theta,\Psi}(\theta,\psi) &= f_{\Theta}(\theta)~f_{\Psi}(\psi) \\ &=\dfrac{\mathbf 1_{0\leqslant\theta\lt2\pi}}{2\pi}\cdot\dfrac {\mathbf 1_{0\leqslant\psi\lt2\pi}}{2\pi}\end{align}

The bounds $$0\leqslant \phi+\arccos(a/2)\lt 2\pi$$ and $$0\leqslant \phi-\arccos(a/2)\lt 2\pi$$ translate to $$0\leqslant\phi\leqslant 2\pi$$ and $$-2\leqslant a\leq 2$$

So.

\begin{align}A\cos(\tau+\Phi)&=\cos(\tau +\Theta)+\cos(\tau+\Psi) &\qquad\text{let }\tau=100t&\\&= 2\cos((\Theta-\Psi)/2)~\cos(\tau+(\Theta+\Psi)/2) \\\begin{bmatrix}A\\\Phi\end{bmatrix}&=\begin{bmatrix}2\cos((\Theta-\Psi)/2)\\(\Theta+\Psi)/2\end{bmatrix}\\ \dfrac{\partial(A,\Phi)}{\partial(\Theta, \Psi)} &= \begin{bmatrix}-\sin((\Theta-\Psi)/2) & \sin((\Theta-\Psi)/2)\\ 1/2&1/2\end{bmatrix}\\\begin{Vmatrix}\dfrac{\partial(A,\Phi)}{\partial(\Theta, \Psi)} \end{Vmatrix}&=\lvert\sin((\Theta-\Psi)/2)\rvert\\\begin{Vmatrix}\dfrac{\partial(\Theta,\Psi)}{\partial(A, \Phi)} \end{Vmatrix}&=\dfrac{2}{\begin{vmatrix}\sqrt{4-A^2~}\end{vmatrix}}\\\Theta-\Psi &= 2\arccos(A/2)\\\Theta+\Psi&= 2\Phi\\\Theta&= \Phi+\arccos(A/2)\\\Psi&= \phi-\arccos(A/2)\\[2ex] f_{A,\Phi}(a,\phi) &=\dfrac{\mathbf 1_{0\leqslant\phi+\arccos(a/2)\lt2\pi}\mathbf 1_{0\leqslant\phi+\arccos(a/2)\lt2\pi}}{2\pi^2\sqrt{4-a^2}}\\ &=\dfrac{\mathbf 1_{0\leqslant\phi\lt2\pi}}{2\pi}\dfrac{\mathbf 1_{-2\leqslant a\lt 2}}{\pi\sqrt{4-a^2~}}\\ \iint_{\Bbb R^2} f_{A,\Phi}(a,\phi)\,\mathrm d (a,\phi) & = \int_0^{2\pi}\dfrac 1{2\pi}\,\mathrm d\phi~~\int_{-2}^2 \dfrac{1}{2\pi\sqrt{1-(a/2)^2}}\,\mathrm d a\\&= 1\\\mathsf P(A\leq 1/2) &= \int_{-2}^{1/2} \dfrac{1}{2\pi\sqrt{1-(a/2)^2}}\,\mathrm d a\\&= 1-\dfrac{\arccos(1/4)}{\pi}\\&\approx 0.58\end{align}