# Geometric distribution

Release: |
---|

The geometric distribution describes the number of independent Bernoulli trials until the first successful outcome occurs -- for example, the number of coin tosses until the first heads. The parameter «p» is the probability of success on any given trial.

## Contents

## Functions

### Geometric(p)

The distribution function. Use this to define an uncertain variable that represents a number of events that occur until a success occurs, where «p» is the probability of success on each trial.

### ProbGeometric(k, p)

Returns the probability that «k» or fewer events occur until a success is seen. This is the analytic discrete probability function. It returns

- $ p(k) = p (1-p)^{k-1} $

### CumGeometric(k ,p)

The analytic cumulative probability function for a **Geometric distribution**. This is the probability that the actual number of events that occur until a success occurs is less than or equal to «k», given that at each trial there is a «p» probability of success. The value is equal to

- $ F(k) = 1 - (1-p)^k $

### CumGeometricInv(q, p)

The inverse of the cumulative probability function for the Geometric(p) distribution, also know as the *quantile function*.

Computes the smallest number of independent Bernoulli trials, *k*, such that the probability of seeing at most *k* of failures before the first success is greater than or equal to «u», where the probability of success of each trial is «p».

## Statistics

The **Geometric distribution** has the following statistics

## Examples

An aspiring gymnast catches her jaeger (a release move on uneven bars) at practice 40% of the time. Her coach wants her to successfully catch at least one during practice 95% of the time (i.e., in 95% of her practices, she should catch at least one). How many repetitions should the coach insist on during each practice?

`CumGeometricInv(95%, 40%) → 6`

The actual success rate if she makes 6 attempts every practice should be

`CumGeometric(6, 40%) → 95.33%`

If you enter a lottery every day of the year, where each entry has odds of 1 chance in 1M of winning, what is the probability that you will win within one year? How about within 10 years?

`CumGeometric(365, 1/1M) → 3.649e-004`

`CumGeometric(3653, 1/1M) → 3.646e-003`

What is the probability of rolling doubles ten times in a row with a pair of fair dice? To encode this, treat a success as a non-double roll, which has a probability of 5/6, so the answer is given by

`1 - CumGeometric(10, 5/6) → 1.654e-008`

John is a baseball player, who hits the ball on 10% of his swings. What is the probability he gets a hit during his next three swings?

`CumGeometric(3, 10%)`

## History

The analytic functions (ProbGeometric, CumGeometric, and CumGeometricInv) were included as built-in functions in Analytica 5.2.

The analytic functions were provided in the Distribution Densities Library for the first time in the 4.4.3 patch release.

Enable comment auto-refresher