Using Mathematica to study basic probability

by Nasser Abbasi, september 30, 2007

Basic relations. Let f(x) be a PDF for some continuous random variable.  Then the following is true
"showing_basic_relations_in_probability_1.gif"
As can be verified as follows (using Normal distribution as an example) by evaluating the above integral and see if it the same as CDF(X=a)

In[1]:=

"showing_basic_relations_in_probability_2.gif"

Out[3]=

"showing_basic_relations_in_probability_3.gif"

Now find F (a), it should be the same as above

"showing_basic_relations_in_probability_4.gif"

"showing_basic_relations_in_probability_5.gif"

Another important relation is probability of X being in some range. This is the same as the area under the curve of f(x) between the 2 points:

"showing_basic_relations_in_probability_6.gif"
The above is found as follows

"showing_basic_relations_in_probability_7.gif"

"showing_basic_relations_in_probability_8.gif"

Now find F (b)-F(a), it should be the same as above

"showing_basic_relations_in_probability_9.gif"

"showing_basic_relations_in_probability_10.gif"

"showing_basic_relations_in_probability_11.gif"

lets try to see how to find probabilty of X be in some range when X is discrete. Assume X is a discrete random variable, say a Binomial. We need to do the same as above. Now we can not use Integrate, but need to us SUM

"showing_basic_relations_in_probability_12.gif"

Graphics:Example of binomial


Let find P (X < 3) in the above. Now instead of integration, we use sum, we want to add the area under the PDF from 0 to 3. But the width is 1 for each interval. So we just sum the y values.

"showing_basic_relations_in_probability_14.gif"

"showing_basic_relations_in_probability_15.gif"

Verify by checking the CDF at 3, it should be the same as above

"showing_basic_relations_in_probability_16.gif"

"showing_basic_relations_in_probability_17.gif"

To show that probability mass function adds to one. Say we have binomial distribution

"showing_basic_relations_in_probability_18.gif"

"showing_basic_relations_in_probability_19.gif"

"showing_basic_relations_in_probability_20.gif"

"showing_basic_relations_in_probability_21.gif"


Created by Wolfram Mathematica 6.0 for Students - Personal Use Only  (29 December 2007) Valid XHTML 1.1!