Before we actually get to talking about probability math functions, let's lay some foundation and talk
about functions in general.
For instance, let's think about this graph here, which is the graph of the function.
F of x equals x minus one.
We want to think about functions as inputs and outputs.
And what they tell us is that for any value we input for X on the right hand side here the function
will return to us a value for this left hand side, this F of x value.
So for instance, if we pick x equals one, then the function gives back to us one minus one or zero,
which means if we set up down here a table of inputs and outputs, so we'll have our inputs X and our
outputs F of x.
We said that if we pick an input of x equals one, our output is one minus one or zero.
If we pick an input of x equals two, we get two minus one or one.
So an input of two gives an output of one.
An input of three would give an output of two etc. And of course that makes sense because this function
here is just telling us whatever value we put in for x, we're going to subtract one from it to get
the output.
And so we can see that all of the outputs are one less than the input values and we can see that in
the graph as well.
Obviously all of these then become coordinate points.
So we have this coordinate .10 and we see that.
Right here.
We also have this coordinate .21.
We see that point here at two.
One, we see that it's along this line and we have the 0.32.
So we go out to X equals three and up to two and we sketch in that point.
So what this function is saying is that if we pick a value X equals two, we come up to the graph of
the function and then we move straight over to the vertical axis and we see that the value we get back
is one.
So when we pick two, we get back a value of one, or if we pick three, we come up to the function
at x equals three.
And then from here we go over to the vertical axis and we find two.
So if the input is three, the output must be two.
If the input is two, the output must be one.
If the input is one here, the output must be zero, so zero and one.
So we can get these input output pairs just from the function as we showed with our table here.
Without ever having the graph, we can also get the input output pairs from the graph itself and the
input output pairs from the graph will always match the values we get in our table.
The values that are generated when we plug in values of X to our function well, a probability mass
function works the same way, except that we plug in values that the variable can take on and what's
returned to us is a probability.
So here in this scenario, what was returned to us was a value along the vertical axis here, a value
for F of X in a probability mass function.
What we get back is a probability, a probability that that input value occurs.
So as an example, let's look at this probability mass function.
This function models the probability of flipping heads.
If we flip a coin two times.
Now, we've already looked at probability with coin flips.
So we know that when we flip a coin two times we can flip heads and then heads we can flip heads and
then tails.
Or we can flip tails and then heads or tails and then tails.
There are four possible equally likely outcomes when we flip a coin two times.
Now, if we think about the number of heads we can get over the course of two coin flips, we can either
get two heads here, which we see in this outcome.
We can flip heads once, once or zero times.
So the only possible options are flipping heads zero times, one time or two times.
And that's what we see here.
In the probability mass function x can be zero, it can be one or it can be two.
So this part of the function here represents all of the possible outcomes of our discrete random variable.
Now, it's important that we say discrete random variable because we're only going to use probability
mass functions to model discrete random variables, not continuous random variables.
And the reason is because we have to be able to identify a specific probability for each outcome.
And remember, with continuous random variables, we can continue to measure an infinite number of between
values.
So whereas in this example, where we can flip heads zero times one time or two times, if we had a
continuous random variable, we might need to look at the probability of zero times, but then also
a quarter of a flip or a half of a flip or 0.4782935 flips every value, an infinite number of values
in between zero and one and an infinite number of values between zero and two.
And we can't define a specific probability for all of those infinite number of values.
So we only use probability mass functions to model discrete random variables where we have this countable
set of discrete values that our random variable can take on.
So we have to have a discrete random variable, and all of the values that we can get are defined over
here in this part of the function.
This part of the function gives the probability that each of these outcomes occur.
So this part here is P of X, the probability that the specific value of X occurs.
And we can see here with our little chart we made that of the four equally likely outcomes will flip
heads zero times exactly one out of those four outcomes.
So there's a one in four chance that will flip heads zero times when we flip a coin two times.
And so a one in four chance is a 0.25 chance.
The same thing happens here.
The probability of flipping heads two times happens only one out of these four possible scenarios.
So that probability is also one fourth or 0.25.
But the probability of flipping heads exactly once happens two out of four times.
So the probability of x equals one is two over four or one half or 0.50.5.
So we've matched up each of these probabilities with the course.
The outcome.
It's important to say now to then another requirement of a probability mass function is that all of
these P of X values here have to add to one because remember, total probability is always one or 100%.
Every individual probability value has to fall between zero and one.
So 0.250.5 and 0.25 all fall between zero and one.
And these values add up to 1.25 plus 0.5 plus 0.25 is one.
So we have the requirement that these values add to one.
We have the requirement that we're dealing with a discrete random variable, and we just set it a little
bit, but let's be a little bit more explicit that all of these P of X values have to be positive.
So we can contrast that with this kind of function, which we might have learned about in an algebra
course.
In this kind of function, we can find negative values of F of X, For instance, if we were to set
X equal to one half, our input would be one half and our output would be one half minus one or negative
one half.
And we see that along the graph here.
If we pick this x equals one half value and we connect it to our graph and then go straight over to
the vertical axis, we see that we get a negative value of one half and F of x.
This function is perfectly defined for that set of values.
We could say the input is one half, the output is negative one half.
That's totally valid.
That satisfies this function f of x, but for probability mass functions we can never find a negative
output like this.
In our case, that means we can never get a negative probability.
So all of these values right here have to be zero or positive.
They cannot be negative, which makes sense because negative probability is really nonsensical.
So those are our three requirements.
We have to be dealing with a discrete random variable, which means we have a countable set of values.
Our set of values is not continuous.
We don't have a continuous random variable.
And all of these probability outputs here have to be defined between zero and one, and in total they
have to add to one.
By definition, of course, that means they can't be negative.
So with that said, the only other thing we want to say about probability mass functions is that sometimes
we'll see them written this way and then sometimes we'll add an extra line to the function, or we'll
see this line added to the function that says that the function is zero for any other values or zero
otherwise.
And if we have this line, all it's doing is clarifying for us that the probability that X takes on
any other value other than zero one or two is zero.
It doesn't really change anything because our probabilities still add to one.
We're just explicitly stating by putting in this extra piece of information that these are indeed the
only values that X can take and confirms for us that the total probability of this probability mass
function is defined in these first three rows here.
So sometimes we'll see this, sometimes we won't.
We don't necessarily have to have it.
It's just important that we meet all of the other requirements of discrete random variable probabilities
defined between zero and one that all sum to one.
Now, just like with this function, this algebraic function where we were able to sketch its graph,
let's talk about the graph of a probability math function.
So really we're setting it up on horizontal and vertical axes, just like we did over here.
And we always include all possible values of x, our discrete random variable along the horizontal axis.
So here are possible values for x or zero one or two.
So we include those along the horizontal axis zero one and two, and then along the vertical axis we'll
mark off increments of our probability P of X.
And then in order to graph this probability mass function, all we do is add in these columns here which
show that the probability that X is zero is 0.25 or 25% or one in four.
So we draw in this bar, this line at x equals zero and extending up to 0.25, whereas the probability
that x equals one is 0.5.
So at X equals one, we sketch in this bar extending up to 0.5 along the vertical axis and then again
here at x equals two, since the probability associated with x equals two is 0.25, we sketch in this
bar all the way up to 0.25.
So seeing the way that these two things match each other, we should be able to from this function sketch
the graph of the probability mass function.
But we should also be able to take this graph and define an algebraic form up here.
The probability mass function F of x.
Obviously, if we were starting from the graph, we could start here along the horizontal axis to see
that x is defined at zero one or two and we could set up this part.
Of our probability mass function.
And then for each of those values, zero one and two, we would find the corresponding probability and
we would set up.
These pieces and then we would just say F of X is equal to we'd have our open brace here.
And then our three scenarios defining the probability for each possible value of the discrete random
variables.
So we should be able to move back and forth between this algebraic representation and this visual graphical
representation.
And then the only other thing we want to say is that just like when we talked about probability before
and we learned about complimentary probability and and or probability, we can answer those same kinds
of questions with a probability math function.
So whether we have this representation of F of X or this graphical representation of F of X, we should
of course be able to state the probability that X is equal to zero or x is equal to one or x is equal
to two.
But we should also be able to find the probability, let's say, that X is equal to zero or one.
We know from the addition rule that the probability that X is equal to zero or one has to be 0.25 plus
0.5.
So the probability that x is zero or one would be equal to 0.25 plus 0.5 or 0.75.
Or we could say something like What's the probability that X is not one?
So the probability that X is not one.
Well, that would be everything but this 0.5 here.
So we would take 0.25 plus 0.25.
And we would get 0.5 or the probability of not one we could calculate as one minus the probability of
x equal to one or 0.5.
And we get the same answer, 0.5.
And of course, we could answer these kinds of questions from this representation of F of X, but also
from the graphical representation of F of X, for instance, this probability of zero or one question.
We would just identify here the probability as 0.25 and here the probability as 0.5.
We would add those together to get 0.75.
So that's the idea of a probability math function, how they're related to the original idea of a function
as a set of inputs and outputs, how the outputs are defined as measures of probability, how we can
only use them for discrete random variables where the probabilities are all defined between zero and
one and sum to one, and how we can represent probability mass functions both algebraically and graphically,
and use both representations to answer all different kinds of probability questions.