Math Moments – What do Dot Products Mean?

We have seen the power of the dot products between two direction vectors.  We have shown that the dot product between two perpendicular directions is zero.  We will review this in two dimensions, because it is easier to see. Using our head reference the nose direction in 2-D is N:(Dx, Dy) and the Left ear direction is L: (-Dy, Dx):

   N.N = (Dx, Dy).(Dx, Dy) = Dx2 + Dy2 = 1
   N.L = (Dx, Dy).(-Dy, Dx) = -Dx*Dy + Dy*Dx = 0

We have also seen that we can travel to any point in 2-D (x, y) by traveling in the N direction a distance SN and then turning left and traveling in the perpendicular L direction another distance SL:

    (x, y) = N*SN + L*SL

And then we used the power of the direction dot products to see what happens when we dot these direction vectors with any point (x, y) in the 2-D space:

   N.(x, y) = N.(N*SN + L*SL) = N.N*SN + N.L*SL = 1*SN + 0*SL
                  = SN

    L.(x, y) = L.(N*SN + L*SL) = L.N*SN + L.L*SL = 0*SN + 1*SL
                 = SL

Written in concise dot product notation:

      [N, L].(x, y) = (SN, SL)

This means that dotting these “head direction vectors” (N, L) with any point gives you back the coordinates of the point in the “head frame of reference” (SN, SL), the distance traveled in the Nose direction and the distance traveled in the Left direction to arrive at the point.  From the last post, in 3-D, we saw that SN is the distance from the Nose to the perpendicular View Plane where the point lives.

We can conclude that in any dimension, if we dot the Nose direction (N) with any point we get back the “nose coordinate” in the “nose frame of reference” (SN):

     N.(any point) = SN

It might take a few moments of thought for this to sink in, but when it does, we start to realize that we can convert any point into the “nose frame of reference” no matter where our nose is pointing.  It is like rotating the reference frame into any direction we want and converting the coordinates into this “nose frame of reference”.

We might ask what happens when we dot two direction vectors together that are not perpendicular.  Suppose we have two Nose directions (N1 and N2) in 2-D:

   N1 = (Dx1, Dy1)
   N2 = (Dx2, Dy2)

Since any point (x, y) can be expressed in the N1 frame of reference, (Dx2, Dy2) can also be written in the N1 frame:

  (x, y) = N1*SN + L1*SL
  N2 = (Dx2, Dy2) = N1*SN + L1*SL

Refer to the diagram above for clarification.  Now we can easily see what happens when we dot N1.N2:

    N1.N2 = N1.(N1*SN + L1*SL) = N1.N1*SN + N1.L1*SL
               = SN

Now from the diagram we also can see that SN is just the Cos(A) because the length of N2 is 1, where A is the angle between the two directions:

   N1.N2 = Cos(A)

So, when we dot two direction vectors together, we get the Cosine of the angle between them.  This is consistent with what we have seen, because when the two directions are the same, A = 0 degrees, and when they are perpendicular, A = 90 degrees. Cos(o) = 1 and Cos(90) = 0 this is consistent with what we have shown when dotting direction vectors together so far.

   I have earned some good money from knowing this.  On one occasion, a ship captain wanted me to find the distance between two points in the ocean given the longitude and latitude of each point.  Recall that the longitude and latitude is the same as the “head direction” as seen from the center of the earth. (Axy1, Az1 and Axy2, Az2).

I realized that if I could find the angle between these two “head” directions (A), I could find the distance between the two points along the surface of the earth.  Since I know that the circumference of the earth (CE), the distance between the points is CE*(A/360).  I found N1 (the direction vector to the first point) and N2 the direction to the second point, dotted them together to find the angle: N1.N2 = Cos(A), and took home a large check (he still uses it to navigate).  Could you fill in the details?

Standard

Math Moments – How to Project 3-D on a 2-D Flatscreen

No matter where we turn our head in our 3-D world, we see the world projected on the 2-D “screen” in the back of our eyes.  These days, flat screens and cell phones are everywhere, they can display 2-D images on a flat surface that our brain interprets as being projections into a 3-D world.  From the last post, we are now equipped with math language to describe how this projection works.

We can imagine that everything we see in front of our face is displayed on a big flat screen that is always a certain fixed distance in front of our nose and moves around with our head (it could be transparent).  Let’s call this screen the “View Plane” and say that it is always placed a fixed distance (SV) perpendicular to our Nose direction (N).  This is not hard to imagine, I see lots of people carrying their cell phones around like this in front of their face all the time.

Your personal reference point (0, 0, 0), the origin, is always between your ears, the Nose direction (N), always points straight out in front of your face, the Left Ear direction (L) always points in the direction of your left ear, and the Top of head direction (T) always points through the top of your head.  This personal reference frame moves as you change the orientation of your head.

Since the View Plane in front of you is 2-D, every point on this screen can be located on a 2-D “xv-yv plane”.  Let’s draw such Cartesian coordinates on our View Plane. We choose the origin of the View Plane (0, 0) to be where our Nose direction (N) passes through the plane. We can choose the xv-axis on the plane to point to the right (opposite the L direction), and then the yv-axis would point in the Top of Head direction (T).

A single point (pixel) on this 2-D view screen (xv, yv), with a color (cv), can also be located in the 3-D world.  Start at the origin (0, 0, 0), the middle of your head, then travel a distance Sv in the N direction to arrive at the origin of the View Plane (0, 0), then from there travel along the xv-axis (in the negative L direction) a distance xv, and then along the yv-axis (in the T direction) a distance yv.  From our orienteering days, we already know how find this 3-D point in math language:

    (x, y, z) = N*Sv + (-L)*xv + T*yv
                   = [N, L, T].(Sv,-xv,yv)

And so, we can find the 3-D coordinates for any point on the 2-D View screen (xv, yv) when we know the distance to the view screen (Sv) and the orientation of the head (N).  In review, the middle of the head is always at the origin (0, 0, 0) and you are looking in the Nose direction N:(Dx, Dy, Dz) in the 3-D world, the direction vectors of the head reference frame are:

         N = (Dx, Dy, Dz)
         L = (-Dy/Dr, Dx/Dr, 0)
         T = (-Dx*Dz/Dr, -Dy*Dz/Dr, Dr)

         Dr2 = Dx2 + Dy2

In the Cartesian frame of the 3-D world around us the orientation of our head can be determined by two angles (Axy and Az).  As you remember, Axy is the angle we have rotated our head left or right in the x-axis in the x-y plane, and Az is the angle that we have tilted our head up or down off the x-y plane.  In review, the direction vector of the head is found from the following:

       Dx = Cos(Axy)*Cos(Az)
       Dy = Sin(Axy)*Cos(Az)
       Dz = Sin(Az)

The dot products of the [N, L, T] head reference vectors are:

   N.N = L.L = T.T = 1
   N.L = N.T = L.T = 0

since they are all perpendicular to each other.
We also find that:

     N.(x, y, z) = N.( N*Sv + L*(-xv) + T*yv )
                        = N.N*Sv + N.L*(-xv) + N.T*yv
                        = 1*Sv + 0*(-xv) + 0*yv
                        = Sv

     L.(x, y, z) = L.( N*Sv + L*(-xv) + T*yv )
                        = L.N*Sv + L.L*(-xv) + L.T*yv
                        = 0*Sv + 1*(-xv) + 0*yv
                        = -xv

     T.(x, y, z) = T.( N*Sv + L*(-xv) + T*yv )
                        = T.N*Sv + T.L*(-xv) + T.T*yv
                        = 0*Sv + 0*(-xv) + 1*yv
                        = yv

Another way of writing these stacked equations with dot products is simply:

      [N, L, T].(x, y, z) = (Sv, -xv, yv)

So, we can see that with this miracle matrix [N, L, T] can map a point in 3-D space onto a point (xv, yv) on a View Plane that is a distance Sv away.

Let’s finish this idea off.  Suppose we have any point in 3-D space (x, y, z), then

[N, L, T].(x, y, z) = (SN, -xN, yN)

maps (x, y, z) onto a point (xN, yN) on 2-D view plane that is a distance SN away from your nose.  Using simple geometry, this point can be mapped onto a point (xv, yv) in any parallel View Plane that is a distance Sv away by using:

    (xv, yv) = (xN, yN)*Sv/SN

And so, we can map a 3-D world onto a 2-D view plane.  Our brain perceives these 2-D images from colored points (pixels) from our flat screens as 3-D images.

Standard

Math Moments – Navigating in 3-D Space

We can navigate in 3-D to any point (xR, yR, zR), in Cartesian Coordinates, by starting at the origin (0, 0, 0) and in the 2-D, x-y plane, walking in the x-direction (1, 0, 0) a distance xR, then turning left 90 degrees and walking a distance yR in the y-direction (0, 1, 0), still on the x-y plane.  This is the same as we did in 2-D except we put an extra ‘0’ in the third ‘z’ direction.  At this point we are still on the x-y plane at the point (xR, yR, 0).  The z-direction is straight up, so we would now need a ladder to climb up or a shovel to dig down, it is helpful to pretend we can fly (or dig).  From this point (xR, yR, 0) on the x-y “ground” plane, we fly straight up in the z-direction (0, 0, 1) a distance zR, and we successfully arrive at the point (xR, yR, zR).

We can express this journey with vectors, as we did in 2-D, by connecting (adding) lines together to form the path:

   (xR, yR, zR) = (1, 0, 0)*xR + (0, 1, 0)*yR + (0, 0, 1)*zR
                        = (xR, 0, 0) + (0, yR, 0) + (0, 0, zR)
                        = (xR, yR, zR)

        And using dot product notation, this can be written:

   (xR, yR, zR) = (1, 0, 0)*xR + (0, 1, 0)*yR + (0, 0, 1)*zR
                        = [(1, 0, 0), (0, 1, 0), (0, 0, 1)].(xR, yR, zR)

The [(1, 0, 0), (0, 1, 0), (0, 0, 1)] matrix is called the identity matrix.

We could also arrive faster by flying along a straight line connecting the two. Fly along a direction (Dx, Dy, Dz), from the origin directly to this point, (xR, yR, zR) a distance “R” away:

   (xR, yR, zR) = (Dx, Dy, Dz)*R

        Where the distance ‘R’ is found by:

    R2 = xR2 + yR2 + zR2

From the equation above for this line, we can easily find the direction vector from the origin to any point (xR, yR, zR), similar to what we did in 2-D.

      (Dx, Dy, Dz) = (xR/R, yR/R, zR/R)

Recall that the direction vector always has a distance of 1 unit, as seen in the diagram above.  In the diagram, we have attempted to show a 3-D path on a 2-D piece of paper.  Note that in the diagram, Dr is the distance from the origin to the point (Dx, Dy, 0) in the x-y plane. From the Pythagorean theorem, we find that the length:

      Dr2 = Dx2 + Dy2    and
      Dr2 + Dz2 = 1        thus combining these
      Dx2 + Dy2 + Dz2 = 1.

The total length of the distance vector is 1 unit, as required.  Everything is consistent.  Now we use the definition of the ‘Sin’ and ‘Cos’ and can see, from the diagram above, that:

     Cos(Axy) = Dx/Dr
     Sin(Axy) = Dy/Dr

      Cos(Az) = Dr/1
      Sin(Az) = Dz/1

    Thus

       Dx = Cos(Axy)*Dr = Cos(Axy)*Cos(Az)
       Dy = Sin(Axy)*Dr = Sin(Axy)*Cos(Az)
       Dz = Sin(Az)

And so, if we stand at the origin facing in the x-direction, and rotate our “head” an angle Axy to the left, and then tilt our head an angle Az off the x-y plane to look directly at the point (xR, yR, zR), we can find the direction vector pointing to this point using these angles:

   (Dx, Dy, Dz) = (Cos(Axy)*Cos(Az), Sin(Axy)*Cos(Az), Sin(Az))

       And then draw the line to this point:

    (xR, yR, zR) = (Dx, Dy, Dz)*R

Now that we are staring at a point in the sky, with our nose pointed directly at the point, we can ask about “reference frame” of our head.  What direction is our left ear pointing, for example.  Our left ear is pointing in the direction, still in the x-y plane, that is 90 to the left of the Axy angle we rotated our head (-Dy/Dr, Dx/Dr, 0). We divide by Dr because in 3-D we must make the length of the direction vector equal to 1.  If this seems vague, look back and review how to find 90 degree directions in the 2-D plane in the top diagram taken from previous posts.

When we tilt our head, we can ask what is the direction that the top of our head points, 90 degrees up from the angle Az. It perhaps takes a bit more imagination to see this, since we are facing in the x-y plane (Dx/Dr, Dy/Dr, 0) and have tilted our head up to look at Dz, we find that the “shadow” of our head is pointed behind us, in the x-y plane (-Dx/Dr, -Dy/Dr, 0), then looking at the elevation Dr (when rotated 90 degrees) we find that (-Dx*Dz/Dr, -Dy*Dz/Dr, Dr) is the direction of the top of our head.  So, in the reference frame of our head:

     Direction of our Nose:     (Dx, Dy, Dz)
     Direction of Left ear:         (-Dy/Dr, Dx/Dr, 0)
     Direction of Top of head:  (-Dx*Dz/Dr, -Dy*Dz/Dr, Dr)

Let us verify that these direction vectors all have a length of 1.  The Nose direction we have verified.  For the Left ear direction:

    L.L = (-Dy/Dr)2 + (Dx/Dr)2 + 02 = (Dy2 + Dx2)/Dr2 = 1

For the Top of head direction:

    T.T = (-Dx*Dz/Dr)2 + (-Dy*Dz/Dr)2 + Dr2 = (Dy2 + Dx2)*Dz2/Dr2 + Dr2
                                                                    = Dz2 + Dr2 = 1

Now let’s find what happens when we find the dot product of these direction vectors, we will call them the N, L, and T directions respectively.

N.N = (Dx, Dy, Dz).(Dx, Dy, Dz) = Dx2 + Dy2 + Dz2 = 1

N.L = (Dx, Dy, Dz).(-Dy/Dr, Dx/Dr, 0) = -Dx*Dy/Dr + Dy*Dx/Dr + 0
                                                                  = 0

N.T = (Dx, Dy, Dz).(-Dx*Dz/Dr, -Dy*Dz/Dr, Dr)
        = -Dx2*Dz/Dr + -Dy2*Dz/Dr + Dz*Dr
        = -(Dx2 + Dy2)*Dz/Dr + Dz*Dr
        = -Dr2*Dz/Dr + Dz*Dr
        = 0

L.T = (-Dy/Dr, Dx/Dr, 0).( -Dx*Dz/Dr, -Dy*Dz/Dr, Dr)
       = Dy*Dx*Dz/Dr2 + -Dx*Dy*Dz/Dr2 + 0
       = 0

We also verified that L.L = 1 and T.T = 1 above.  So, in general, if we dot any of these N, L, T direction vectors with themselves, we get ‘1’, but if we dot any of them with each other, we get ‘0’.  It turns out that this is a requirement for any three perpendicular direction vectors in a 3-D Cartesian reference frame.  I find the “head” reference frame to be more natural because we can relate to it better, so I use this reference frame for whatever direction I am looking.  It is also a great reference frame for video games.

We have already seen from perpendicular 2-D paths how we can convert between a reference frame to our “ground” x-y-z reference frame.  To understand this, let’s take a journey: Fly in the Nose direction a distance SN, then fly in the Left ear direction a distance SL, and then in the Top of head direction a distance ST.  Then we will arrive at the point:

    (x, y, z) = N*SN + L*SL + T*ST

       or in dot product notation:

     (x, y, z) = [N, L, T].(SN, SL, ST)

This amazing equation lets you convert any point in your “head frame” of reference (SN, SL, ST), when your Nose is pointing in a direction N:(Dx, Dy, Dz), to a point in the “ground” frame (x, y, z).  You might also want to do this the other way around.  Review how we did this in 2-D, by “dotting” each side by each of the direction vectors, we get:

    (SN, SL, ST) = [N, L, T].(x, y, z)

This is how video games convert a 3-D world, stored in “ground” (x, y, z) coordinates, into the perspective of the viewer’s head (SN, SL, ST) coordinates.  The details need to be worked out but using this equation we can map a 3-D world onto a 2-D screen in the viewer’s perspective, no matter the relative direction of the viewer’s head.  We will stop here, there is a lot to take in.

Standard

Math Moments – Review and 3-Dimensional Expansion

All the concepts that we have discussed so far can be expanded into new dimensions.  We have only been looking at two dimensions so far, and yet we live in a world of 3 physical dimensions.  Although mathematically we don’t have to stop at 3 dimensions, we could expand the same concepts to work in as many dimensions as we want. First, let’s start by generating a 3-dimensional space from the 2-dimensional space we have been working in.

Do you remember how we generated new dimensions? Look back to the expanding dimensions post to refresh your memory. Take the 2-dimensional x-y plane where we have been working and find a point “P” that is NOT in it.  Now imagine line segments between every point in our 2-D space (x-y plane) and the new point P.  Find the point on the x-y plane (2-D space) that forms the line segment with the shortest distance to P and label it “O”.   Call this minimal distance “r”.

We can choose the point O to be the origin on the x-y plane and pick an x-direction for the x axis, which also determines the direction for the y-axis.  We can now use the same diagram above, the same procedure (and a bit of imagination) to generate a 3-D space from a 2-D space with one observation. In our original 1-D space there were only two directions from the point O, negative (O-) and positive (O+).  In the 2-D space, there are an infinite number of directions pointing away from the point O, and each direction is indistinguishable from any other direction.

We can use this rotational symmetry to generate our 3-D space.  Imagine that you printed the diagram above and on a sheet of paper and placed it so that the point O is on the origin of the x-y plane, the point P (the new point) is above the x-y plane, and make the x-axis go through the O+ point.  The sheet (plane) of our diagram would now be perpendicular (vertical) to the x-y plane.  The same argument holds that since the O-P segment is the shortest one that connects the x-y plane it is an axis of symmetry.

We call this new O-P direction the “z” axis.  Now imagine rotating this diagram around the z axis.  The O+ point would trace out a circle on the x-y plane, and touch every point on the plane that is a distance “r” from point O.  The distance from every one of these points on this circle would also be the same distance from P.  The segments P-O+ would sweep out the surface of a cone as we rotated the diagram around the z axis, and parallel lines would sweep out parallel planes along the z axis. We can rotate our sheet of paper around the z-axis to any angle and the cross section would still remain the same. Can you see it?

We can use the same trick as before, we can imagine that these parallel planes are mirrors facing each other that will reflect an infinite array of parallel planes to the x-y plane along the z axis, thanks to reflection symmetries.  We can also make an infinite set of parallel planes along the x axis, and along the y-axis by processes similar to those we did before in 2-D to make a cartesian “grid” of planes and fill in all the gaps.

Note that the line segment O-P does not move when we rotate the diagram around it.  It is stationary under rotation.  Now we have fully leveraged the rotational and reflectional symmetries of 3-D space.  We can pick any axis of rotation (a line), rotate the universe around it, and the universe will remain unchanged, only our vantage point changes.

As always, we can pick any point in 3-D space to be the reference point (origin). And any 2 perpendicular directions (an x and y axis) can be chosen to define a 2-D plane, and the third direction (z axis) perpendicular to this x-y plane is determined. These three directions define how we write points in this new 3-D space.

In cartesian coordinates,  the vector (x, y, z) can label every point and (Dx, Dy, Dz) can label every direction.

Lines in 3-D space can be defined by:

   (x, y, z) = (x0, y0, z0) + (Dx, Dy, Dz)*S

Where (x0, y0, z0) is the point of origin for the line, (Dx, Dy, Dz) is the direction of the line, and “S” is the distance along the line from the origin.  At this point, this notation should not be difficult or surprising.  The above is also an equation for a sphere if you hold S constant to be the radius and vary the direction.

There might be some questions on how you can determine directions in 3-D space. Similar to 2-D space, the direction vector always has a length of 1 unit:

    Dx2 + Dy2 + Dz2 = 1

A natural way to determine directions is by using your head.  Stand facing North (the x-axis), now rotate your head an angle “Axy” to the left (West towards the y-axis).  You can determine every direction on the x-y plane with this angle Axy (between -180 and 180 degrees).  Now tip your head up an angle “Az” off the x-y plane (between -90 and 90 degrees).  Varying these two angles, you can now look in any direction possible in 3-D space.

This is also how we locate positions on the spherical surface of the earth.  We place an imaginary observer in the middle of the earth and have it “face” 0 degrees longitude and 0 degrees latitude (the x-axis).  The Axy angles are degrees of longitude as the observer rotates its head around the north pole (z-axis), and the Az are degrees of latitude as the observer tips its head up and down.  Using this scheme the observer can look at any place on the surface of the earth given a longitude (Axy) and latitude (Az).

Standard

Math Moments – The Rotation Matrix

On the Cartesian plane, if we walk along the x-direction (1, 0) for a distance of 4 units, then turn left 90 degrees (perpendicular) and walk a distance of 3 units, we arrive at the point (4, 3), which is a distance of 5 units from the origin (42 + 32 = 52), great.  Well, what happens if we do the same, but start off walking in any direction (Dx, Dy) 4 units and then turn left 90 degrees (-Dy, Dx) and walk 3 units; we are still 5 units from the origin.  We have just “rotated” the whole path to a new direction.  Where would we end up (x, y)?  We use our orienteering skills:

     (x, y) = (Dx, Dy)*4 + (-Dy, Dx)*3
     (x, y) = [(Dx, Dy), (-Dy, Dx)].(4, 3)  –  using the dot product

Now notice that the matrix [(Dx, Dy), (-Dy, Dx)] when dotted with the cartesian point (4, 3) rotates it to another point on the circle (radius 5).  See the diagram. This matrix is called the “rotation matrix”.

Now that we are getting a bit more comfortable with the dot product, let’s play around and see what happens when we dot direction vectors with each other?  We’ll start off by dotting a direction with itself:

     (Dx, Dy).(Dx, Dy) = Dx2 + Dy2 = 1

Any direction dotted with itself is just “1”.  What about dotting a direction with its perpendicular direction?

    (Dx, Dy).(-Dy, Dx) = Dx*(-Dy) + Dy*Dx = 0

It turns out that any direction dotted with its perpendicular direction is “0”.  Now how about dotting the position (x, y) above with the direction vector?

   (Dx, Dy).(x, y) = (Dx, Dy).((Dx, Dy)*4 + (-Dy, Dx)*3)
                             = (Dx, Dy).(Dx, Dy)*4 + (Dx, Dy).(-Dy, Dx)*3
                             = 1*4 + 0*3
                             = 4

And so, dotting a direction vector (Dx, Dy) with any position vector (x, y) gives you the distance (Sx) you would have to travel in that direction before making a 90 turn and traveling the distance (Sy) that would bring you to the position (x, y).  Now let’s dot the perpendicular direction with the position vector:

   (-Dy, Dx).(x, y) = (-Dy, Dx).((Dx, Dy)*4 + (-Dy, Dx)*3)
                             = (-Dy, Dx).(Dx, Dy)*4 + (-Dy, Dx).(-Dy, Dx)*3
                             = 0*4 + 1*3
                             = 3

You can see that dotting the perpendicular direction with a position also gives you the distance (Sy) you would have to travel in the perpendicular direction (-Dy, Dx) to get to the position (x, y).

And so can you see that in this case:

     [(Dx, Dy), (-Dy, Dx)].(x, y) = (4, 3)

So in general if

     (x, y) = [(Dx, Dy), (-Dy, Dx)].(Sx, Sy)

              then

     [(Dx, Dy), (-Dy, Dx)].(x, y) = (Sx, Sy)

What does this mean?  The rotation matrix […] when it “operates” on (is dotted with) any point (x, y), gives you the coordinates of the point relative to a new set of “x-y” axis that is pointing in a direction (Dx, Dy) relative to the old axis.  Or you can say that it rotates the point around the origin.  Either vantage point is valid, you can rotate the point around the origin or rotate the reference frame in the opposite way around the origin; either way, it is describing the same thing.

Remember the concept of “rotational symmetry”, that we can pick the direction of the x-y axis to be in any direction we want.  Now we have the tools to convert the cartesian coordinates of a set of points from any reference frame to a reference frame pointing in any direction we choose.

THIS IS A FUNDAMENTAL CONCEPT of the MATH Language: ROTATIONAL SYMMETRY means that the universe is the same no matter the direction of your frame of reference.  The Rotation matrix gives you a way of describing the same universe from any prospective of direction.  It is pure magic.

One more point, remember that

   (Dx, Dy) = (Cos(A), Sin(A))

Where “A” is the angle of the direction off x-axis.  Thus, the rotation matrix “R(A)” can be written as:

     R(A) = [(Cos(A), Sin(A)), (-Sin(A), Cos(A))]

And there you have it.

Standard

Math Moments – Using Vectors in Orienteering

Soldiers and airplanes in unfamiliar places need to find their way around. They can do this with methods similar to what we have already discussed.  They receive instructions to go first in a certain direction (Dx1, Dy1) for a certain distance S1, and then to change course to another direction (Dx2, Dy2) and keep going for a distance S2.  This same pattern can be followed for many different directions and distances. This discipline is called orienteering.  Soldiers are trained to find directions with their compasses and measure distances with the number of steps they take.

With our new vector notation, we can say the same thing in math language:

     (x, y) = (Dx1, Dy1)*S1 + (Dx2, Dy2)*S2

Which says that the point of our destination (x, y) can be found by going in the direction (Dx1, Dy1) for a distance (S1) and then going a direction (Dx2, Dy2) for a distance (S2).  Notice that to find our destination (x, y), we just add these two vectors together.  It is just like piecing together lines to form a path.

Any destination (x, y) is determined by just adding together all the lines (vectors) that form the path in between.  In the example above, there were only 2 directions and distances (lines), but we could keep on going for as many vectors as we want, adding on lines, one line after another until we arrive at our destination.

It is helpful to define yet another notation that is even more compact.

     (x, y) = (Dx1, Dy1)*S1 + (Dx2, Dy2)*S2

   can be written

     (x, y) = [(Dx1, Dy1), (Dx2, Dy2)] . (S1, S2)

The dot “.” between the two vectors is called a “dot product”.  In the case above the dot product means you multiply the first direction vector in the square brackets [1,2] with the first distance in the round brackets (1,2) and do the same with the second direction vector and second distance and then add them both together.

This new notation might seem a bit mysterious at first, but it does make things clearer later on.  The dot product is one of the most fundamental operations of “linear algebra” which is the math that tells you where you end up when adding together a bunch of lines (vectors) to form a path.

We do something similar to write the (x, y) coordinates of a point in our cartesian plane.  Let’s look at the point (3, 4), we can get there by walking along the x-direction 3 units, then turning left 90 degrees and walking in the y-direction 4 units:

    x-direction: (Dx1, Dy1) = (1, 0)
    y-direction: (Dx2, Dy2) = (0, 1)

Then using the “dot product” notation we discussed above:

    (x, y) = [(Dx1, Dy1), (Dx2, Dy2)].(S1, S2)

    (x, y) = [(1, 0), (0, 1)].(3, 4)
               = (1, 0)*3 + (0, 1)*4
               = (3, 0) + (0, 4)
               = (3+0, 0+4)
               = (3, 4)

We find that we end up at the point (3, 4).  This is also one way in the cartesian coordinates that we can define the location of a point.  So, the [(1, 0), (0, 1)] vector when “dotted” with any two distances (Sx, Sy) brings you to the point (x, y) = (Sx, Sy).

     (x, y) = [(1, 0), (0, 1)].(Sx, Sy) = (Sx, Sy)

Do you get the point?  You are starting to see the “language” of the dot product.  In math language a vector of vectors is called a matrix and [(1, 0), (0, 1)] is called the “identity matrix”, because when you dot it with any vector you get back the same vector.

The dot product can be applied to any two vectors of the same size. This concept is used all over the place.  Here is an interesting example, we can use the dot product notation to write down the number 365 (in decimal) starting with the vector (3, 6, 5):

   (3, 6, 5).(100, 10, 1) = 3*100 + 6*10 + 5*1 = 365

This is how we write numbers (in base 10). It is read like this: 3 in the 100’s column, 6 in the 10’s column and 5 in the one’s column, added together, normally written “365”.

We could also use it to find the number of seconds from midnight to 04:35:20am from the vector (4, 35, 20):

   (4, 35, 20).(3600, 60, 1) = 4*3600 + 35*60 + 1*20
                                                  = 16520 sec

There are 3600 seconds in an hour, and 60 seconds in a minute.  I think you got the idea.

Standard

Math Moments – Pointing the Direction

It might be good just to pause here for a minute or two and get our bearings.  If you were deep in the woods with a compass, you could get to any point you want by simply knowing the direction you need to travel and how far you need to go in that direction.  On a grid, we could call the point where you are “the origin”, you are starting at the point (0, 0).

You also have a map with a grid and want to be able to draw a line on the map from where you are to your destination.  We are going to draw this line using the general line parametric equations for a line we have already discussed:

x = x0 + Dx*S
y = y0 + Dy*S

With the origin as your starting point (x0, y0) = (0,0).  Notice that I used different simpler notation that says

x0 = 0 and
y0 = 0.

This is called vector notation, instead of stacking the parametric equations on top of each other, we put them side by side in parenthesis and separate them with a comma (x, y). Using this vector notation I can rewrite both general parametric equations for a line as:

      (x, y) = (x0, y0) + (Dx, Dy)*S

A “vector” is expressed as two numbers written in parenthesis, separated by commas. In this case, the first number is the “x term” and the second number is the “y term”. When we “add” two vectors we add both “x terms” together and also both “y terms”.  When we multiply a vector times a number, then we just multiply both the “x term” and “y term” by that number.  And so, the “vector” equation for a line can be expanded like this:

   (x, y) = (x0, y0) + (Dx, Dy)*S
   (x, y) = (x0, y0) + (Dx*S, Dy*S)  (multiply the Direction vector by S)
   (x, y) = (x0+Dx*S, y0+Dy*S)        (add this to the starting point)

You can see how this last equation looks like the original stacked parametric equations, but they are written side by side in the parenthesis instead of one on top of the other.

This vector notation has an advantage, it is easier to write, and it lets us express the direction of the line on as (Dx, Dy). 

This becomes very helpful.

If you are in the deep woods, then it would be very helpful to convert your compass heading direction into this Direction vector and find (Dx, Dy) for your desired direction heading so you can draw the line on your “grid” map.

Since you set the origin (x0, y0) = (0, 0) to be where you are, the vector equation for the line to your destination is:

   (x, y) = (Dx, Dy)*S

Now suppose that your destination is a distance “R” away from where you are. You can then draw a circle on your map with a radius “R” from the origin where you are.  You know that your destination is then somewhere on that circle.  You just need to know the direction (Dx, Dy) of your line to your destination point (see diagram above).

Let’s call the destination point (xR, yR).  Since we figure that the distance is “R”, then when S = R our vector equation is written:

(xR, yR) = (Dx, Dy)*R

And so using vector notation:

(Dx, Dy) = (xR, yR)/R = (xR/R, yR/R)

This tells us that if we know the point of our destination:

(xR, yR) and the distance R2 = xR2 + yR2, then we can find the direction vector and draw our line on the map.  And if we only know the Angle “A” off the ‘x-axis’ from our compass, We can use our calculator and the definitions of Cos(A) = xR/R and Sin(A) = xR/R, to find the direction vector:

    (Dx, Dy) = (Cos(A), Sin(A))

Let us look at an example:  Suppose we knew that if we walked north 3 miles and then east 4 miles, we would reach our destination.  Then our destination is at (3 miles north, 4 miles east) on our map:

   (xR, yR) = (3, 4)  and R2 = xR2 + yR2 = 32 + 42 = 25 or R = 5.

       So,

   (Dx, Dy) = (xR, yR)/R = (3/5, 4/5) North-east

       The line on the map could be drawn by using:

   (x, y) = (3/5, 4/5)*S    where S varies from 0 to R.

If we wanted to know the compass heading, then we could use the “inverse” Cos and Sin functions on our calculator to find the angle “A”:

   Cos(A) = 3/5   and Sin(A) = 4/5.

This might require a bit more knowledge of trigonometry.

Now we do something really interesting.  Suppose that we are still at the origin, facing directly at the point (xR, yR) but we want to find the point on the circle that is exactly 90 degrees to our left. If you look at the diagram, you will easily see that the point of destination would then be (-yR, xR).  The point directly behind us would be (-xR, -yR) and the point 90 degrees to the right would be (yR, -xR).

This is very useful if we want to draw lines that are perpendicular to the direction we are traveling along a line.  The direction (-Dy, Dx) is perpendicular to the left of the direction (Dx, Dy).

Standard

Math Moments – A Universal Triangle

Take any three points in the universe, that are not on the same line, and they form a triangle.  We also have seen how these three points can generate the 2-D Euclidean space where the triangle lives.  Oh, the things we can do with a humble triangle.

We can start by labeling its parts.  The points are connected by the three line segments called sides. Let’s call the point that is farthest away from the other two points, P1.  This is also the point that connects the two longest sides.  We can label the point on the other side of the longest side P2, and the remaining point P3.

It makes sense to put the label S1 for the side opposite the point P1, and the same for S2, and S3.  The side S3 then connects the points P1 and P2, and is the longest side, simply because we chose P1 and P2 to be on the longest side.  And so the side S2 is the second longest side, and S1 the shortest side with the same reasoning.  In math language S1 is less than or equal to S2 and S2 is less than or equal to S3 : S1 <= S2 <= S3.

We simply chose the labels so this is true. The way you choose to label things makes things easy to remember and deal with.  We can also choose to label the angle A1 to be next to the point P1, A2 to be next to P2, and A3 to be next to P3.

Angles are measured as percentages of the “piece of pie” inside the angle in proportion to the whole pie.  You can find the angular percentage of A1 by taking the length of the circular arc C1 (in the diagram) and dividing it by the circumference of the whole circle, 2*π*S3.

The angle in degrees is found by multiplying this percentage, C1/(2*π*S3), by 360 degrees in the whole circle:

A1 = 360 * C1/(2*π*S3).

Mathematicians chose 360 “degrees” in a full circle because it can be divided equally into 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 18, 20, 24, 30, 36, 40, 45, 60, 72, 90, 120, 180, and 360 pieces.

Another way to measure angles is to use “radians”, chosen so that 2*π radians are in a full circle. Thus in radians,

A1 = 2*π * C1/(2*π*S3) = C1/S3

Which is a more natural measure for angles based on the arc lengths of a circle.

If you really want to learn geometry, trigonometry, or build virtual worlds, then understanding the concepts we are about to explore gives you great power.

Suppose, for example, you want to find a cartesian grid that will map where these points are in space, then choosing good reference points and directions can make all the difference.

If you choose P1 to be the reference point (the origin), then choose the “x” direction to point directly along the S3 side toward point P2, and pick the perpendicular “y” direction so that P3 is on the positive side.  Then you placed this universal triangle on a grid as shown on the diagram above.  P3 is the only point that does not lie on an axis.  The distance of P3 from the y axis is labeled “x” and the distance of P3 from the x axis is labeled “y”, as shown in the diagram.

This breaks the triangle up into two rectangular regions, as shown by the dashed lines in the diagram.  The area of the left rectangle is x * y, and the area of the right one is (S3-x) * y.  If you add these two areas together you get a total area of S3 * y.  It is easy to see that the area of the triangle, by symmetry, is exactly half of the area of the two rectangles, so:

Area of triangle = ½ * S3 * y.

We can easily see this from the diagram. The left rectangle is made with two exact copies of the x, y, S2 triangle so the angle, A1, is the same on the top and bottom half of the first rectangle.  The same goes for the A2 angle in the (S3-x), y, S1 triangles on the right.  Adding the angles together on the top junction of the rectangle, it is easy to see that:

A1 + A2 + A3 = 180 degrees (universally true for all triangles).

From the diagram and by the Pythagorean theorem we can also see that:

 S22 = x2 + y2

S12 = (S3-x)2 + y2

       = S32 – 2*S3*x + x2 + y2  (and x2 + y2 = S22)

       = S32 + S22 – 2*S3*x    (known as the law of cosines)

And when S1 and S2 are the same length then:

S22 = S12

S22 = S32 + S22 – 2*S3*x

Thus by simple algebra

S32 = 2*S3*x

x = ½ * S3

And so we see that when x is halfway between P1 and P2, then the sides S1 and S2 must be equal in length. We can also see that if S2 is greater than S1 then x must be greater than ½ * S3, on the right-hand side of the midpoint.

We now can see that there are some natural restrictions on where P3 can be in the above diagram, since S2 is greater than or equal to S1, then x >= ½ * S3, and since S2 is shorter than S3, P3 must be inside a circle of radius S3.  Thus, P3 is restricted to be in the shaded region shown in the diagram.  If P3 was outside this region, then S2 would be longer than S3 or shorter than S1 and we would need to re-label the points and sides accordingly and redraw our grid, then P3 would again be in the region.

We now can supply the Cartesian coordinates of the three points in this grid:

P1: (0,0)
P2: (S3,0)
P3: (x,y)

Note that this applies to all triangles in the universe, as long as we follow the labeling guidelines for the parts of the triangle and set up the grid like we have done here.

To work with the angles and find x and y, there are “trigonometric” functions on our calculators, Sin(Angle) and Cos(Angle), to find x and y from the angles, that are defined as follows:

Sin(A1) = y/S2  [or y = S2 * Sin(A1)]

Cos(A1) = x/S2 [or x = S2 * Cos(A1)]

We can also work with the angle A2 by looking at things from the P2 side:

Sin(A2) = y/S1           [or y = S1 * Sin(A2)]

Cos(A2) = (S3-x)/S1 [or x = S3 – S1 * Cos(A2)]

The angle A3 can be found because A1 + A2 + A3 = 180 degrees.

Notice that now you can find x and y if you know the angle A1 or A2, and the sides.  You can fool around with this to find the missing information.  For example, combining both expressions for x and y shown above, we get:

   x = S2 * Cos(A1) = S3 – S1 * Cos(A2)

   y = S2 * Sin(A1) = S1 * Sin(A2)    (known as the law of sines)

These relations can be used to find x and y from the angles and sides, or the angles from x and y, or the sides from combinations of each.  These are very useful in geometry.  You can explore all the possibilities by taking a trigonometry course.

A surprising and revealing fact: you can use reflection symmetry to find a point that is the same distance away from all three points P1, P2, and P3.  We call this the “center” point, C, and thus you can draw a circle that connects all three points. This means that if you randomly choose any 3 non-linear points, you can find a unique circle that connects these points.

To show this, we start by recalling the wonders of reflection symmetry.  The midpoint of S3 between P1 and P2 is the same distance from both these end points. We can find all the points that are the same distance away from P1 and P2 by drawing a perpendicular line of reflection through the midpoint of S3.  We saw that this is the line where x = ½ * S3.  Any point on this vertical line is the same distance away from P1 as it is from P2.  This is shown by the vertical dashed line in the diagram above.  In the same fashion, the points that are the same distance from P1 as they are from P3 are found to be along the line of reflection that cuts the segment S2 in half, as is shown by the other dashed line on the diagram.  These two midpoint lines of reflection from S3 and S2 meet at the “center point” C.  And so, we see that this point C is the same distance “r” from P1, P2, and P3.  We can draw a circle with center C and radius r that connects all three of these points, as shown in the diagram above.

Before we finish, let’s explore one other surprising universal fact about triangles. This comes from reflection symmetry of bisected angles that we have not covered yet.  Any angle made from two lines can be cut in half, this forms a line of reflection symmetry.  For example, in the diagram above, there is a dotted line that divides the angle A1 in half.

Through this line of reflection, you can reflect the line passing through P1 and P3 onto the line passing through P1 and P2. It might take a minute to see it. If I draw a circle with its center on this line, then the half-circle above the line can be reflected onto the half-circle below the line.  This means that if the circle touches the line on the top, then by symmetry, it must touch the line on the bottom at exactly the same distance from P1.

Similarly, the point where the bisector lines of symmetry of A1 and A2 meet is the center of a circle that touches all three sides of the triangle.  If you connect the three points where this circle touches all three sides with line segments, then you have a smaller triangle that breaks the triangle into three triangles that have two sides of equal length.  The smaller triangle is inscribed inside a circle, and forms three other triangles with two equal sides (these are called isosceles triangles).

When you stare at the diagram, do you see the multiple symmetries here?  You can divide any triangle into 6 isosceles triangles.  Also note that the angle bisectors pass through the center of the inscribed circle and thus are perpendicular bisectors to the sides of the small triangle inside.  The distance from the center of the circle to the sides is equal to the radius of the circle.  Believe me, understanding this makes geometry and trigonometry so much more simple.  May the wonders of symmetry never cease!

Standard

Math Moments – A New Perspective

You can learn a lot about something when looking at it from a new perspective. In the diagram above we are looking at the exact same square as in the last post from a different vantage point. Again, I use my right to choose a reference point and direction. I keep the point O as my reference point, but I rotate the cartesian grid a bit clockwise.

Notice that I have not changed anything about the square, it has the same points. I have only changed the way I am looking at the square. The area of the square has not changed, it is still r2. I have just “tilted my head” a little bit. I chose an “x” direction that is not along the O O+ side of the square and the “y” direction to be perpendicular. This is certainly within my rights under the axiom of choice.

From this perspective, however, the way I measure the area of the square is a bit different, I cannot “tile” the square with the cartesian tiles in this direction without “cutting off” the corners of the tiles. From here grows the whole field of trigonometry. I need to rotate my ruler to measure distance from any point and in any direction in 2-D space.

In the diagram above, I am looking at the “bottom” line segment of the square, O O+, from this new perspective, I have also modified the grid spacing a bit for better clarity. In this diagram, I found the “coordinates” of the O+ point by finding the perpendicular distance from both the x and y axis, as is customary. The distance away from the y axis is labeled “x”, and the distance away from the x axis is labeled “y”.

It is obvious from the diagram that, by parallel sides, the respective distances from O+ form a rectangle with one side a distance “x” along the x axis and another side a distance “y” along the y axis. These distances are called the cartesian “coordinates” of the point O+. It is also obvious that the area of this rectangle is x times y, written as x*y ( we use “*” to mean “multiplied by” for clarity).

If I now choose the O+ point to be the point of reference and chose the “y” direction to be down and “x” direction to be to the left, as shown by the yellow script “x” and “y” in the diagram, I basically would have chosen to look at this same rectangle from an “upside down” perspective. By flipping the diagram upside down, you can see that the rectangle and O O+ line segment looks exactly the same from this perspective.

This shows an important symmetry of the rectangle. It also shows that the area of the triangle on the top half of the rectangle is exactly the same as the area of the triangle on the bottom half. Or to say, the segment O O+ cuts the rectangle in half. Thus, the area of both triangles is ½ * x * y. This also shows that the angles of both corresponding triangles are exactly the same. We will talk about this later.

The equivalence of areas (the real estate of 2-D), regardless of our choice of reference point and direction, gives us a way to “rotate” our ruler into any angle and direction. This relation was found by Pythagoras many millennia ago and is called the Pythagorean theorem.

Standard

Math Moments – 2-Dimensional Real Estate

In the last post’s “cartesian grid” diagram, if you remember, the radial lines went through the point P. By reflection symmetry, I can reflect these radial lines onto any cartesian grid point I want. In the diagram above, I decided to reflect the radial lines so they now radiate from point O. I now choose point O to be the reference point.

I choose one of the “cartesian” directions to be from the reference point O to the point O+, I will call this direction the positive “x” direction, labeled by the red script “x”. I call this line the “x” axis, shown as a bold horizontal line in the diagram.

The second “cartesian” direction I choose to be from the reference point O to the point P. I call this direction the positive “y” direction (as customary), and label it with a red script “y”. This vertical line in the diagram is called the “y” axis and is bolded. There are always two perpendicular independent directions I can choose in a 2-D space. The axiom of choice allows me to choose whatever reference point I want and whatever two reference directions I want. As mentioned before, the right to choose is one of the fundamental concepts of math.

Alright, let’s talk money. In 1-D space, distance is everything, it is the most valuable asset, but in 2-D, distance alone is not worth anything. A piece of land that is 10 meters long has no value until you know how wide it is. The real estate of 2-dimensional space is called “area”. Area is measured by how many squares, or fractions of squares can fit within a given border. The number of squares determines the value.

In the diagram, we form a square by taking the segment O O+ (of length r) and the perpendicular segment O P (also of length r) and reflecting them through M+ to form the opposite sides P Q and O+ Q. Note that we found a point Q that is exactly the distance “r” from both the “x” and the “y” axis. This square (in green) now has value, it is the real estate of 2-D space.

We have seen that the whole 2-dimensional space can be “tiled” with the squares of a cartesian grid. The number of “tiles” within a boundary determines the area. For example, in the diagram above, the green r x r square has 4 cartesian tiles inside. Each side has 2 tiles and 2 x 2 = 4 tiles. Since we could shrink the size of the tiles, we could also fill the square with lots of tiny tiles. From this, it can be deducted that the area of the square is found by multiplying the length of the square by the width of the square (r x r = r2).

The area of the green square in the diagram is r2. In 2-dimensions, the “real estate” or area is always measured as a distance times a distance, like a square meter, or a square foot. In 2-D, a line segment alone has no width, and so it has no area, and thus line segments have no real value in 2-D space.

In concept, you can fit an infinite amount of parallel line segments into a square no matter how small it is. This becomes clear when we recall the same concept in 1-D space to show that an infinite number of points can fit between any two points on a line segment, no matter how small.

Standard