Home / Learn / Maths / Sample space builderTool #L82 (formerly #1165)

Sample space builder: probability with dice, coins and cards

See every outcome of two dice, a few coins or a deck of cards, shade an event and get its probability as a fraction. Then run the experiment thousands of times and watch the share of hits settle near it.

Keep it one tap away for everyday use.

Bookmark Sample space builder?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Experiment
  2. Outcomes
  3. P(E)
  4. Simulate
Nothing is uploadedWorks offline once open

Pick an experiment

Try it many times

The computer does the experiment again and again at random. The share of times the event happens settles near the probability, but it is never exactly the same.

Try this

  • Two dice: which sum is most likely? Change the number and watch the shaded diagonal grow and shrink.
  • Coins: with 3 coins, why is "exactly 1 head" three times as likely as "exactly 0 heads"?
  • Run 100 trials a few times. The answers jump about. Now run 10 000: they hardly move.
  • Cards: P(red) + P(not red) = 1. Check it with "not a heart" too.

Check yourself

Fresh questions every time. Fractions like 1/6 are fine. Nothing is saved.

What it does

Probability at school starts from one idea: when every outcome is equally likely, the probability of an event is

P(E) = number of outcomes in the event / total number of outcomes.

The hard part is listing the outcomes without missing any or counting one twice. This page lists them for you. Pick two dice, one to three coins or a full deck of 52 cards, choose an event, and every outcome appears in a grid with the ones in the event shaded. The probability is shown as a fraction, in its simplest form and as a decimal, together with the chance that the event does not happen.

The second card does the experiment at random, 100, 1 000 or 10 000 times, and draws how the share of hits (the relative frequency) changes as the trials pile up. That is the experimental probability of the Class 9 chapter; the shaded count is the theoretical (classical) probability of Class 10, and Class 11 puts the two side by side. The page lets you see them meet.

To count outcomes when listing them is too long, try combinatorics calculator. When the outcomes are numbers, probability distribution explorer shows the whole spread of chances, and grouped data summarises real data you collect.

How to use it

  1. Choose Two dice, Coins or A deck of cards.
  2. Pick an event from the list. Some events take a number, such as “the sum is k” or “exactly k heads”; type it in the Number box.
  3. For coins, choose how many (1, 2 or 3).
  4. Read P(E) under the grid. Shaded cells are the favourable outcomes.
  5. Press 100 times, 1 000 times or 10 000 times. The blue line is the running relative frequency; the dashed line is the probability.

A worked example

Two dice are thrown. What is the probability that the sum is 7?

  • There are 6 × 6 = 36 equally likely outcomes, from (1, 1) to (6, 6).
  • The sum is 7 for (1, 6), (2, 5), (3, 4), (4, 3), (5, 2) and (6, 1): 6 outcomes, one diagonal of the grid.
  • P(sum 7) = 6/36 = 1/6 ≈ 0.1667, and P(sum not 7) = 30/36 = 5/6.

Run it 10 000 times and the relative frequency usually lands within about 0.01 of 0.1667. With only 100 throws it can easily be 0.12 or 0.22.

Tips

  • (2, 5) and (5, 2) are different outcomes. Think of one red die and one blue die.
  • P(E) is always between 0 (impossible) and 1 (certain), and P(E) + P(not E) = 1.
  • More trials do not force the frequency to equal the probability; they only make big gaps rarer.

Check yourself

Four fresh questions each time: a dice sum, a number of heads, a card event and a “does not happen” question. Fractions such as 1/6 are accepted. Nothing is saved.

FAQ

Why is a sum of 7 the most likely? It has the most ways to happen: six, one for each value of the first die.

Is this from the NCERT book? It covers the same topics with fibub’s own examples. fibub is not part of NCERT.

Where the numbers come from

  • Classical probability (favourable outcomes over equally likely outcomes) and relative frequency are standard school mathematics. Written for fibub; the simulation uses the public-domain mulberry32 generator.
  • Checked against counts done separately in Python with itertools.product: two dice (sum 7 = 6/36, sum at least 10 = 6/36, prime sum = 15/36, even product = 27/36), three coins (exactly one head = 3/8) and the 52-card deck (26 red, 12 face, 6 red face cards).

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Change log for Sample space builder

  1. Add #1165 Sample space builder Details on GitHub

Every change to fibub

Related tools

Combinatorics calculator #T385 Count exactly, with every digit: permutations and combinations with or without repetition, multinomial coefficients (arrangements of a word), Stirling numbers of both kinds, Lah numbers, Bell and Catalan numbers, integer partitions and derangements, with tables you can download. Probability distribution explorer #T391 Pick a distribution (normal, t, chi-squared, F, beta, gamma, Weibull, binomial, Poisson and 26 more), set its parameters and see the curve with the probability between two values shaded, the quantiles, mean, variance, skewness and kurtosis, and draw seeded random samples. Matches scipy.stats. Grouped data #L80 Type class intervals and frequencies and get the mean by the direct, assumed-mean and step-deviation methods, the median and the mode with the formulas filled in, and a histogram with less-than and more-than ogives. Probability spinner designer #L163 Design a spinner with up to six coloured sectors, read each probability as angle ÷ 360°, then spin once or a thousand times and watch the share of landings settle near the theory. At Class 12 level give each sector points and find the expected score. Histogram builder #L167 Type a list of numbers and drag the class width and starting point to watch the frequency table, the histogram and the frequency polygon change. See the mean, median, mode and modal class, how far the mean from the table drifts from the true mean, and the combined mean of two groups. Counting machine #L234 Seat people in a row, pick a team or shuffle the letters of a word and see every arrangement listed for small cases. nPr and nCr are worked side by side with your numbers, and repeated letters (BANANA, MISSISSIPPI) are handled with n!/(p! q!). Spread explorer #L239 Drag the points of two data sets along a number line and watch the range, mean deviation about the mean and median, variance, standard deviation and coefficient of variation change live. Compare two classes with the same mean but different spread, see each deviation as a bar, and open the full working. Event algebra #L240 Roll two dice (or a coin and a die) and see all the outcomes as a grid. Choose events A and B, shade them, outline A ∪ B, A ∩ B, A′, A − B or B − A, and watch the addition rule P(A ∪ B) = P(A) + P(B) − P(A ∩ B) worked out with the counts. Mutually exclusive and exhaustive events are flagged, and a simulation checks the answer. Random variable builder #L311 Build a probability distribution table (or pick coins, dice, drawing without replacement or a binomial with sliders) and get the mean, E(X²), variance and standard deviation with every step, a bar chart with μ and μ ± σ, and a simulation that runs the experiment 10 to 10 000 times so you can watch the average settle on the mean.