7: Let X be a discrete random variable with values in {0, 1, 2, . . ., n} and moment

generating function g(t). Find, in terms of g(t), the generating functions for ### (a) −X.

g <- function(t) {
  # I would Define the moment generating function g(t) here
  return(exp(t))
}

generating_function_a <- function(t) {
  g_negative_x <- g(-t)  
  return(g_negative_x)
}

(b) X + 1.

generating_function_b <- function(t) {
  g_x_plus_1 <- g(t) * exp(t)
  return(g_x_plus_1)
}

(c) 3X.

generating_function_c <- function(t) {
  g_3x <- g(3 * t) 
  return(g_3x)
}

(d) aX + b.

generating_function_d <- function(t, a, b) {
  g_ax_plus_b <- g(a * t) * exp(b * t) 
  return(g_ax_plus_b)
}