Showing posts with label vectors. Show all posts
Showing posts with label vectors. Show all posts

Wednesday, July 23, 2014

Basic Physics: Part 0, Section 3: Vector Multiplication

Welcome back to my Basic Physics series! In previous sections, I covered some basic algebra topics, necessary trig functionscoordinate systems and vectors. The last post was getting rather long, and since vector multiplication is a bit tricky, I broke that topic into its own section, which you have before you! And I going to further preface this section with this: if you read through this, and you aren't sure you understand what is going on, don't give up! It's not easy to understand, and it looks down right weird; I think my reaction upon first introduction was something along the lines of 'what new devilry is this?!". I'm pretty sure I was using vector multiplication for at least 4 years before really understanding what it is. It didn't stop me from getting a B.Sci in physics, and it shouldn't discourage you from continuing reading this series, because it is possible to use these things without really understanding. Think of it like a car--you use a car everyday, you can make it do what you want, but almost everything under the hood is a mystery. Doesn't mean you can't use it to get you where you want to go! They also get easier with physical examples, which we will get to in coming posts. 

There are two types of vector multiplication. Each has its own uses and peculiarities. This section is going to cover what they are, their peculiarities, and how to do them. They pop up repeatedly in physics, so we'll discover their myriad uses along the way. Let's bring back our two arbitrary vectors from the last post 
$$\vec{v} = a \hat{x} + b \hat{y} + c \hat{z}$$
$$\vec{w} = d \hat{x} + e \hat{y} + f \hat{z}$$
and see what weird things we can do with them!

The first type of multiplication is called the "dot product" (remember that "product" is whatever results from a multiplication), and we get the new symbol \(\cdot \) to indicate that we are combining two vectors using this method. It is fairly straight forward: you multiply the x-hat components together, you multiply all the y-hat components together, you multiply all the z-hat components together and then you add up the results. 
$$\vec{v} \cdot \vec{w} = (a \hat{x} + b \hat{y} + c \hat{z})\cdot(d \hat{x} + e \hat{y} + f \hat{z})$$
$$\hspace{15 pt} = (a*d) + (b*e) + (c*f) = ad+be+cf$$
Interestingly, a dot product of two vectors does not yield a new vector with magnitude and direction, but rather a "scalar" which just has magnitude. This little quirk becomes very important when we get to electromagnetism. It should also be noted that the dot product is commutative, which is to say that 
$$ \vec{v} \cdot \vec{w} = \vec{w} \cdot \vec{v} $$
The same cannot be said of the other type of vector multiplication, which we will get to shortly. 

So, what does a dot product tell you? Speaking geometrically, it gives you the product of the length of the projection of one vector onto another vector. That's about as clear as mud, so lets look at some pictures. Here we have two vectors, \(\vec{A}\) (red), and \( \vec{B}\) (green), with an angle \( \theta \)  between them. 


If we draw a line between the end of \(\vec{A}\) and the point on \( \vec{B}\) where that line can intersect normally

we now have a right triangle. And we know from two weeks ago in the trigonometric section what to do with right triangles. We are given the angle, so by using the cosine function we can find the length of the projection of \(\vec{A}\) onto \(\vec{B}\), kind of like finding the length of your shadow. Let's label that projection \(A_B\) since it's the shadow of \(\vec{A}\) on \( \vec{B}\). So
$$ A_B = |\vec{A}| \cos{(\theta)} $$
with the vertical lines around indicating that we are using the total length, the magnitude, of A and not the vector form. The direction information is not helpful when dealing with triangles. So now we have the length of the projection of \(\vec{A}\) onto \(\vec{B}\). Assuming we have the length of \(\vec{B}\)  we can now find the geometric value of the dot product
$$ \vec{A} \cdot \vec{B} = |\vec{A}| \cos{(\theta)} |\vec{B}|$$
or, more prettily and more commonly,
$$ \vec{A} \cdot \vec{B} = |\vec{A}|  |\vec{B}|\cos{(\theta)}$$
This is another way to calculate the dot product, and is handy if you have been given magnitudes and angles, and not the component form for your vectors. 

But what does this mean, I can imagine you asking. Recall the idea of orthogonality from the previous section. The dot product allows you to relate two vectors based on the degree to which they are orthogonal to each other. If two vectors are perfectly orthogonal, the angle between them is \(90^{\circ}\), there is no projection, no 'shadow' of one vector onto the other, the cosine is zero, and the dot product is zero. The vectors are completely unrelated to one another, and they have no multiplicative interaction. If, on the other hand, the angle between them is \( 0^{\circ}\), then the cosine between them is 1 and they are parallel. They are both going in the same direction and can have the largest multiplicative effect on one another. (If you happen to dot a vector with itself, the angle will be zero, the magnitudes will be identical and you will get the square of the magnitudes. This is in fact how the magnitude of a vector is defined--the square root of the vector dotted with itself.) For any angle in between the effect is proportionately diminished. This will be easier to see when we can give some physical examples. 

The second type of vector multiplication is the "cross product", and the \( \times \) symbol which you probably learned to use for regular old multiplication back in elementary school gets reserved for this particular operation from here on in. Regular multiplication is usually indicated either by abutting parentheses, by an asterisk, or in the case of variable/coefficient terms just writing them next to each other without a space, as in the dot product example above. However, it is not generally as straightforward a calculation as the dot product, because the result of a cross product is still a vector. 

In order to calculate the cross product from scratch, as it were, we need to borrow a tool from linear algebra, namely the determinant*. The determinant is a way to arrange vectors so that you can easily calculate the cross product, no matter the size of your vectors. It is basically an organizational tool.  Once again, let's use the general vectors \(\vec{v}\), \(\vec{w}\), and calculate the cross product of \( \vec{v} \times \vec{w}\). 
$$ \vec{v} \times \vec{w} =\begin{vmatrix}\hat{x}& \hat{y} & \hat{z} \\ a & b & c \\ d & e & f  \end{vmatrix}$$
First, let's dissect what this thing is, line by line. 

 The first row is a label row of sorts. They label each column and they will help label the results. All the \(\hat{x}\) components go in the column under the \(\hat{x}\); if there is no \(\hat{x}\) component to a particular vector, that column gets a 0 for an entry for that vector's row. The same goes for the rest of the directions, namely \( \hat{y}\) and \(\hat{z}\).


 The second row is where the elements from the first vector, in this case \(\vec{v}\) are placed in their respective columns. Remember, if a vector is lacking an element, it is entered as a zero; the column is not deleted entirely, even if all it contains is the label and zeros.

The third row is treated in the same manner as the second row, except that it contains the second vector, in this case \(\vec{w}\). It's rather like filling out a spreadsheet. 

Now what do we do with this thing? 

You first calculate the \(\hat{x}\) component. To do this, you imagine blocking out everything that shares the \(\hat{x}\) column and row, leaving you with a square of components that are not the \(\hat{x}\) component

With those remaining 4 elements, you multiply the diagonal elements, and subtract the lower left/upper right pairing from the upper left/lower right pairing. So the results of this step are 
$$\hat{x} (bf-ec) $$
Note that the \(\hat{x}\) component of the product contains every element except the \(\hat{x}\) components of the  original vectors. Cool, right?

The second step is a little strange, because by blocking out everything in the \(\hat{y}\) element's column and row, we get a kind of split square, or two rectangles. 

What this means is that you have to subtract this result from the final product. You multiply the elements from the two rectangles as though it were one square, so this component of the product gives us
$$-\hat{y}(af - cd)$$
So far, so good. 

The last component is almost identical to the first. 

And you find the results the same way you did for the \(\hat{x}\) portion of the product. So the final bit is 
$$\hat{z}(ae-db)$$
Weird, but not too horribly complicated.  So the final result is 
$$\vec{v} \times \vec{w} = \hat{x} (bf-ec) -\hat{y}(af - cd) + \hat{z}(ae-db) $$

Some people are able to simply memorize the result given above, and don't bother to use the determinant. I am not one of those people gifted in memorizing formulae.  It's easier for me to remember a compact method or tool than to memorize lines of elements. 

It should be noted that the cross product is not commutative--the order in which things are multiplied matters, unlike the dot product. That is to say, \( \vec{v} \times \vec{w} \neq \vec{w} times \vec{v}\). It is however anticommutative, which means that reversing the order negates the result: \( \vec{v} \times \vec{w} = - \vec{w} \times \vec{v}\). 

So, what does the cross product give you? This is a little easier put than the dot product. The cross product calculates the area of the parallelogram whose sides are defined by the two vectors. 
So what's all that vector information doing? Well, hold on to your socks, it turns out that area is a vector quantity. Yep, and the direction of that area is normal to the surface which the area is a measure of. So if you can imagine standing on that parallelogram, which every direction is straight out of your head is the direction that that area points! This also make clearer an important point about the cross-product, which is that the resulting vector from a cross product is necessarily orthogonal to its two parent vectors. The two vectors must lie in a plane to form a parallelogram, and the normal to that parallelogram must be normal to the two vectors defining that parallelogram. 

The fact that the cross product calculates the area of a parallelogram leads us to our last point. What if you don't need to know which way the area is pointing, for some reason? You just need the magnitude of the result, not the whole thing. Well, if you remember your geometry you might recall that the area of a parallelogram can be found by multiplying the lengths of the sides and the sine of the angle between the sides. The same formula works for the cross product in a way. Assuming you have the magnitudes of each vector and the angle between them, you can find the magnitude of the cross product, at the cost of the direction information. 
$$|\vec{v} \times \vec{w} | = |\vec{v}| |\vec{w}| \sin{(\theta)}$$

That wraps up what you need to know from vectors. I know it may seem like a lot, but remember that it's a tool in our tool kit for physics. We will be using these tools frequently, and like any skill it becomes easier with use, and you get to build more incredible things the better you become!

As always, I hope that I have explained things clearly. If I haven't, please let me know in the comments, and I'll do my best to clarify!

*DH objected to this section, because what physicists call a determinant is technically a 'formal determinant', as it has the right form but does not adhere to the strict definition used by mathematicians. If you should show this to a mathematician, they will twitch, and possibly rant about physicists. This is the normal reaction of mathematicians to physicist notation. 

However, the math editor of this blog, sirluke777, objects to DH's objection, and says it's perfectly fine. His background is math, physics and chemistry, so make of that what you will. If there is an outcome to this math geek debate, I will update here. 

Monday, July 14, 2014

Basic Physics: Part 0, Section 2: Vectors and Coordinate systems

In the previous sections, I cover some basic algebra topics and necessary trig functions.

In this section, I'm going to lay out some basics of coordinate systems and vectors. I'm pairing these concepts because vectors without coordinate systems are a little esoteric for this series, and coordinate systems are necessary, but easily dealt with, at least compared to things like trig functions.

These two concepts are needed because when we talk about a problem and set out to solve it, we need a way to describe where things are, where they are going and how they are getting there. The combination of vectors and coordinate systems allows us to know exactly what we are referring to  and what it's relation is to anything else that might be relevant to the problem. Without this tool, problems in more than one dimension can easily become a hopeless jumble.

Let's start with coordinate systems. There are many possible coordinate systems of which  11 of which are commonly used and  only 1 of which we need for right now. That coordinate system would be the Cartesian coordinate system, apocryphally realized by M. Rene Descartes  (he of "I think therefore I am" fame) as he lay in bed watching a fly buzzing above him. It was also realized by M. Fermat, though he failed to publish it. If you ever had to plot things by hand in a math class, you have used the two-dimensional cartesian coordinate system! The cartesian coordinate system can be thought of as a grid system in 3 dimensions, that lets you specify a  location based 3 numbers, one for each dimension. You can think of it as giving someone a latitude, longitude and altitude. You have given them all the information they need to locate a particular spot on planet earth. (I will officially note that the earth is NOT a cartesian system, since the lines of longitude are not parallel but intersect. But for small distances, say NYC, it is a decent approximation).

Formally, a location in any coordinate system  is the intersection of three orthogonal planes. Orthogonal, for our purposes, means that the lines/planes intersect at \( 90^{\circ}\) to each other. Think of the walls in your house. Your walls (hopefully!) intersect your floors at right angles most of your walls will intersect each other at right angles, unless you have a very interesting house. So your walls are orthogonal to each other and they all orthogonal to the floor.

An example is probably the easiest way to show this. Let's start with a basic three-dimensional (3D) cartesian coordinate system:
In the picture above, I have drawn the same coordinate system from two slightly different perspectives. The top one you are staring down the barrel, so to speak, of the z-axis, looking at the x-y plane straight on. In the bottom one the picture has been rotated \(45^{\circ}\) about the y-axis so you can see along the z-axis as well. This becomes very useful if you are talking about things in 3D, while the top one is fine if you are only worried about two dimensions.

Another word about terminology and notation. What is an axis, and why are those letters wearing hats? As with a lot of math-stuff, it comes down to the dual needs for conciseness and precision. Let's start with the hats. When you draw a coordinate system for a problem and you label the axis, you are defining your directions. It's as if you are creating a mini universe and saying "this is East/West, this is North/South and this is Up/Down". But rather than label things in poetic victorian manner as "easterly direction" mathematicians and their ilk like to label things with letters. So "easterly direction" becomes "x-direction", but that's still too wordy. So 'direction' becomes 'axis', and that can get further shortened with vector notation as \( \hat{x} \) said "x-hat".  So an axis defines the direction of your coordinate system, but it also serves as a point of reference, much like the equator, the Greenwich meridian, and sea level  serve as reference points for finding places on the earth. So if you are on the x-axis, you are not moving in a y-direction or a z-direction. If you want to give a location in the coordinate system, you can notate it either as \( \left\langle a, b, c \right\rangle \) or you can use vector notation, to get a little ahead of ourselves: \( a \hat{x} + b \hat{y} + c \hat{z} \). The latter notation is preferably simply because it is more flexible, as we shall see.

Getting back to our example. Let's say we want to find a point \( \left\langle 3, 2, 2 \right\rangle\) (\( 3 \hat{x} + 2 \hat{y} + 2 \hat{z} \) ). For the moment we don't care what the units are. We start by locating the \( x = 3\) plane, that is, the plane that contains every point of the form \( \left\langle 3, b, c \right\rangle \) where \( b \), \(c\) are every real number. Then our diagram looks like this


with the red dot noting the point where the plane intersect the x-axis  in the bottom view, since it's a little hard to see. Next, we locate the \( y = 2\) plane.


The blue dot notes it's intersection in the y-axis in the bottom diagram because again, it's hard to tell. It's much easier to see in the top image, but there' a reason why the bottom diagram is actual preferable in some ways. This can be most easily seen when we try to add in the last point, the \( z = 2\) plane to give us our three-plane intersection.
Amazing what you can do with a basic drawing program and a little insanity.
The top image doesn't really allow us to visualize that last necessary dimension. You can mentally add it, but you can't draw it into the top one. The bottom one you can see the last plane and pinpoint their intersection (marked with a black dot here). 

That's pretty much all there is to coordinate systems. They let you pick a frame of reference so you can locate things in a mini-universe for the purpose of problem solving. What I find particularly neat is that you can place your coordinate system anywhere you like and the problem will still be solvable. It may be easier to solve from a computational standpoint if you center it nicely, but you don't have to. Why this is the case is something that I'll get into more when we start doing physics properly. 

Now, on to vectors. If a coordinate system gives you a frame of reference, vectors are what let you move around in that frame of reference and deal with more than just static problems. Now, what they are precisely requires linear algebra and is way outside the scope of this series, so we are going to stick to just definitions and not get into the nitty gritty. So, here goes.
 
A vector pairs a quantity with the direction that quantity is in, going or pointing to. A vector has both "magnitude" (quantity) and "direction". So long as you can describe a quantity as having these two qualities, you can express it as a vector*. We've already shown how we can describe position as a vector. You can also describe velocity as as a vector. "He's going 80 miles per hour" gives you a speed (a magnitude). "He's going 80 miles per hour due north" gives you a magnitude and a direction. We'll get more deeply into what physical quantities can be described using vectors in the first section of Part 1. 

For now, let's just work with two arbitrary vectors and see what we can do with them. As discussed in the algebra post, we'll use letters to stand in for numbers that we can plug in later. 
$$\vec{v} = a \hat{x} + b \hat{y} + c \hat{z}$$
$$\vec{w} = d \hat{x} + e \hat{y} + f \hat{z}$$
The little arrow above \(v\) and \(w\) indicates that they are vectors. In math everything has its own shorthand because you never know when you will want to deal with something in its entirety, or just don't want to write out the whole thing for the umpteenth time. 

So, what can we do to these things? Well, we can add them. The trick is that you can only combine things attached to like 'hats'. So you combine all the x-hat components, all the y-hat components and all the z-hat components, but you can't combine x-hat components with non-x-hat components. So 
$$\vec{v} + \vec{w} = a \hat{x} + b \hat{y} + c \hat{z}+d \hat{x} + e \hat{y} + f \hat{z}$$
$$\hspace{10 pt} = (a+d) \hat{x} + (b+e) \hat{y} + (c+f) \hat{z}$$
Subtraction works the same way:
$$\vec{v} - \vec{w} = a \hat{x} + b \hat{y} + c \hat{z}-d \hat{x} - e \hat{y} - f \hat{z}$$
$$\hspace{10 pt} = (a-d) \hat{x} + (b-e) \hat{y} + (c-f) \hat{z}$$

At this point you are probably wondering about multiplication and division, since addition and subtraction have been relatively straight forward. The answer is that there are two types of multiplication for vectors, and no types of valid division. Why this is starts getting into linear algebra and "outside the scope of this course". So I'm going to ask you to trust me on this one, because it's absolutely true even if I can't show you right now why it's true. They are also rather more involved than vector addition/subtraction, so I am going to move them to their own post so we can really take our time with them. 

I hope that this all was clear. If it wasn't, please let me know in the comments!



*There are also a few things that we'll get to over the course of this series that you wouldn't think you could describe as vectors, but they behave identically to the ones we deal with here.