Continuous Probability Example

Example 1c, p207 Ross's A First Course in Probability, 7th Edition

The lifetime in hours of a certain kind of radio tube is a random variable having a probability density function given by f(x) = 100/x^2 for x>100 (and 0 otherwise).

pdf

you can get Mathematica to plot the nonzero part automatically, but it may not be as we would show it.

Plot[(100/(x^2)),{x,100,150}]

if we wish to control the graphing window, we can use a little calculus

D[ (100/(x^2)),x]

the nonzero part is always decreasing, so its maximum value is at the left side, that is x=100.

( (100/(x^2)))/.{x->100}

This is more complicated but more like the graph we would show.  I dashed the part on the axis is to make it show up better

Show[{Plot[0,{x,-10,100}, 
PlotStyle->{Red,Thickness[0.01],Dashing[{.05,.1}]}],
Plot[(100/(x^2)),{x,100,150}, 
PlotStyle->{Red,Thickness[0.01]}] },PlotRange->{{-10,150},{-0.001,.01}},AxesLabel->{" x ", "f[x] "}, PlotLabel->"Probability Density Function"]

Show[{Plot[0,{x,-10,100}, 
PlotStyle->{Red,Thickness[0.01],Dashing[{.05,.1}]}],
Plot[(100/(x^2)),{x,100,500}, 
PlotStyle->{Red,Thickness[0.01]}] },PlotRange->{{-10,500},{-0.001,.01}},AxesLabel->{" x ", "f[x] "}, PlotLabel->"Probability Density Function"]

cdf

The cdf is F[x_]:=(∫_(-∞)^x)f[t]dt

Certainly the area under the pdf to the left of 100 is zero.

For any x > 100, P(X<= x) = (∫_100^x)(100/(t^2))dt .

an almost manual effort

∫(100/(t^2))\[DifferentialD]t

(-(100/x)) - (-(100/100))

a more automated effort requires some work

Mathematica can deal with many kinds of expressions, including imaginary ones, so just asking for it to do this integral does not always get us what we want.

(∫_100^x)(100/(t^2))\[DifferentialD]t

we can force it to have the right assumptions...

Simplify[100 Integrate[(1/(t^2)),{t,100,x},Assumptions->{x∈ Reals,x>0}]]

the plot

Show[{Plot[0,{x,-10,99.99}, 
PlotStyle->{Red,Thickness[0.01],Dashing[{.05,.1}]}],
Plot[1-(100/x),{x,100.001,500}, 
PlotStyle->{Red,Thickness[0.01]}] },PlotRange->{{-10,500},{-0.01,1.01}},AxesLabel->{" x ", "F[x] "}, PlotLabel->"Cumulative Distribution Function"]

relate cdf to pdf

some less than perfect graphs with shaded areas

Plot[(100/(x^2)),{x,100,300},Filling->Axis]

Plot[(100/(x^2)),{x,100,300},PlotRange->{{-10,500},{-0.001,.01}},Filling->Axis]

better graphs

Clear[xValue];
xValue=200;

Show[{Plot[0,{x,-10,100}, 
PlotStyle->{Red,Thickness[0.01],Dashing[{.05,.1}]}],
Plot[(100/(x^2)),{x,100,500}, PlotRange->{{-10,500},{-0.001,.01}},
PlotStyle->{Red,Thickness[0.01]}],
Plot[(100/(x^2)),{x,100,xValue},PlotRange->{{-10,500},{-0.001,.01}},Filling->Axis,FillingStyle->Orange]
 },PlotRange->{{-10,500},{-0.001,.01}},AxesLabel->{" x ", "f[x] "}, PlotLabel->"Probability Density Function"]

Clear[cumValue];
cumValue=(1-(100/x))/.{x->xValue}

Show[{Plot[0,{x,-10,100}, 
PlotStyle->{Red,Thickness[0.01],Dashing[{.05,.1}]}],
Plot[1-(100/x),{x,100,500}, 
PlotStyle->{Red,Thickness[0.01]}],
Plot[cumValue,{x,0,500}, 
PlotStyle->{Orange,Thickness[0.01]}] },PlotRange->{{-10,500},{-0.01,1.01}},AxesLabel->{" x ", "F[x] "}, PlotLabel->"Cumulative Distribution Function"]