If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Expected value of a binomial variable

AP.STATS:
UNC‑3 (EU)
,
UNC‑3.C (LO)
,
UNC‑3.C.1 (EK)
Deriving and using the expected value (mean) formula for binomial random variables.

Want to join the conversation?

  • blobby green style avatar for user JorgeMercedes
    X = Y1 + Y2 + Y3 ...+Yn. How are they equivalent?
    Edit: i think i see it now. Sal should have defined Y properly. Y: # of successes in 1 trial. Since X is defined as '# of success in 10 trails', then X = Y1 + Y2 + Y3+....+Y10. I think Sal should slow down a bit here, and properly define what is Y.
    E(Y) would then be: expected # of successes in 1 trail, which is =[P(0)x0+P(1)x1], and given that P(1) is 0.3 in the example, E(Y) will be [0.7x0+0.3x1], which is =0.3, which is =P(1).
    (45 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user alphadirect99
    Notice that X is a binomial variable, whereas Y is a bernoulli variable, the simplest case of a binomial variable.
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Andrea Menozzi
    where is explained the sum of independent variables? E(X+Y) does not makes sense to me
    (2 votes)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      Let
      𝑋 = {𝑥₁, 𝑥₂, 𝑥₃}
      𝑌 = {𝑦₁, 𝑦₂}

      Thereby,
      𝐸(𝑋) = (𝑥₁ + 𝑥₂ + 𝑥₃)∕3
      𝐸(𝑌) = (𝑦₁ + 𝑦₂)∕2

      Also,
      𝑋 + 𝑌 = {𝑥₁ + 𝑦₁, 𝑥₂ + 𝑦₁, 𝑥₃ + 𝑦₁, 𝑥₁ + 𝑦₂, 𝑥₂ + 𝑦₂, 𝑥₃ + 𝑦₂}

      This gives us,
      𝐸(𝑋 + 𝑌) = (𝑥₁ + 𝑦₁ + 𝑥₂ + 𝑦₁ + 𝑥₃ + 𝑦₁ + 𝑥₁ + 𝑦₂ + 𝑥₂ + 𝑦₂ + 𝑥₃ + 𝑦₂)∕6
      = (2𝑥₁ + 2𝑥₂ + 2𝑥₃ + 3𝑦₁ + 3𝑦₂)∕6
      = (𝑥₁ + 𝑥₂ + 𝑥₃)∕3 + (𝑦₁ + 𝑦₂)∕2
      = 𝐸(𝑋) + 𝐸(𝑌)

      This example can quite easily be generalized to where 𝑋 has 𝑚 elements and 𝑌 has 𝑛 elements.
      (6 votes)
  • blobby green style avatar for user bsoni1660
    Why is X taken as a sum of Y's?
    (4 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Tobey
    As the mean/expected value of a Bernoulli distribution is p and the mean/expected value of a binomial variable is np, is a binomial variable a multiple of a Bernoulli distribution?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Rowain Hardby
    What is the expected value of a variable like:
    "Flip a fair coin until you get tails. X = the number of heads you flipped."
    I realize this wouldn't be a binomial variable, but it seemed pretty similar.

    Note: P(H) = P(T) = 0.5
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user glorioussekao
    Let X~Bin(n,p),find E(e^(tx) where t is a constant
    (2 votes)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      Nice question! The plan is to use the definition of expected value, use the formula for the binomial distribution, and set up to use the binomial theorem in algebra in the final step.

      We have
      E(e^(tx))
      = sum over all possible k of P(X=k)e^(tk)
      = sum k from 0 to n of p^k (1-p)^(n-k) (n choose k) e^(tk)
      = sum k from 0 to n of (pe^t)^k (1-p)^(n-k) (n choose k)
      = (pe^t + 1 - p)^n, from the binomial theorem in algebra.
      (2 votes)
  • aqualine ultimate style avatar for user Larissa Ford
    The thing I get caught up on is the Expected value of Y at . Could someone give me a link to the logic behind E(Y)=p? Specifically, when he talked about the probability of weighted outcomes?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • primosaur ultimate style avatar for user Romulo
      It comes from the definition of expected value of a random variable Y: E[Y] = 0*p(Y=0) + 1*p(Y=1) + .. + n*p(Y=n). As defined by Sal in this example, the random variabla Y only takes the values Y=0 and Y=1. Moreover, we have that p(Y=1) = p and p(Y=0) = 1-p. This leads to E[Y] = p.
      (3 votes)
  • blobby green style avatar for user N N
    Why is Y=0 or Y=1?
    If Y is not either 0 or 1, what kind of formula should we use?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      In this case we want 𝑌 to represent whether a trial is a success or not.
      So it needs to have two outcomes – one for "Success" and one for "Not Success".

      The reason we choose the outcomes to be either 0 or 1 is because it allows us to easily count the number of successes after 𝑛 trials:
      𝑌₁ + 𝑌₂ + 𝑌₃ + ... + 𝑌ₙ

      – – –

      The way we define a variable depends on what we want it to represent.

      For example, if you and friend were competing in a game you might want to keep track of who has won more often after 𝑛 rounds.

      Then we might want to define 𝑌 = −1 if you lose a round, 𝑌 = 0 if a round ends in a draw, and 𝑌 = 1 if you win a round.

      If the sum 𝑌₁ + 𝑌₂ + 𝑌₃ + ... + 𝑌ₙ is negative you lost more rounds than you won,
      If the sum is 0, then both of you won equally often.
      And if the sum is positive you won more rounds than you lost.
      (2 votes)
  • leaf green style avatar for user 𝜏 Is Better Than 𝝅
    By assuming that E(nY) can be dissected into E(Y)+E(Y)+E(Y)+...+E(Y) n times, we have assumed that Y is independent with respect to itself, but clearly knowing what Y is would constrain what Y is, so are all random variables somehow independent with respect to themselves, and if so why?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      The explanation given could be better. X should really be written as the sum Y_1+Y_2+Y_3+...+Y_n, where Y_k is 1 if the kth trial is a success, and is 0 if the kth trial is a failure. The variables Y_1,Y_2,Y_3,...Y_n are independent, and E(Y_k)=p for all k with 1<=k<=n.
      So E(X) = E(Y_1+Y_2+Y_3+...+Y_n) = E(Y_1)+E(Y_2)+E(Y_3)+....+E(Y_n) = sum of n copies of p = np.

      (By the way, the assumption of independence is actually not needed in this type of situation. The expected value of the sum of any random variables is always the sum of their expected values. However, the assumption of independence would be needed to make a similar statement about variance.)
      (2 votes)

Video transcript

- [Tutor] So I've got a binomial variable X and I'm gonna describe it in very general terms, it is the number of successes after n trials, after n trials, where the probability of success, success for each trial is P and this is a reasonable way to describe really any random, any binomial variable, we're assuming that each of these trials are independent, the probability stays constant, we have a finite number of trials right over here, each trial results in either a very clear success or a failure. So what we're gonna focus on in this video is well, what would be the expected value of this binomial variable? What would the expected value, expected value of X be equal to? And I will just cut to the chase and tell you the answer and then later in this video, we'll prove it to ourselves a little bit more mathematically. The expected value of X, it turns out, is just going to be equal to the number of trials times the probability of success for each of those trials and so if you wanted to make that a little bit more concrete, imagine if a trial is a Free Throw, taking a shot from the Free Throw line, success, success is made shot, so you actually make the shot, the ball went in the basket, your probability is, use this yellow color, your probability, this would be your Free Throw percentage, so let's say it's 30% or 0.3 and let's say for the sake of argument, that we're taking 10 Free Throws, so n is equal to 10, so this is making it all a lot more concrete, so in this particular scenario, your expected value, your expected value, if X is the number of made Free Throws, after taking 10 Free Throws with a Free Throw percentage of 30%, well, based on what I just told you, it would be n times p, it would be the number of trials times the probability of success in any one of those trials, times 0.3, which is just going to be, of course equal to three. Now does that make intuitive sense? Well, if you're taking 10 shots with a 30% Free Throw percentage, it actually does feel natural that I would expect to make three shots. Now with that out of the way, let's make ourselves feel good about this mathematically and we're gonna leverage some of our expected value properties, in particular, we're gonna leverage the fact that if I have the expected value of the sum of two independent random variables, let's say X plus Y, it's going to be equal to the expected value of X plus the expected value of Y, that we talk about in other videos and so assuming this right over here, let's construct a new random variable, let's call our random variable Y and we know the following things about Y, the probability that Y is equal to one is equal to p and the probability that Y is equal to zero is equal to one minus p and these are the only two outcomes for this random variable and so you might be seeing where this is going, you could view this random variable, it's really representing one trial, it becomes one in its success, zero when you don't have a success and so you could view our original random variable, X right over here as being equal to Y plus Y and we're gonna have 10 of these, so we're gonna have 10 Ys, in the concrete sense, you could view the random variable Y as equaling one, if you make a Free Throw and equaling zero, if you don't make a Free Throw, it's really just representing one of those trials and you can view X as the sum of n of those trials, well now actually, let me be very clear here, I immediately went to the concrete, but I really should be saying n Ys, 'cause I wanna stay general right over here, so there are n, n Ys right over here, this was just a particular example, but I am going to try to stay general for the rest of the video, because now we are really trying to prove this result right over here, so let's just take the expected value of both sides, so what is it going to be? So we get the expected value of X, of X is equal to well, it's the expected value of all of this thing, but by that property right over here is going to be the expected value of Y plus the expected value of Y plus, and we're gonna do this n times, plus the expected value of Y and we're gonna have n of these, so we have n and so you could rewrite this as being equal to, this is our n right over here, this is n times the expected value of Y. Now what is the expected value of Y? Well, this is pretty straightforward, we can actually just do it directly, the expected value of Y, let me just write it over here, the expected value of Y is just the probability-weighted outcome and since there's only two discrete outcomes here, it's pretty easy to calculate, we have a probability of p of getting a one, so it's p times one plus we have a probability of one minus p of getting a zero, well, what does this simplify to? Well, zero times anything, that's zero and then you have one times p, this is just equal to p, so expected value of Y is just equal to p and so there you have it, we get the expected value of X is 10 times the expected value, or the expected value of X is n times the expected value of Y and the expected value of Y is p, so the expected value of X is equal to np, hope you feel good about that.