Let X be a random variable with values that range within [0, 2] with pdf p(x) =…