# Binomial Distribution via Coin Flips

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

In this Demonstration, you can set the number of coin flips per trial to 5, 10 or 20, and the number of heads is recorded. Set the total number of trials (from 1 to 10,000) with a button. When the probability of heads is 50%, the distribution closely resembles a normal distribution as the number of trials and the number of coin flips per trial increase. AS the sample size increases, the distribution more closely resembles a true binomial distribution. Make a weighted coin by changing the probability of landing on heads using the slider; 0% means the coin always lands on tails and 100% means the coin always lands on heads. Click "flip coins" to generate a new set of coin flips. Use buttons to view a bar chart of the coin flips, the probability distribution (also known as the probability mass function), or the binomial distribution. The probability mass function is the number of flips in a trial that resulted in heads divided by the number of flips.

Contributed by: Adam J. Johnston and Rachael L. Baumann (May 2017)

Additional contributions by: John L. Falconer

(University of Colorado Boulder, Department of Chemical and Biological Engineering)

Open content licensed under CC BY-NC-SA

## Snapshots

## Details

To generate the bar graph, first a list is made of 100 possible outcomes. A "1" in the list means heads and a "0" means tails. If the probability of flipping heads is 50%, then the list contains 50 ones and 50 zeros. If the probability of flipping heads is 70%, then the list contains 70 ones and 30 zeros. Numbers are then randomly selected from the list. If 5 is selected for "coin flips per trial," then a number is selected from the list five times, and these numbers are summed. For example, for five flips in a trial, if the random numbers selected from the list are 1, 0, 0, 1, 1, then the number of heads in that trial is three. This process is repeated for each trial.

## Permanent Citation