# Deriving the MGF for Y= Z^2

1. Jun 15, 2012

### trap101

So I'm having problems being able to derive the MGF for Y = Z^2 where Z ~ N(0,1).

I was able to obtain the density function: [y-1/2 / (2pi)1/2] e-y/2

now to get the MGF of this I know I have to integrate from -∞ to ∞:

[y-1/2 / (2pi)1/2] e-y/2 etY

this is where my issue is, I'm having problems trying to simplify this to be able to get my MGF. Maybe I'm using the same variable in two different places and that's confusing me?

2. Jun 15, 2012

### algebrat

Did you use a theorem to get the density? Does your function satisfy all the hypotheses to apply that theorem? You may have to fall back to how they derive that expression, using the cumulative distribution function, then taking the derivative.

3. Jun 15, 2012

### trap101

I used the cumulative distribution function to obtain the density for Y, which ended up being my result above minus the e^tY portion. The density function is correct I know that. It's getting the integral for the MGF in the right form that's messing me up. I know the relation ship of Z = [(y-μ)/σ] and I was thinking of re arranging that relationship, but since the standard normal parameters are being used that reduces to Z = y, and since I have Z^2 ==> Y = Z^2 = y^2, but I think I may be using the variable "y" in two places having two different meanings.

4. Jun 15, 2012

### Ken G

Since no mu or sigma appears anywhere in your problem, I don't think that expression for Z, involving y, is relevant to what you are doing. And if y=Z, then there's no need to distinguish those variables, just use Z. So the question is, in your expression, is y=Z, or is y=Y? I suspect the latter-- the probability distribution over Z is already known, it's just the constant 1 and is independent of Z. So you must have solved for the probability distribution over Y, not over y, where Y = Z^2. So it looks to me like you want to set y=Y in your expression for the MGF, and then integrate over all Y.

5. Jun 15, 2012

### Ray Vickson

Why would you want to integrate y from -∞ to ∞? Can you name a real x that gives you y = x2 < 0?

Anyway, you can find the MGF of Y without finding the density of Y: just use the definition of MGF and the "theorem of the unconscious statistician".

RGV

6. Jun 15, 2012

### trap101

I believe that's what I did. I've gotten a little confused with my notation: So to be clear: fY(y) would be the probability density function over Y which I solved for and I was given fX(x) which is the pdf over X?

If that's the case, I tried that initially and got the expression:

(2pi)-1/2(integral) [(y-1/2e-y/2+ty]

which doesn't provide me with anything to solve for a known density.

But doesn't the fact that all densities have to integrate to 1 play a fact in why you go from -∞ to ∞

I was suppose to try and derive it without that theorem first

Last edited: Jun 15, 2012
7. Jun 15, 2012

### Ray Vickson

Absolutely not. If you have a random variable that takes negative and positive values, then of course you need to integrate over a range that includes negative and positive values (perhaps from -∞ to +∞, but not necessarily so, since the range may be limited). However, for a non-negative random variable it is nonsense to integrate from -∞ to +∞ unless you declare the density to be zero for negative arguments---and what would be the point of that?

As far as I can see you have not used the really easy way, which is to use the theorem of the unconscious statistician. Did your instructor tell you that you are not allowed to use that result?

RGV

8. Jun 15, 2012

### trap101

Well I'm going through it in the order that it was presented, so for this specific section I am "not suppose" to have known about the "theorem". Plus personally I like to be able to know all the ways of coming to the correct conclusion. I think it would give me a more complete understanding, so I put myself thru the difficult tasks as such.

9. Jun 15, 2012

### Ray Vickson

OK. So you need to integrate exp(-y/2 + ty)/sqrt(y)/sqrt(2π). What would you get if t = 0? Can you see how to make the problem for t ≠ 0 look like the problem for t = 0?

RGV

10. Jun 15, 2012

### trap101

Ok I let t = 0 and when I did that it converted into a gamma density with parameters $\alpha$ = $\lambda$ = 1/2.

the only thing i see to make it look like the t = 0 case would be to factor out ety..........doesn't feel right though

11. Jun 15, 2012

### Ken G

Try a new variable x that makes the exponent look just like e-x. The new variable will have t embedded in it, but that's fine, t is just a number. So you end up doing more or less the same thing that you already did to get the Gamma function. However, since I didn't see you derive the probability density for y, I'm not sure the range of y-- I would have thought it was just 0 to 1, like Z2. If so, it won't be a Gamma function, but some kind of incomplete Gamma function.

12. Jun 16, 2012

### trap101

Ok I think I'm close...I let x = y/2 - ty ==> 2dx/(1-2t) and as well y = 2x/(1-2t)

Now putting these all in I have:

2/(2pi)1/2(1-2t)1/2 (integral) e-x/(2x)1/2

it looks almost like the normal density except for the "x" in the root and a 2 under the "x" in the exponent.

13. Jun 16, 2012

### Ray Vickson

You have already done that integral (except you called the dummy integration variable y instead of x). Remember when I asked you what you got when t=0?

RGV

14. Jun 16, 2012

### trap101

Yes and when I did that I got: 1/(2pi)1/2 (integral) y-1/2 e-y/2

and when I simplified some more I just got:

1/(pi)1/2 (1-2t)1/2 (integral) x-1/2 e-x

so no all I'm missing is a "2' in the denominator of the exponential to make it look like the case t=0

so I did some more fiddling around and just realized the fact that earlier had proven (pi)1/2 = $\Gamma$(1/2) bring that together with what I have and then:

1/ (1-2t)1/2 (integral) {x-1/2 e-x}/$\Gamma$(1/2) with $\lambda$ =1 and $\alpha$ = 1/2 would mean that the integral integrates to 1.

and i'm left with: 1/ (1-2t)1/2 but I checked on wiki and it said the MGF for the chi-squared which is what this is, is:

(1-2t)-k/2 which is very similar...

Last edited: Jun 16, 2012
15. Jun 17, 2012

### Ray Vickson

I should be similar: $\text{for } X \sim \text{N}(0,1), \;X^2 \sim \chi^2(1).$

RGV

16. Jun 17, 2012

### trap101

Ok, but why don't I have a variable of k in my solution for the Chi?

Thanks for the patience and help

17. Jun 17, 2012

You do: k=1.

RGV