moment generating function question

27 Views Asked by At

I have an assigment that I need to submit, but I having trouble with one of the questions. We just started to learn about moment-generating function and we got this question:

You flipp a fair coin until you get an H n times(not necessarily in a row). X is the number of times we flipped the coin. What is the moment generating function of X?

I wrote Xi as the number of times we flipped the coin until we got H for the i time. So Xi distribute Geo(1/2). Now X = X1+...+Xn . While this is a sum of independent variables. So Mx(t) = Mx1+..+xn(t) = Mx1(t)+..+Mxn(t) (because they are independent). Mxi(t) distribute Geo(1/2) so Mxi(t) = (1/2)/1-(1-1/2)*e^t = (1/2)/1-(e^t/2). So Mx(t) = ((1/2)/1-(e^t/2))^n . But the offical answer from the university is: ((e^t/2)/1-(e^t/2))^n . Then why is my answer wrong?

Thank you!