# Functions of Random Variables

Let $X$ be a discrete random variable with probability function $f_X$ . Find formulas for the probability function and the distribution function of $Y =(X − a)^2$, where $a$ is an arbitrary constant.

-
Is this homework? What have you tried? Where are you getting stuck? –  Matthew Conroy Apr 18 '12 at 4:07
Are you in touch with the other poster who is posting questions just like this one? Maybe the two of you should get together and have a chat. –  Gerry Myerson Apr 18 '12 at 4:08
–  Henry Apr 18 '12 at 11:32

We address both the case where the random variable has a discrete distribution, and the case where the random variable $X$ has continuous distribution, with density function $f(x)$. The continuous case seems to come up more often, so we deal with it first.
Let $Y=(X-a)^2$. We find an expression for $P(Y \le y)$. This is only interesting if $y \ge 0$. We have $Y>y$ iff $(X-a)^2>y$ iff $X>a+\sqrt{y}$ or $X<a-\sqrt{y}$. Thus the cumulative distribution function $F_Y(y)$ of $Y$ is given, for positive $y$, by $$F_Y(y)=1-\int_{-\infty}^{a-\sqrt{y}}f(x)\,dx -\int_{a+\sqrt{y}}^{\infty} f(x)\,dx.$$ Differentiate with respect to $y$ to find the density function $f_Y(y)$ of $Y$. For $y>0$ this is given by $$f_Y(y)=\frac{1}{2\sqrt{y}}\left(f(a-\sqrt{y})+f(a+\sqrt{y}\right).$$
In the general discrete case, for $y \ge 0$, we have $$P(Y=y)=P((X-a)^2=y)=P(X=a-\sqrt{y})+P(X=a+\sqrt{y}).\tag{\ast}$$ The required values in $(\ast)$ are then obtained from the probability distribution function of $X$. Let $f_X(x)=P(X=x)$. Then $P(Y=y)=f_X(a-\sqrt{y})+f_X(a+\sqrt{y})$. From this an expression for the cumulative distribution function $F_Y(y)$ can be written down. For $y \ge 0$ it is $$F_Y(y)=\sum_{x\le a+\sqrt{y}} f_X(x)-\sum_{x<a-\sqrt{y}} f_X(x).$$