# Conditional Expectation in a uniform distribution

Q:Pick a point $(X, Y )$ inside the unit square $[0, 1]^2$ uniformly at random. Let $Z = X^2+Y^2$ What is $E[X|Z]$?

A: I believe i get the answer to be $E[X|X^2] +1/2$, but i don't know how to calculate $E[X|X^2].$

Any help?

Step 1: find the CDF of $X|Z$: for any $t\in[0,\sqrt{Z}]$ we have that $$P(X\leq t|Z) = P(Y^2\geq Z-t^2) = P(Y\geq \sqrt{Z-t^2}) = 1-\sqrt{Z-t^2}.$$
Step 2: find the PDF of $X|Z$: differentiating $P(X\leq t|Z)$ with respect to $t$ we have that $$p(x|Z) = \frac{\partial}{\partial t}\left(1-\sqrt{Z-t^2}\right) = \frac{t}{\sqrt{Z-t^2}}.$$
Step 3: find the expectation of $X|Z$ by integrating the PDF: $$\mathbb E[X|Z] = \int_0^{\sqrt{Z}}xp(x|Z)dx = \int_0^{\sqrt{Z}}\frac{x^2}{\sqrt{Z-x^2}}dx = \frac{1}{2}\left(Z\arctan\left(\frac{x}{\sqrt{Z-x^2}}\right)-x\sqrt{Z-x^2}\right)\bigg|_0^{\sqrt{Z}} = \frac{\pi}{4}\cdot Z.$$