I'm trying to work out a practice problem but it seems like the way I'm doing it is so off track.

The goal is to find u'2 or the second moment generating function evaluated at t=0 for the random variable x with probability density

x/2 for 0<x<2

0 elsewhere

I started with 1/2*int(x*e^(tx),x, 0, 2)

(integrate x from 0 to 2) using the integration by parts I get this long integration of

.5[1/t*e^(tx)-1/t[1/te^(tx)]

Is the way I'm doing it even right up until this part? If it isn't how should I be doing it, and if it is, do I just take the derivative twice here with respect to t?

More generally, I think my question and confusion lies with this: If the probability density is given to be continuous like the one above but only from say 0 to 2 or 1 to infinity. Am I still integrating e^(tx)f(x) from 0 to infinity when I try to find the mgf? or am I only integrating from the defined 0 to 2 or 1 to infinity?

thanks a lot to anyone who can make this subject just a little simpler for me!