Wednesday, 30 June 2010

Old Statistics?

Two different approaches to Statistics from about the same time in history came across my desk today. Ron Dirkse sent me the following clip from Mark Twain's "Life on the Mississippi":

In the space of one hundred and seventy-six years the Lower Mississippi has shortened itself two hundred and forty-two miles. That is an average of a trifle over one mile and a third per year. Therefore, any calm person, who is not blind or idiotic, can see that in the Old Oolitic Silurian Period, just a million years ago next November, the Lower Mississippi River was upward of one million three hundred thousand miles long, and stuck out over the Gulf of Mexico like a fishing-rod. And by the same token any person can see that seven hundred and forty-two years from now the Lower Mississippi will be only a mile and three-quarters long, and Cairo and New Orleans will have joined their streets together, and be plodding comfortably along under a single mayor and a mutual board of aldermen. There is something fascinating about science. One gets such wholesale returns of conjecture out of such a trifling investment of fact.


And on the "statpics" blog, Robert W. Jernigan, Professor of Statistics at American University, posted some notes on the First Published Random Walk. Turns out it was by John Venn in 1888, only fourteen years after the first copyrite date of "Life on the Mississippi." And the randomizing device??? The digits of Pi... too bad I didn't get this a day earlier.. 6/28 could be called 2 Pi day.
Here is the image from Venn's classic "The Logic of Chance" :

Sunday, 13 June 2010

What's the Point

When I talked about the vector (or parametric) equations of a line, I failed to touch on one of the common questions from early linear algebra; to find the point where the two lines intersect.

When we have L1 = P + t U and L2 = Q + r V for direction vectors U and V, and point vectors P and Q, the two lines lie in a single plane (and thus intersect) if (P-Q), U, and V are form a dependent system. If there is a point where L1 and L2 are equal, then P + t U=Q + r V.
Reordering this we get (P-t) = rV-tU. This says that if there is a solution, there must be a linear combination of V and U that equals (P-Q) or that the three vectors form a dependent system. Remember back to Alg II when you learned about determinants and recall that if the determinant of a nxn matrix was =0, the system was called a dependent system. And hopefully you knew that meant there was a way to combine multiples of n-1 of the vectors to get the remaining one.

A linear combination of three vectors U, V, and W would be something like aU + bV + cW; and focusing on three space; if three vectors are all independent (they have a non-zero determinant) then you can use a linear combination of the three of them to find any point in three space. But if they are dependent (the determinant is zero) then a linear combination of the three vectors can only generate points on a plane or in extreme cases, on a line.

I will use the following two lines L1: (4,1,5)+t<1, -1, 2> and L2: (8,9,4)+r<2,2,1> to illustrate how to find the intersection.
We first need to know if there is actually an intersection so we construct the matrix with the vectors (P-Q), U, and V.. In this example (P-Q) = 4,8,-1; U= 1,-1, 2; and V= 2,2,1. When we find the determinant it is zero.
This means that P-Q can be written as some linear combination of U and V for appropriate values of t and r.

To find the value of t and r that will produce the linear combination, we set two of the parametric equations equal. For example, 4+t = 8+2r from the first (x) terms and 5+2t = 4+r from the third (z) can be rewritten as the system 2r-t=-4 and r-2t=1. A solution is r=-3, t=-2.

If we insert these into L1: (4,1,5)+t<1, -1, 2> and L2: (8,9,4)+r<2,2,1> we get L1: (4,1,5)-2<1, -1, 2> and L2: (8,9,4)-3<2,2,1>; both yielding the point (2,3,1) for a common point to both lines.

And that is really all there is to finding the intersection of two lines; but the idea also lets you do something a little more complex. You can use it to help find the shortest line segments between two skew lines.

But if instead we had L1=(4,1,5)+t<1, -1, 2>and L2= (3,4,4)+r<2,2,1>, then the determinant of the Matrix formed with vectors (P-Q), U, and V) would have a determinant of -10

which means that there is no linear combination of U and V that will give us P-Q. The
geometrical interpretation is that lines L1 and L2 are skew lines, lines that are not in the same plane.

It is possible to find the two parallel Planes that contain the two lines by using the cross product of the two direction vectors. The cross product of <1, -1, 2> and <2,2,1> is <5, -3, -4> so each plane can be written as 5x - 3y - 4 z = d for some d. The value of d for each line is the dot product of <5, -3, -4> with any point on the respective lines. For example the dot product of <5, -3, -4> and (4,1,5) is -3, so the equation of the plane containing L1 is 5x - 3y - 4 z = -3. Similarly we can find that L2 lies in the plane 5x - 3y - 4 z = -13. If we divide the difference, 10, by the unit vector in the direction <5, -3, -4>, (sqrt(50)), we find the distance between the two planes is sqrt(2). It should be easy to see that this will be the smallest distance between any two points on the respective lines.

To find the endpoints of this shortest segment between L1 and L2, we can imagine moving them onto the same plane and finding the point of intersection, and then use that intersection to find the points on the original lines.

To move the point (3,4,4) on L2 some number of units perpendicular to the two planes, we create the values (x,y,z)= (3,4,4)+s<5, -3, -4>

If this point is to be on the plane 5x - 3y - 4 z = -3 which L1 is on, it must be true that 5(3+5s) -3(4-3s) - 4(4-4s) = -3. This will simplify to 15 + 25 s - 12 + 16s -16 + 16s = -3 or 50 s = 10.

So s=1/5 and the new equation for L1 on the same plane as L2 is (x,y,z)= (3,4,4)+1/5 <5, -3, -4> + r<2,2,1> . That can be simplified down to (x,y,z)= (4, 3.4, 3.2)+r(2,2,1). Solving for the values of r and t that give an intersection we get 4+2r = 4+t so t=2r from the x(t) relations of the two lines.. and from z(t) we get 3.2+r = 5+2t and substituting t=2r; 3.2+r = 5+4r so 3r=-1.8 or r= -.6 and t=-1.2

The point of intersection in this common plane is (4, 3.4, 3.2) -.6<2,2,1>= (2.8,2.2, 2.6) and checking to be sure...(4,1,5)-1.2<1, -1, 2>=(2.8,2.2, 2.6), so all appears well.


Now we can apply these same parametric values (r=-.6 and t=-1.2) to find the end points on the original lines at (4,1,5)-1.2<1, -1, 2> = (2.8,2.2, 2.6) on the plane containing L1 and and (3,4,4)-.6<2,2,1>= (1.8, 2.8, 3.4). Just one last check to make sure that these are indeed a distance of sqrt(2) apart, we take the dot-product of the vector from one point to the other <2.8-2, 2.2-2.8, 2.6-3.4> and indeed we get a dot product of 2.

Friday, 11 June 2010

Conics with Vectors

Almost every Alg II class in America ( and most geometry classes) contains problems such as "Write the equation of a circle with a radius of 5 and a center at (3,1)." The assumption is that the circle lies in the x-y plane.

I stood in an Alg II classroom recently as students worked through a worksheet of such problems and wondered how hard it would be to extend this idea to write the equation of a circle with a given radius and center in ANY plane. The response is that it should be amazingly easy if we are familiar with the simpler ideas of using vectors.

The first step would be to develop the vector equivalent of the standard circle
equation, something like (x,y) = (h, k) + r cos(t) (1,0) + r sin(t) (0,1) where t has a domain from 0 to 2 Pi (or the equivalent in degrees). Then in any other plane, all that would be needed would be to replace the two unit vectors in the x and y direction with two perpendicular unit vectors in the desired plane.

Since each of the desired vectors would be perpendicular to each other and the normal to the plane we could pick one arbitrarily, then find the second using the cross product of the first with the normal to the plane.

Here is an example: " Find the circle with radius 5 and center at (3,1,2) in the plane x + y + 2z = 8. " Any vector perpendicular to (1,1,2) will work for the first direction vector, so (2,0,-1) is an easy choice. The cross product of (1,1,2) and (2,0,-1) will then be perpendicular to (2,0,-1) and lie in the desired plane. The cross product gives (1,-5, 2) for the perpendicular direction vector. Now we just write the equation using unit vectors in the directions of (2,0,-1) and (1,-5, 2). The equation for the circle requested is (x,y,z) = (3,1,2) + 5 cos(t) (2,0,-1)/sqrt(5) + 5 sin(t) (1,-5,2)/sqrt(30).

Checking that a given value of t meets all the requested, I pick pi/6 as an easy
choice. The point will be (x,y,z) = (3,1,2) + 5 sqrt(3)/2(2,0,-1)/sqrt(5) + (5/2)(1,-5,2)/sqrt(30). So x=7.3294 (appx) and y=-1.2822 and z= 0.9764.

If we are close this point should lie in the correct plane, and also be five units from the center, (3,1,2).

One more thing that starts to happen when you use vectors and write an equation in the x-y plane, such as a circle, is that you begin to imagine pulling it out in the z-direction. If you do this as a function of t, then you create a helix that coils around the z-axis as it climbs. A unit circle climbing at a rate of t/pi will climb one unit up the z-axis for each half turn of the circle. Using the equations x,y,z= cos(t)(1,0,0) + sin(t) (0,1,0) + t/pi (0,0,1) is an example.


Other conics: It is simple to extend the circle to an ellipse by just replacing the radius in the appropriate places with the semi-major/minor axis lengths, a and b. The Ellipse centered at (3,1) with a=5, b=4 would be (x,y) = (3, 1) + 5 cos(t) (1,0) + 4 sin(t) (0,1).

As with quadratics, it is easy to write the ellipse rotated to lie along any line through the center. For example, if we wanted to rotate the ellipse above so that it made a 45 degree angle, we simply replace the two unit vectors in the x and y direction with unit vectors [sqr(2)/2, sqr(2)/2] and [-sqr(2)/2, sqr(2)/2].
Using decimal approximations for ease of writing, the equation becomes (x,y) = (3, 1) + 5 cos(t) (.707, .707) + 4 sin(t) (-.707,.707). The Winplot graph looks like this:


For fans of Geogebra, you can download a ggb sketch that will allow you to rotate a conic through any radian value.

For the hyperbola, simply replace the cosine and sine with tangent and secant (or secant and tangent to have the two branches open the other way).

Thursday, 10 June 2010

Vector Topics for Quadratic Equations

Revising and editing some old posts(2010).  As always, your comments are desired.


A freshman student in my seminar (think study hall) was trying to struggle through understanding the early introduction to quadratics and their graphs in Alg I. After helping( I hope) a little I started thinking about how I might approach quadratics in a vector enriched course.

Let's pick a simple example and use it to transform and illustrate the work  as we go, y = x^2 -5x - 6   .

The first easy thing is to abandon the y=Ax2 + Bx + C approach for the vertex form. The equation y=A(x-h)2 + k can be easily transformed into the vector form (x,y) = (h, k) + (t, At2 ) , but in thinking about extending the power of this model, I thought it better to write it as (x,y) = (h, k) + t(1,0) + At2 (0,1). At first this seems an insignificant change, even making it more complex, but whether this was done immediately, or somewhat later in the sequence, as I will try to show, there are advantages to having a pair of perpendicular unit vectors in the equation.
So in vertex form, we write our sample equation as \( y=(x-5/2)^2 - 1/4 \).  The vector form is (x,y) = (5/2, -1/4) + (t,t^2) , with the extended form of (x,y) = (5/2, -1/4) +t(1,0) + t^2 (0,1) . ( I think students could make this translation quickly because it is similar to the elements of the basic quadratic equation form.)


The first obvious advantage is that transformations no longer have the confusing sign reversal in translation of a graph (“to move the vertex three to the right, you replace x with x-3”). To move the graph to the right, simply increase the value of h, the x-coordinate of the vertex.

What about the other things we normally do with quadratics? To solve y=0 or find roots we still want to find where y=0, so k+At2 = 0. If we confine ourselves to dealing only with quadratics that are functions of y in terms of x, then the entire section on quadratic equations and completing the square (except for their historical interest and geometric interest) is now resolved by the simple two steps of setting and then finding the values of x from x=h+/-t. For reasons that will be more obvious later, however, we still need to develop the traditional approaches to solving quadratics.
Notice how separating the  x and y components of the vector make this easy.  With our example case, we set \( t= \sqrt \frac{1/4}{1} = 1/2.  
evaluating  (x,y) = (5/2, -1/4) +1/2(1,0) + (1/2)^2 (0,1) = (5/2, -1/4) +(1/2,0) + (0,1/4)= (3,0).  By symmetry we know the other zero is (2,0).  

It would seem that a little more time and emphasis on converting the general y=Ax2 + Bx + C form to the vertex form would be essential, but the savings in other areas and the increase in understanding would seem obvious.

To find values of y as a function of x, the simple expedient of solving for t makes the mysterious reversal of sign for transformations in the old form seem obvious. We change x=h+t into t=x-h; and then evaluate y=k+A(x-h)2 just as we always have. Perhaps the exception to “as we always did” is that a student now understands a little better what s/he is doing.

So what can we do we couldn’t do before? Suppose we now want to write the equation of a parabola that is not expressible as y=f(x). As a simple example, I will show how to easily write the equation of a parabola with a standard curvature (A=1) with a vertex at (2, -3) an the axis of symmetry rotated 45o.

It is for this problem that I think the three part, (x,y) = (h, k) + t(1,0) + At^2(0,1), model is needed. All we need to do is replace the two unit vectors in the x and y directions with the appropriate unit vectors. Since the axis is rotated 45o, we need the old x-axis to go in the (1,1) direction. The unit vector in that direction is and the perpendicular to that would be . We simply fill in the appropriate values for the vertex and the equation is . The graph, using the parametric form in Winplot, looks like this:



To find a point of specific interest, say the x-intercepts, we can solve for t as before. Setting y = 0 we have we have a typical quadratic to solve for the two values of t, we get approximate values of –2.619 and 1.169. Then to find x we evaluate for these values of t with approximate results of x = 1.29 and x = -4.702. Solving quadratics in the traditional form will not go away.

With very little extra effort on the student’s part the student can extend this to drawing a quadratic embedded along any line in the plane, at any point. I will try to develop that in the next section of these vector blogs.