The binomial probability formula is used to calculate the probability of a given number of successes in a fixed number of independent trials, each with the same probability of success. In this case, it was used to find the probability of exactly 7 customers preferring vanilla out of 10, given a 70% chance that any one customer prefers vanilla.