# Generalization error of a simple perceptron for a student-teacher network

I have been asked to prove the following expression given the following density probability function for a student-teacher

$$P(x,y) = \frac{1}{2\pi\sqrt{Q-R^2}} \cdot \exp\left(-\frac{1}{2}\left(\frac{x^2 + Qy^2 - 2Rxy}{Q-R^2}\right)\right)$$

And I have to integrate this expresion over regions of x and y with different sign (disagreement) to get the generalization error and prove that it is equal to the right expression.

\begin{align} \epsilon_g &= \left(\int_0^\infty dx \int_{-\infty}^0 dy + \int_0^\infty dy \int_{-\infty}^0 dx\right)P(x,y)\\ &= \frac{1}{\pi}\arccos\left(\frac{R}{\sqrt{Q}}\right) \end{align}

I have done the following procedure:

Changing variables: \begin{align*} \hat{x} = x - Ry\\ \hat{y} = \sqrt{Q - R^2}y \end{align*}

substituting into the equation (1)

$$\begin{equation} P(\hat{x},\hat{y}) = \frac{1}{2\pi\sqrt{Q-R^2}}exp\left(\frac{-1}{2}\frac{\hat{x}^2 + \hat{y}^2}{Q-R^2}\right) \end{equation}$$

To the last expression we change it into polar coordinates

\begin{align*} r = \sqrt{\hat{x}^2 + \hat{y}^2}\\ \theta = \arctan(\frac{\hat{y}}{\hat{x}}), \end{align*}

we can rewrite the expression the generalization error as

$$\begin{equation} \epsilon_g = \int_0^\infty \frac{r}{\sqrt{Q-R^2}}dr\left(\int_{\frac{-\pi}{2}}^0 d\theta + \int_{\frac{\pi}{2}}^{\pi}d\theta\right)P(r,\theta), \end{equation}$$

where we have applied:

\begin{align*} \hat{x} &= x - Ry\;,\;\;\; d\hat{x} = dx,\\ \hat{y} &= \sqrt{Q - R^2}y\;,\;\;\;\; d\hat{y} = \frac{1}{\sqrt{Q-R^2}},\\ J &= \begin{vmatrix} \frac{\partial \hat{x}}{\partial r} & \frac{\partial \hat{x}}{\partial \theta} \\ \frac{\partial \hat{y}}{\partial r} & \frac{\partial \hat{y}}{\partial \theta} \end{vmatrix} = \begin{vmatrix} \cos(\theta) & -r\sin(\theta) \\ \sin(\theta) & r\cos(\theta) \end{vmatrix} = r. \end{align*}

If we integrate now $$P(r,\theta)$$ over the radial part we get

$$\begin{equation} \int_0^\infty \frac{1}{2\pi\sqrt{Q-R^2}}exp\left(\frac{-1}{2}\frac{\hat{x}^2 + \hat{y}^2}{Q-R^2}\right)dr \end{equation}$$

Making the following variable change:

\begin{align} u = -\frac{1}{2}\frac{r^2}{Q-R^2}\\ du = \frac{-r}{Q-R^2}, \end{align}

we get

$$\begin{equation} \frac{1}{2\pi} \int_{-\infty}^0 du e^u = \frac{1}{2\pi} \end{equation}$$

If we finish this by integrating the angular part:

$$\begin{equation} \int_{\frac{-\pi}{2}}^0 d\theta + \int_{\frac{\pi}{2}}^{\pi}d\theta = \frac{\pi}{2} + \frac{\pi}{2}. \end{equation}$$

With this expression is impossible to prove what I am asking to prove. Did I make any mistake? Could someone please help me to solve this?

Thanks a lot beforehand