Cross Product: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
The Cross Product is a property of [[Vectors|vectors]]. The cross product takes two vectors and returns a third, which is perpendicular, or orthogonal, to the passed vectors. This vector is referred to as the normal vector, which normally is corrected to have a total magnitude of one in mathematics. | |||
''' | == Definition == | ||
If vectors u and v are crossed ("u cross v"), the magnitude of the normal vector is equal to |u||v|sin(θ). Thus, | |||
|u × v| = |u||v||sin(θ)||'''n'''| | |||
|u × v| = |u||v||sin(θ)| | |||
In other applications, this magnitude has been found to be equal to the area of the parallelogram whose vertecies are at '''0''', '''u''', '''u'''+'''v''', and '''v'''. | |||
In addition, | |||
u × '''0''' = '''0''' | |||
u × v = -(v × u) | |||
(ru) × (sv) = (rs) u × v (where r and s are scalars) | |||
== General Application of the Cross Product == | |||
It is common practice in mathematics to write vecotrs as sums of th unti vectors, '''i''', '''j''', and '''k'''. These each have a magnitude of one and, from the origin, move precisely 1 unit on the x, y, and z axes respectively. | |||
Say, then, that we have two vectors, u and v. | |||
u = <u<sub>1</sub>,u<sub>2</sub>,u<sub>3</sub>> | |||
v = <v<sub>1</sub>,v<sub>2</sub>,v<sub>3</sub>> | |||
We can rewrite these vectors in terms of '''i''', '''j''', and '''k'''. | |||
u = u<sub>1</sub>'''i''' + u<sub>2</sub>'''j''' + u<sub>3</sub>'''k''' | |||
v = v<sub>1</sub>'''i''' + v<sub>2</sub>'''j''' + v<sub>3</sub>'''k''' | |||
We can then "multiply" them in an algebraic manner. | |||
u × v = (u<sub>1</sub>v<sub>1</sub>)'''i''' × '''i''' + (u<sub>1</sub>v<sub>2</sub>)'''i''' × '''j''' + (u<sub>1</sub>v<sub>3</sub>)'''i''' × '''k''' + (u<sub>2</sub>v<sub>1</sub>)'''j''' × '''i''' + (u<sub>2</sub>v<sub>2</sub>)'''j''' × '''j''' + | |||
(u<sub>2</sub>v<sub>3</sub>)'''j''' × '''k''' + (u<sub>3</sub>v<sub>1</sub>)'''k''' × '''i''' + (u<sub>3</sub>v<sub>2</sub>)'''k''' × '''j''' + (u<sub>3</sub>v<sub>3</sub>)'''k''' × '''k''' | |||
We can remove immediately any terms where the vector is crossing itself. The angle between two parallel vectors, a and b, is 0, thus a × b = |a||b|sin(0)|n| = 0 . So, the above statement simplifies to | |||
u × v = (u<sub>1</sub>v<sub>2</sub>)'''i''' × '''j''' + (u<sub>1</sub>v<sub>3</sub>)'''i''' × '''k''' + (u<sub>2</sub>v<sub>1</sub>)'''j''' × '''i''' + (u<sub>2</sub>v<sub>3</sub>)'''j''' × '''k''' + (u<sub>3</sub>v<sub>1</sub>)'''k''' × '''i''' + (u<sub>3</sub>v<sub>2</sub>)'''k''' × '''j''' | |||
Because the cross product reflects the normal vector, the following hold: | |||
i × j = -(j × i) = k | |||
j × k = -(k × j) = i | |||
k × i = -(i × k) = j | |||
Then, we can simplify our equation further: | |||
u × v = (u<sub>1</sub>v<sub>2</sub>)'''k''' + (u<sub>1</sub>v<sub>3</sub>)(-'''j''') + (u<sub>2</sub>v<sub>1</sub>)(-'''k''') + (u<sub>2</sub>v<sub>3</sub>)'''i''' + (u<sub>3</sub>v<sub>1</sub>)'''j''' + (u<sub>3</sub>v<sub>2</sub>)(-'''i''') | |||
= (u<sub>2</sub>v<sub>3</sub>-u<sub>3</sub>v<sub>2</sub>)'''i''' + (u<sub>3</sub>v<sub>1</sub>-u<sub>1</sub>v<sub>3</sub>)'''j''' + (u<sub>1</sub>v<sub>2</sub>-u<sub>2</sub>v<sub>1</sub>)'''k''' | |||
= (u<sub>2</sub>v<sub>3</sub>-u<sub>3</sub>v<sub>2</sub>)'''i''' - (u<sub>1</sub>v<sub>3</sub>-u<sub>3</sub>v<sub>1</sub>)'''j''' + (u<sub>1</sub>v<sub>2</sub>-u<sub>2</sub>v<sub>1</sub>)'''k''' (u-components are in order) | |||
This describes the direction of the normal vector to the vectors u and v. This sum can be expressed in [[Matrix|matricies]] | |||
<table> | |||
<tr> | |||
<td> =</td> | |||
<td> | |||
<table frame="vsides" style="border: 1px solid black;"> | |||
<tr> | |||
<td>u<sub>2</sub></td> | |||
<td>u<sub>3</sub></td> | |||
</tr> | |||
<tr> | |||
<td>v<sub>2</sub></td> | |||
<td>v<sub>3</sub></td> | |||
</tr> | |||
</table> | |||
</td> | |||
<td>'''i''' - </td> | |||
<td> | |||
<table frame="vsides" style="border: 1px solid black;"> | |||
<tr> | |||
<td>u<sub>1</sub></td> | |||
<td>u<sub>3</sub></td> | |||
</tr> | |||
<tr> | |||
<td>v<sub>1</sub></td> | |||
<td>v<sub>3</sub></td> | |||
</tr> | |||
</table> | |||
</td> | |||
<td>'''j''' + </td> | |||
<td> | |||
<table frame="vsides" style="border: 1px solid black;"> | |||
<tr> | |||
<td>u<sub>1</sub></td> | |||
<td>u<sub>2</sub></td> | |||
</tr> | |||
<tr> | |||
<td>v<sub>1</sub></td> | |||
<td>v<sub>2</sub></td> | |||
</tr> | |||
</table> | |||
</td> | |||
<td>'''k'''</td> | |||
</tr> | |||
</table> | |||
<table><tr><td> =</td><td><table frame="vsides" style="border: 1px solid black;"><tr> <td>'''i'''</td><td>'''j'''</td><td>'''k'''</td> </tr><tr> <td>u<sub>1</sub></td><td>u<sub>2</sub></td><td>u<sub>3</sub></td> </tr><tr> <td>v<sub>1</sub></td><td>v<sub>2</sub></td><td>v<sub>3</sub></td> </tr></table></td></tr></table> | |||
== The Cross Product in GraalScript == | |||
The cross product of two vector arrays in Graal can be obtained through the vectorcross({{graycourier|u}},{{graycourier|v}}) function. It's return value is a vector, w<sub>1</sub>'''i''' + w<sub>2</sub>'''j''' + w<sub>3</sub>'''k''', where the vector w is calculated from the determinant of the above [[Matrix|matrix]]. |
Revision as of 08:18, 1 July 2007
The Cross Product is a property of vectors. The cross product takes two vectors and returns a third, which is perpendicular, or orthogonal, to the passed vectors. This vector is referred to as the normal vector, which normally is corrected to have a total magnitude of one in mathematics.
Definition
If vectors u and v are crossed ("u cross v"), the magnitude of the normal vector is equal to |u||v|sin(θ). Thus,
|u × v| = |u||v||sin(θ)||n| |u × v| = |u||v||sin(θ)|
In other applications, this magnitude has been found to be equal to the area of the parallelogram whose vertecies are at 0, u, u+v, and v.
In addition,
u × 0 = 0 u × v = -(v × u) (ru) × (sv) = (rs) u × v (where r and s are scalars)
General Application of the Cross Product
It is common practice in mathematics to write vecotrs as sums of th unti vectors, i, j, and k. These each have a magnitude of one and, from the origin, move precisely 1 unit on the x, y, and z axes respectively.
Say, then, that we have two vectors, u and v.
u = <u1,u2,u3> v = <v1,v2,v3>
We can rewrite these vectors in terms of i, j, and k.
u = u1i + u2j + u3k v = v1i + v2j + v3k
We can then "multiply" them in an algebraic manner.
u × v = (u1v1)i × i + (u1v2)i × j + (u1v3)i × k + (u2v1)j × i + (u2v2)j × j + (u2v3)j × k + (u3v1)k × i + (u3v2)k × j + (u3v3)k × k
We can remove immediately any terms where the vector is crossing itself. The angle between two parallel vectors, a and b, is 0, thus a × b = |a||b|sin(0)|n| = 0 . So, the above statement simplifies to
u × v = (u1v2)i × j + (u1v3)i × k + (u2v1)j × i + (u2v3)j × k + (u3v1)k × i + (u3v2)k × j
Because the cross product reflects the normal vector, the following hold:
i × j = -(j × i) = k j × k = -(k × j) = i k × i = -(i × k) = j
Then, we can simplify our equation further:
u × v = (u1v2)k + (u1v3)(-j) + (u2v1)(-k) + (u2v3)i + (u3v1)j + (u3v2)(-i) = (u2v3-u3v2)i + (u3v1-u1v3)j + (u1v2-u2v1)k = (u2v3-u3v2)i - (u1v3-u3v1)j + (u1v2-u2v1)k (u-components are in order)
This describes the direction of the normal vector to the vectors u and v. This sum can be expressed in matricies
= |
|
i - |
|
j + |
|
k |
= |
|
The Cross Product in GraalScript
The cross product of two vector arrays in Graal can be obtained through the vectorcross(u,v) function. It's return value is a vector, w1i + w2j + w3k, where the vector w is calculated from the determinant of the above matrix.