CSE 21

Math for Algorithms

A burrito shop messes up your order with an independent probability of 1/4 every time you visit. Let X be a random variable representing the total number of times they mess up your order across 16 separate visits. Thus X can be any integer from 0 to 16. What is var(X)?

**Solution: var(X) = 3.** There are two main ways to arrive at this result.

- The first is to realize that X is a binomial random variable, yielding a variance of simply np(1 - p) = 16 * 1/4 * 3/4 = 3.
- The second is to define 16 indicator (Bernoulli) variables Xi, one per visit, each taking on (e.g.) the value 1 if an order is messed up and 0 otherwise. Then var(Xi) = E[Xi^2] - E[Xi]^2 = 1/4 - (1/4)^2 = 3/16. Since the Xi's are i.i.d., var(X) = sum of 16 var(Xi)s = 3.