UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 5.1 Free with a free account
Counting Outcomes and Sample Spaces
Discrete Mathematics · Chapter 5: Counting Methods and Basic ProbabilitySection 5.1 · lesson 27 of 879 min · free with a free account
Free preview
Create a free account to keep watching
It takes a minute and costs nothing. Your free account unlocks all of Chapter 1 and 3 more lessons of Discrete Mathematics.
Lesson complete
Earn the 4 college credits for Discrete Mathematics
Enrolling adds a quiz after each lesson, the graded work and the official transcript. Recommended for credit by NCCRS.
Next lesson: The Addition and Multiplication Rules →← Constructing Proofs by InductionNext lesson: The Addition and Multiplication Rules →
In this lesson
Every possible result, each counted exactly once.
- Define a sample space, an outcome and an event
- Enumerate a multi-stage experiment with a tree diagram
- Compute a classical probability as a ratio of counts
- Recognize when that ratio is not a valid probability
Transcript
Everything said in the video, section by section (1,273 words). Read along, or search it.
Counting Methods and Basic Probability
Counting Outcomes and Sample Spaces
Chapter five turns to counting, and to the most basic ideas of probability. This first section builds the language for being precise about chance. What can happen, how to list it all systematically, and how a probability can be computed as a ratio of counts. Everything here is counted by direct enumeration, to make clear exactly what the faster shortcuts in section five point two are shortcuts for.
The Opening Problem
2 Requests, Same Server?
A load balancer sits in front of a small web service. It routes each incoming request to exactly one of three backend servers, A, B, or C, chosen uniformly at random. For a single request, describing what can happen is easy. It lands on A, on B, or on C. But an engineer checking whether the routing behaves as intended, needs to reason about more than one request at a time. For instance, out of two consecutive requests, how often should both land on the same server, just by chance? Answering that takes precision about two things. Exactly what the full range of possible outcomes is. And how to count them, without missing any, or listing any twice.
Definition
Sample Space, Outcome, Event
Every question about chance starts from a random process, called an experiment, together with a complete list of what it could produce. The sample space of an experiment, written with the Greek letter omega, is the set of every possible result. A single element of the sample space is called an outcome. An event is any subset of the sample space. It occurs on a given run exactly when the outcome that actually happens is a member of it. An event with exactly one outcome is a simple event. One with more than one outcome is a compound event. And at the two extremes, the whole sample space is an event that always occurs, while the empty set, containing no outcomes, never occurs.
One Request
3 Outcomes, No Overlap, No Gap
For a single request, the sample space is the set A, B, C. There are exactly three outcomes. And since routing is uniform, there's no reason to expect one more often than another. The request is routed to A is the simple event containing just A. The request is not routed to A is the compound event B, C. It occurs whenever the actual outcome is B, or is C. It's worth being exact about what counts as a legitimate sample space. A, B, C covers every possibility, with no overlap and no gap. Every request lands on exactly one server. A description like normal routing, or unusual routing, might seem to describe the same experiment. But unless those two labels are defined so every outcome falls into exactly one of them, it's not the same kind of object. And generally, its members can't be assumed equally likely.
Tree Diagrams
Enumerating an Experiment in Stages
The single-request sample space was short enough to write out by inspection. But many experiments happen in stages. First one choice is made, then another. Listing every combination correctly, with nothing missing and nothing repeated, gets error-prone quickly if it's done by guesswork. A tree diagram removes the guesswork. From a starting point, draw one branch for each possible result of the first stage. Then, from the tip of each of those branches, draw one branch for each result of the second stage, and so on, for as many stages as the experiment has. The construction guarantees a clean correspondence. Every complete path from the root to a leaf fixes one result at every stage, so it's exactly one outcome. And every outcome traces out exactly one path. Because it goes both ways, counting leaves is the same as counting outcomes. Nothing is missed, and nothing is counted twice.
Worked Example 1
2 Consecutive Requests
Now the first worked example. Two requests arrive one after another, each independently routed to A, B, or C. Stage one has three branches, one for each server that could handle the first request. From the tip of each, stage two again has three branches, one for each server that could handle the second request. Every path fixes a server for each request, so each leaf is labeled as an ordered pair. First request's server, then second request's server. Reading off all nine leaves gives the sample space. The three highlighted leaves, A A, B B, and C C, are the outcomes where both requests land on the same server.
The Tree as Code
Nested Loops Mirror the Branches
The same sample space can be built in code, by mirroring the tree's structure directly. An outer loop runs over the three possible results of stage one. Nested inside it, an inner loop runs over the three results of stage two. Each pass through the inner loop appends one ordered pair. That's one leaf of the tree. Running it prints nine total outcomes, the same nine pairs. It's exactly the branching structure of the tree, written as nested iteration instead of as a picture.
Definition
Classical Probability
With a sample space fully listed, the most basic way to measure how likely an event is comes from simply comparing counts. Let the sample space be finite, with every individual outcome equally likely, and let E be an event. The classical probability of E, also called the naive probability, is the number of outcomes in E, divided by the number of outcomes in the sample space. The formula depends entirely on that equally likely condition. If the outcomes don't all have the same chance of occurring, dividing one count by the other doesn't correctly compute a probability.
Worked Examples 2 and 3
Probabilities by Direct Counting
Back to the two requests, assuming each of the nine outcomes is equally likely. First, the probability that both requests land on the same server. Reading directly from the sample space, that event has three outcomes, A A, B B, and C C. So its probability is three out of nine, which is one third. Second, the probability that at least one request goes to server A. Scanning all nine outcomes for a pair with an A in either position gives five of them. So that probability is five ninths. Notice that both events were found by directly scanning and listing every qualifying outcome. The shortcut formulas for this are exactly what section five point two introduces.
Types of Events
4 Kinds of Event in One Sample Space
This table sorts events into the four types that come up again and again, using the single-request sample space. A simple event has exactly one outcome, like the set containing just A. It occurs when the outcome is A. A compound event has more than one outcome, like B, C. It occurs when the outcome is B, or is C. The certain event is the whole sample space. Whatever happens, it occurs. And the impossible event is the empty set. For example, routed to server D, which doesn't exist. No outcome can ever satisfy it.
Takeaways
Count Carefully, Then Divide
To summarize. A sample space lists every possible outcome, with no overlaps and no gaps. An event is any subset, and it occurs exactly when the actual outcome belongs to it. A tree diagram enumerates a multi-stage experiment with one path per outcome, so nothing is missed or double-counted. The classical formula, a count over a count, requires every outcome to be equally likely. Without that, the ratio isn't a valid probability. And grouping outcomes into a few convenient categories doesn't automatically produce a valid sample space. Here's something to think about. A student wants the probability that a random three-digit code has at least one repeated digit. They say a code has no repeats, exactly one pair, or all three digits the same. Two of those three involve a repeat, so the probability is two thirds. Using this section's definitions, what's wrong with that? Is that set of three really a sample space in this sense? And are its members equally likely?
About Discrete Mathematics at UPI Study
Discrete Mathematics (Math 230) is a self-paced online course of 87 video lessons in 13 chapters, from logic and proof to counting, probability, graph theory and trees. It carries a NCCRS credit recommendation for 4 semester credits.
Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Enroll now → Course details Download the syllabus Every course with PRO →
Why take it here
Why students take Discrete Mathematics with UPI Study
Where the credit goes
Universities that work with NCCRS
Discrete Mathematics carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
Thomas Edison State UniversitySigned partner
University of the PeopleSigned partner
Charter Oak State CollegeSigned partner
Strayer UniversitySigned partner
Columbia Southern UniversitySigned partner
Indiana TechSigned partner
Penn StateWorks with NCCRS
Southern New Hampshire UniversityWorks with NCCRS
SUNYWorks with NCCRS
+many more cooperating universitiesFind my college →Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.
FAQ
Questions students ask us
About Counting Outcomes and Sample Spaces
What are a sample space, an outcome, and an event in probability?
How do you use a tree diagram to list the outcomes of a multi-stage experiment?
How do you compute a classical probability as a ratio of counts?
When is a ratio of counts not a valid probability?
About the Discrete Mathematics course
How many college credits is Discrete Mathematics?
How much does Discrete Mathematics cost and what is included?
Which universities accept UPI Study credits?
How long does Discrete Mathematics take?
How are the exams done?
How do my credits reach my college?
Ready for the full course? Earn 4 credits in Discrete Mathematics.
87 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.
4 credits · NCCRSEnroll →