# How to Transform a Folded Normal Distribution into a Gamma Distribution?

Let the random variable $X$ have the folded Normal pdf

$$f(x)=\frac{2}{\sqrt{2\pi}}e^{\frac{-x^2}{2}}$$

with $0\lt x \lt \infty$.

What is the transformation $g(X)=Y$ and values of $\alpha$ and $\beta$ so that $Y \sim \Gamma(\alpha,\beta)$?

I am trying to do some extra problems in my book and just having a bit of a difficult time even getting started, so any hints would be helpful.

When thinking about PDFs,

1. Focus on the form of the function by ignoring additive and multiplicative constants.

2. Always, always, include the differential element.

For example, a generic Normal PDF is of the form

$$f(x;\mu, \sigma) = \frac{1}{\sqrt{2\pi \sigma^2}}\exp\left(-\frac{1}{2} \left(\frac{x-\mu}{\sigma}\right)^2\right)$$

Following (1), strip this down to $\exp(-x^2)$ and following (2), multiply by $dx$, giving

$$f(x) = \exp(-x^2)dx.$$

Consider now the generic Gamma PDF

$$g(y; \alpha, \beta) = \frac{1}{\beta\,\Gamma(\alpha)} \left(\frac{y}{\beta}\right)^{\alpha-1}\exp(-y/\beta).$$

Following the same two rules to focus on the essential part of the PDF produces

$$g(y) = y^{\alpha-1}\exp(-y)dy.$$

Notice that the constant $\alpha-1$ stayed because it is neither added to nor multiplies the variable $y$ itself: it is a power. We are going to have to figure out what the possible values of $\alpha$ could be.

Compare $f$ to $g$ and ask,

What should $y = y(x)$ be in order to make the two PDFs look more alike?

The only thing that is obviously common to the two forms is the exponential. Ignoring everything else, compare the two exponential parts of $f$ and $g$:

$$\exp(-x^2)\text{ versus }\exp(-y).$$

To convert one into the other, our only choice is

$$y = x^2.$$

Here is where (2) comes in: when you substitute $x^2$ for $y$ in $g$, make sure to include the differential element. Let’s do that step first:

$$dy = d(x^2) = 2 x dx.$$

The last step differentiates $x^2$ (which is all that “$d$” asks us to do). Therefore

$$g(y)\vert_{y \to x^2} = (x^2)^{\alpha-1} \exp(-x^2) (2 x dx) = 2 x^{2\alpha-1}\exp(-x^2) dx.$$

Once again, drop any multiplicative or additive constants and compare:

$$x^{2\alpha-1}\exp(-x^2) dx = g(y) \text{ versus } f(x) = \exp(-x^2)dx.$$

We have accomplished what we intended: $\exp(-x^2)$ is common to both expressions. Although they still look different insofar as the left hand side still has an extra factor of $x^{2\alpha-1}$, they actually will be the same provided

$$x^{2\alpha-1} = \text{ constant }.$$

This uniquely determines $\alpha=1/2$. Although all these calculations were performed to transform a Normal distribution to a Gamma distribution, in review you can see that they work for the folded Normal, which has exactly the same form as the Normal PDF. Now you know which Gamma distribution to use. The rest is a matter of working out the value of $\beta$, which I leave to the interested reader.