Application Center - Maplesoft

App Preview:

High School Advanced Topics - The Normal Distribution

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Normal Distribution.mws

High School Modules > Advanced Topics

     The Normal Distribution


The development and use of the normal and standard distributions along with conversions, comparisons, analysis, and plenty of graphics.

[Directions : Execute the Code Resource section first. Although there will be no output immediately, these definitions are used later in this worksheet.]

  0. Code

>    restart;

>    with(plots):

Warning, the name changecoords has been redefined

>    pc := COLOR(RGB, .95,.3,.45):
bc := COLOR(RGB, .45,.3,.95):

>    BinomialPlot  :=  proc(n )
  local f,k,c,n2,d;
  n2 := floor((n+1)/2); if((n mod 2) = 0) then d:= .5; else d:= 0; fi;
  f := k -> binomial(n,k)/2^n;
  #for k from -n2 to n2 do print( f(k)); od;
 
  c := COLOR(RGB, .4, .6, .3 );
  plot( f(floor(x+n2+d)), x =(-n2-d)..(n2+d), filled = true, color = c );
  end proc:

>    StandardPlot  :=  proc()
  local c;
  c := COLOR(RGB, .5,.3,.95);  
  plot( exp(-(x^2)/2)/sqrt(2*Pi), x = -3..3, filled = true, color = bc);
 end proc:

>    fade := proc( a1,a2,a3,k,n)
local c;
c := COLOR(RGB, a1*k/n, a2*k/n, a3*k/n);
return c;
end:

>    StandFPlot := proc()
   local n;
   n := 10;
   display( [seq(
             plot( k*(exp(-(x^2)/2)/sqrt(2*Pi))/n, x = -3..3, filled = true,
             color = fade(.45,.3,1,k,n)), k = 1..n )   
             ] );

end proc:

>    StandDevsPlot  :=  proc()
  local A, c,d, k, f, area;
  f := x -> exp(-(x^2)/2)/sqrt(2*Pi);
  for k from 1 to 6 do
       d := k*.1;
       c := COLOR(RGB, .2 +d,.0 + d,.9);
       A||k := plot( f(x), x = (k-4)..(k-3),
               filled = true, color = c);
       area := evalf(100*int( f(x), x = (k-4)..(k-3)),3);
       T||k := textplot([k-3.5,.3,
               convert(area, string)]);  
  od;
  for k from 0 to 6 do
      B||k := plot([[k-3,0],[k-3,.6]], color = yellow);   od;

  display( [seq(A||k, k =1..6), seq(B||k, k =0..6),seq(T||k, k=1..6)  ] );
  end proc:


>    z_plot := proc(z)
local xvalue, f, p, delta, index, n, area, Left, Right,A,B;

f := x -> exp(-(x^2)/2)/sqrt(2*Pi);
A := plot( f(t), t = -3..z, color = bc, filled = true);
B := plot( f(t), t = z..3,  color = pc, filled = true);
plots[display](A,B);

end:

>    ec := COLOR(RGB, .70, .65,.50):
rc := COLOR(RGB, .38, .31,.28 ):

>    x_plot := proc(x, mean, sd)
local xvalue, f, p, delta, index, n, area, Left, Right,A,B;

f:= u -> exp( -((u-mean)^2)/ (2*sd^2) )/(sd*sqrt(2*Pi));
     
Right := fsolve( f(mean)/100 = f(xvalue), xvalue, mean..((1+mean)*4));
Left := mean - (Right-mean);  
Print(Left, Right);                   
A := plot( f(t), t = Left..x, color = ec, filled = true);
B := plot( f(t), t = x..Right, color = rc, filled = true);
#area := int( f(u), u = x..infinity);
plots[display](A,B);

end:


  1. Binomial to Normal


We're going to assume that you're familiar with the binomial distribution (for p = .50). If we graph the distribution (centered around the origin), we graphs like this.

>    BinomialPlot(5);

[Maple Plot]

>    BinomialPlot(8);

[Maple Plot]

>    BinomialPlot(20);

[Maple Plot]

>    BinomialPlot(50);

[Maple Plot]

>    BinomialPlot(100);

[Maple Plot]



If we can imagine a situation in which there is a binomial distribution for infinite number of coin flips, then this becomes a smooth curve... the normal distribution.

>    N := 10;
s:= sqrt(N/4):
display( [plot( exp(-(x/s)^2)/(s*sqrt(2*Pi)), x = (-N/2)..(N/2), color = black), BinomialPlot(N)]);

N := 10

[Maple Plot]

>    N := 25;
s:= sqrt(N/4):
display( [plot( exp(-(x/s)^2)/(s*sqrt(2*Pi)), x = (-N/2)..(N/2), color = black), BinomialPlot(N)]);

N := 25

[Maple Plot]

>    N := 60;
s:= sqrt(N/4):
display( [plot( exp(-(x/s)^2)/(s*sqrt(2*Pi)), x = (-N/2)..(N/2), color = black), BinomialPlot(N)]);

N := 60

[Maple Plot]




Here is the "famous" standard normal graph! This is the "curve" you've heard so much about - as in "grading on the curve." Its also called the "bell shaped curve."

>    StandardPlot();

[Maple Plot]

>    StandFPlot();

[Maple Plot]


 

  2. Standard Deviations and Area


Please take a look at this graph. Its the normal distribution, and long with standard deviations of -3, -2, -1, 0, 1, 2, and 3 marked off. Also, the percentage of area in each of the regions marked off is given.
 

>    StandDevsPlot();

[Maple Plot]


    1.  How much of the area is within ONE standard deviation of the mean (0)?
    2.  How much of the area is within TWO standard deviations of the mean (0)?
    3.  How much of the area is within THREE standard deviations of the mean (0)?

    4.  How much of the area is GREATER than ONE standard deviations above the mean?
    5.  How much of the area is LESS than ONE standard deviations above the mean?

    6.  How much of the area is GREATER than TWO standard deviations above the mean?
    7.  How much of the area is LESS than TWO standard deviations above the mean?


 

  3. Converting : x to z


Given a data value x, along with the mean, mu, and the standard deviation sigma deviation, its possible to compute the "z score" - the standardized score that x represents.

>    z = (x-mu)/sigma;

z = (x-mu)/sigma



        Example  : x = 720, mu = 600, sigma = 80, find the z-score.

>    z = evalf( (720-600)/80, 3);

z = 1.50



         Example  : x = 8.2, mu =11.1, sigma = 2.36, find the z-score.

>    z = evalf( (8.2-11.1)/2.36, 3);

z = -1.23


 

  4. Converting : z to x


We can also convert in the other direction. Knowing a z-score, along with the mean and standard deviation, we can compute the data value in the original distribution that corresponds to this value.

>    x = mu +z*sigma;

x = mu+z*sigma



        Example  : z = 2.50, mu = 600, sigma = 80, find x.

>    x = 600 + 2.50*80;

x = 800.00



        Example  : z = -0.19, mu =11.1, sigma = 2.36, find x.

>    x = 11.1 + (-.19)*(2.36);

x = 10.6516


 

  5. Comparing a Normal Distribution to a Standard Distribution


There is a duality between x scores , which are part of a normal distribution, and z scores which are values on a standardized normal distribution. We can see this in pictures  :

      Example  :   A data value is 12, where the mean is 10 and the standard deviation, 1.7.

>    x_plot( 12, 10, 1.7);

[Maple Plot]


We can convert this x score to a z score, then plot the z-score.

>    z = evalf( (12 -10)/1.7,5);

z = 1.1765

>    z_plot(1.1765);

[Maple Plot]


The curves look roughly the same - as they should since they are both normal distributions. Furthermore, the shaded regions both occupy the exact same proportion of the area under of their respective graphs.

What is different?  Look at the center of the distributions (10 and 0), and the amount of spread (5 to 15 compared to -3 to 3). In fact, it might be nice to look at both of them on the same set of axes so we can
really  compare them!

>    display(z_plot(1.1765),x_plot( 12, 10, 1.7));

[Maple Plot]


The two areas are the same! One is taller but narrower, and the other is shorter but wider.


     Example  :   A data value is 12, where the mean is 10 and the standard deviation, 1.7.

>    x_plot( 12, 10, 1.7);

[Maple Plot]


We can convert this x score to a z score, then plot the z-score.

>    z = evalf( (12 -10)/1.7,5);

z = 1.1765

>    z_plot(1.1765);

[Maple Plot]


The curves look roughly the same - as they should since they are both normal distributions. Furthermore, the shaded regions both occupy the exact same proportion of the area under of their respective graphs.

What is different?  Look at the center of the distributions (10 and 0), and the amount of spread (5 to 15 compared to -3 to 3). In fact, it might be nice to look at both of them on the same set of axes so we can
really  compare them!

>    display(z_plot(1.1765),x_plot( 12, 10, 1.7));

[Maple Plot]


The two areas are the same! One is taller but narrower, and the other is shorter but wider.


 

  6. Comparing Two Data Sets with Same Standard Deviation



     Example  :   Suppose that there two sets of data with the same standard deviation but a different mean.
                        
Set A  :    x = 7,          mean = 5,        standard deviation = 1.5
                        
Set B  :    x = 14,        mean = 12,      standard deviation =  1.5

>    display( [x_plot( 7, 5, 1.5 ), x_plot( 15, 13, 1.5 ) ]);

[Maple Plot]


Changing the mean, simply shifts the entire graph - but keeps the same shape and height.
 

  7. Comparing Two Data Sets with Same Mean



     Example  :   Suppose that there two sets of data with the same mean, but different standard deviations.
                        
Set A  :    x = 7,          mean = 10,        standard deviation = 1.5
                        
Set B  :    x = 14,        mean =  10,       standard deviation =  3.5

>    display( [  plot( exp( -((x-10)^2)/ (2*1.5^2) )/(1.5*sqrt(2*Pi)),
                  x =3..17,color= black),
            plot( exp( -((x-10)^2)/ (2*3.5^2) )/(3.5*sqrt(2*Pi)),
                  x =3..17,color= black),
                  x_plot( 13, 10, 1.5 ), x_plot( 17, 10, 3.5 ) ] );

[Maple Plot]


When the mean is the same, the center of the distribution is the same, but the differing standard deviations creates a different spread.
 

  8. Comparing Two Data Sets with Same Z Scores



     Example  :   Suppose that there two sets of data
                        
Set A  :    x = 7.88,          mean = 5,        standard deviation = 2
                        
Set B  :    x = 21.76,        mean = 12,      standard deviation = 3.6

>    display( [x_plot( 7.88, 5, 1.6 ), x_plot( 21.76, 16, 3.2 ) ]);

[Maple Plot]


These two x values actually each share the same z-score in their respective distributions!

>    z = evalf( (7.88-5)/ 1.6, 5);
z = evalf( (21.76-16)/3.2, 5);

z = 1.8000

z = 1.8000

>    z_plot(1.8);

[Maple Plot]


Lets see the two data distributions and the standardization on the same graph.

>    display( [z_plot(1.8), x_plot( 7.88, 5, 1.6 ), x_plot( 21.76, 16, 3.2 ) ]);

[Maple Plot]

>   


All three of these areas are the same! They are narrower or wider, taller or shorter, but all three have the same area, and the same shaded area. Actually, its not just these two data distributions .... but ALL distributions with a z score of 1.8 will have different graphs, but all of them, when standardized become the same distribution. This is why standardizing allows us to compare completely different data.


 


          2002 Waterloo Maple Inc & Gregory Moore, all rights reserved.