Random Variables in Discrete Probability | Free Discrete Mathematics Lesson (4 College Credits) | UPI Study

UPI Study › Courses › Discrete Mathematics › Free lessons › Lesson 6.1 Free with a free account

Random Variables in Discrete Probability

Discrete Mathematics · Chapter 6: Random Variables and Expected ValueSection 6.1 · lesson 35 of 878 min · free with a free account

← Probability of Combination EventsNext lesson: Expected Value: Meaning and Calculation →

Earn 4 college credits for Discrete MathematicsRecommended for credit by NCCRS · Math 230 · self-paced · one payment, lifetime access

In this lesson

Turning outcomes into numbers - and saying how likely each number is.

  • Define a random variable as a function
  • Use the notation X = x and the support of X
  • Tell discrete from continuous random variables
  • Build and verify a probability mass function

Transcript

Everything said in the video, section by section (1,200 words). Read along, or search it.

Random Variables and Expected Value

Random Variables in Discrete Probability

Chapter six is about random variables and expected value. This first section builds the basic machinery. A precise way to turn the outcomes of a random process into numbers, and a precise way to say how likely each number is. Then section six point two uses that machinery to compute an expected value.

The Opening Problem

How Many Ads Before a Purchase?

A mobile game studio logs, for every player who opens the app today, how many in-app ads they view before making a purchase, if they make one at all. Some players view no ads, and buy immediately from a saved cart. Others view one, two, five, or more before deciding. The studio doesn't want to describe every player's session in prose. It wants a single quantity, call it X, that captures the number of ads viewed. Together with a precise statement of how likely each possible value of X is. That quantity, and the framework for describing its likelihood, is a random variable.

Definition 6.1.1

A Random Variable Is a Function

Despite the name, a random variable isn't random in any vague sense. It's a precisely defined function. Let S be the sample space of a random process. A random variable is a function X that assigns a real number, X of s, to every outcome s in S. The randomness lives entirely in which outcome actually occurs. The random variable is simply the fixed rule that converts whichever outcome occurs into a number.

2 Examples

Dice Sums and Ad Sessions

Consider rolling two fair six-sided dice. The sample space is the thirty-six equally likely ordered pairs, i comma j, each from one to six. That count comes from the multiplication rule. Define X as the sum of the two dice, i plus j. That's a genuine function on S. For instance, X of three comma four is seven, and X of six comma six is twelve. And notably, different outcomes can share the same value. X of one comma two, and X of two comma one, are both three. The ad-viewing scenario works the same way, even though its sample space can't be neatly listed. S is every possible player session today, and X of s is the number of ads that session includes. The rule defining X is just as precise as in the dice example, even though listing every session isn't practical.

6.1.2 Notation

X, Its Values, and the Event X = x

Random variables are conventionally named with capital letters, X, Y, Z. A lowercase letter, or a specific number, stands for one particular value the variable could take. The set of all values a random variable can take is called its support, or range. For the dice sum, the support is two through twelve. That distinction enables a compact notation for events. X equals x denotes the event that X takes the specific value x. Formally, the set of outcomes s where X of s equals x. So the probability that X equals seven means exactly, the probability that the two dice sum to seven. There's no need to re-describe the six outcomes that make it true, every time the event is mentioned. It's the same kind of compression sigma notation gave sums, back in section three point five.

6.1.3 Discrete Versus Continuous

Can the Values Be Listed?

Random variables split into two broad kinds, based on the shape of their support. A random variable is discrete if its possible values can be listed one at a time. That's a finite set, or a countably infinite one, like the non-negative integers. It's continuous if its values fill an entire interval of real numbers, with no gaps. Between any two possible values, there are infinitely many others. Here's a quick test. Imagine listing every possible value on an infinitely long sheet of paper, one after another. If that's possible, even if it never finishes, the variable is discrete. The dice sum and the number of ads viewed are both discrete. But the exact time a web page takes to load, or the exact weight of a manufactured part, are continuous. Continuous random variables need calculus-based tools, which fall outside this course. Chapter six focuses entirely on discrete random variables.

Definition 6.1.3

The Probability Mass Function

A discrete random variable's whole probability behavior is captured by one function, listing the probability of each possible value. It's called the probability mass function, or P M F, written p of x. It assigns to each possible value x the probability that X equals x. A valid P M F must satisfy two conditions. First, p of x is at least zero, for every possible value. Second, the values of p of x add up to one, over every possible value. That's because X must take exactly one of its values, with certainty.

Worked Example 6.1.1

Building the PMF of a Dice Sum

Here's the P M F for the sum of two fair dice. Since all thirty-six outcomes are equally likely, p of x is the number of outcomes giving sum x, divided by thirty-six. Only the single outcome one comma one gives a sum of two. So p of two is one thirty-sixth. The two outcomes, one comma two and two comma one, give a sum of three. So p of three is two thirty-sixths. And six outcomes give a sum of seven, so p of seven is six thirty-sixths. Completing the count for every sum, the counts run one, two, three, four, five, six, then back down to one. They add to thirty-six. So the probabilities add to one, and every entry is non-negative. It's a valid P M F.

Figure 6.1.1

A Triangular Shape

Plotted as a bar chart, the P M F has a characteristic triangular shape. It rises from one thirty-sixth at a sum of two, to a peak of six thirty-sixths at seven, then falls back symmetrically to one thirty-sixth at twelve. That shape reflects the counts. Sums near seven have far more contributing outcomes than sums near two or twelve.

Worked Example 6.1.2

Verifying a Proposed PMF

Here's a verification example. A login system tracks X, the number of failed attempts before a successful login, among sessions that succeed within two attempts. Historical data proposes a P M F. p of zero is zero point seven, p of one is zero point two, and p of two is zero point one. Is it valid? Condition one. All three values are non-negative. Condition two. Zero point seven, plus zero point two, plus zero point one, is exactly one. Both conditions hold, so this is a valid P M F.

Takeaways

A Rule, Its Values, Their Chances

To summarize. A random variable is a function assigning a real number to every outcome. The randomness lies in which outcome occurs, not in X, which is a fixed rule. Capital letters name random variables, and X equals x denotes the event that X takes the value x. The support is the set of all possible values. Discrete values can be listed one at a time. Continuous values fill an interval, and need tools outside this course. And a P M F gives each value's probability. Every entry is at least zero, and they add to one. Here's something to think about. Let X be the exact time a customer-service chatbot takes to generate its first response. Is X discrete, or continuous? Now suppose the system logs response time rounded to the nearest whole second. Has the nature of what's measured changed, or only how finely it's recorded? Explain what changes between the two versions, and what stays the same, using the listing test.

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.

Why take it here

Why students take Discrete Mathematics with UPI Study

The math behind computer scienceDiscrete Mathematics is the mathematics of computer science: logic, proofs, sets, counting, probability and graphs underpin algorithms, data structures, cryptography and databases. Completing it now lets you qualify for those courses at your university.
Credit at a fraction of the priceThe same 4 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

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.

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 Random Variables in Discrete Probability

Is a random variable really a variable, or is it a function?
A random variable is a function, not a variable in the algebra sense. It takes each outcome s in the sample space S and assigns a real number X(s). The randomness is in which outcome occurs. For two dice, X(i,j)=i+j is a fixed rule, and X(3,4)=7.
What does X = x mean, and what is the support of X?
The notation X = x denotes the event that X takes the specific value x, meaning the set of outcomes s with X(s)=x. The support is the set of all values X can take. For the sum of two dice, the support is 2 through 12, and P(X=7) is the probability the dice sum to seven.
How can I tell whether a random variable is discrete or continuous?
A random variable is discrete if its possible values can be listed one at a time, even if the list is infinite, like the non-negative integers. It is continuous if its values fill an entire interval of real numbers. The number of ads viewed is discrete, while the exact time a page takes to load is continuous.
How do I check whether a proposed probability mass function is valid?
A proposed PMF is valid if p(x)\ge 0 for every possible value and the probabilities add to 1. For example, p(0)=0.7, p(1)=0.2, p(2)=0.1 has no negative entries and 0.7+0.2+0.1=1, so it is valid. If either condition fails, it is not a PMF.

About the Discrete Mathematics course

How many college credits is Discrete Mathematics?
Discrete Mathematics (Math 230) carries a NCCRS credit recommendation for 4 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Discrete Mathematics cost and what is included?
$250, paid once, with lifetime access: all 87 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Discrete Mathematics take?
It is self-paced with no deadlines. The 87 lessons total about 13 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

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.

Discrete Mathematics
4 credits · NCCRS
Enroll →