Suppose $x$ has a discrete uniform distribution on $\{-n,-n+1,1,\ldots,-1,0,1,\ldots,n-1,n\}$. Find $E[x\mid x^2=k^2]$ for $k =0,1,2,...n$.
I have tried to identify the distribution of $x^2$ as I considered $y=x^2$ and then $x=\sqrt{y}$ then found out the Jacobian which is comes out to be $\frac{1}{2\sqrt{y}}$. Then I have written the pdf for y as $\frac{1}{2n\sqrt{y}}$ as $x$ is discrete uniform distribution. But distribution of y does not seems to be uniform discrete distribution. so I am not sure about the distribution of $y$ and not able to find out the joint pdf of $x$ and $x^2$ and hence not able to find out conditional mean.
Recall that for two events $A$, $C$ with $\mathbb P(C)>0$, the conditional probability of $A$ given $C$ is defined as $\mathbb P(A\mid C) = \frac{\mathbb P(A\cap C)}{\mathbb P(C)}$. Similarly, for any event $E\in\sigma(X)$ with positive probability, the conditional distribution of $X$ given $E$ is $$p_X(x\mid E) := \frac{\mathbb P(\{X=x\}\cap E)}{\mathbb P(E)}. $$ For $k\ne0$, we have $$\mathbb P(X^2=k^2) = \mathbb P(X=k)+\mathbb P(X=-k)=2\cdot\mathbb P(X=k)=\frac2{2n+1},$$ and for $k=0$ by similar logic we have $$\mathbb P(X^2=0) = \frac1{2n+1}. $$ It follows that the conditional expectation of $X$ given $\{X^2=k^2\}$ is given by \begin{align} \mathbb E[X\mid X^2=k^2] &= \sum_{\{x:x^2=k^2\}}x\cdot p_X(x\mid\{X^2=k^2\})\\ &= \frac{-k/(2n+1)}{2/(2n+1)} + 0 + \frac{k/(2n+1)}{2/(2n+1)}\\ &= 0. \end{align}