# Creating a mixed moment generating function from a Bernoulli random variable and a Uniform random variable

If a random variable X assumes the value of a Bernoulli(1/3) random variable with a probability of 1/4, and assumes the value of a Uniform(0,1) random variable with a probability of 3/4, how does one obtain a moment generating function of X?

I'm fuzzy on how exactly mixed distributions work, and I'm not sure that term even applies here, however I came across this problem and thought it to be like no other.

In any case, I believe the moment generating function for the uniform part of this variable would be ((e^t)-1)/t. And the Bernoulli mgf would be 2/3+(1/3)(e^t).

Given that the Bernoulli variable occurs with probability 3/4 and the Uniform variable with probability 1/4, how does one combine these into one cohesive mgf? Have I simply forgotten a formula?

The moment generating function is an expectation value. Particularly, it's $E(e^{tX}),$ so the question is how to take this expectation value when $X$ is a mixture of two distributions.
But you can think of a mixture as an initial coinflip which determines which conditional distribution the variable comes from. So by total probability we have $$E(e^{tX}) = E(e^{tX}|Bernoulli)P(Bernoulli) + E(e^{tX}|Uniform)P(Uniform).$$