# What is the geometric distribution formula?

Before delving into the geometric distribution formula, it will be helpful to first familiarize yourself with the geometric probability distribution. If you’ve already read it, or you’re already familiar with the geometric distribution, then let’s continue!

The probability of making your first free throw after k attempts can be calculated using the geometric distribution formula. Photo by Erik Drost.

### Geometric distribution: an example

Consider a basketball player taking a foul shot. Let’s say that his probability of making the foul shot is p = 0.7, and that each foul shot can be considered an independent trial. Making the foul shot will be our definition of success, and missing it will be failure. We’ll let X represent the number of shots/trial the basketball player makes before making his first basket. Therefore, X will be any counting number:

Range(X) = {1,2,3,4,…}

Now let’s calculate the probability that the basketball player mentioned above misses the first two throws, but makes the third free throw; that is, P(X = 3). Because the probability that the player makes the shot is p = 0.7, then the probability of failure will be the complement q = 1 − p = 0.3.

We can calculate this probability long-hand, by multiplying the probabilities of the three independent events:

P(X = 3) = P(failure)×P(failure)×P(success) = 0.3 × 0.3 × 0.7 = 0.063

How about if the player misses the first three shots, but makes the fourth? We could calculate as follows:

P(X = 4) = P(failure)³×P(success) = (0.3)³×0.7 = 0.0189

Do you notice a pattern? With each additional failure before the first success, we multiply by another factor of 0.3, which in turn reduces the overall probability. We can summarize this trend in the following table:

(For the math buffs out there: the probabilities generated in the right-hand column are a geometric sequence with common ratio q, hence why this distribution is called geometric.)

We can also graph the values above to give a visual sense of the geometric distribution:

### Geometric distribution formula

We can now generalize the trend we saw in the previous example. We have now seen the notation P(X = k), where k is the actual number of shots the basketball player takes before making a basket. We can define it more generally as follows:

P(X = k) = P(first k−1 trials are failures, kth trial is a success)
P(X = k)= p(1-p)k-1

Because (1−p) is the complement to p, it thus represents the probability of failure. From my previous article on complementary events, we often see (1−p) written as q. Thus the formula above becomes:

P(X = k) = pqk-1

For a deeper look at this formula, including derivations, check out these lecture notes from the University of Florida.

### Expected value of a geometric distribution

Just as with other types of distributions, we can calculate the expected value for a geometric distribution. In the example we’ve been using, the expected value is the number of shots we expect, on average, the player to take before successfully making a shot. While we won’t go into the derivation here, we can define the expected value as:

E(X) = 1p

To illustrate expected value, let’s consider a dice-rolling game in which you win when you roll a five, and you lose in all other cases. Our probability of success is therefore p = ⅙. We can compute expected value as follows:

E(X) = 11/6 = 6

Therefore, we should expect that, on average, we’ll have to roll the die six times before we see a single five rolled.

Still have questions on the geometric probability formula? Check out our statistics blog and videos!