Binomial Distribution via Coin Flips

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.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+