Dot product in 3D space

From testwiki
Jump to navigation Jump to search

Given the 3D vectors u, v, whose coordinates are given for a Cartesian coordinate system:

u=(ux,uy,uz),
v=(vx,vy,vz),

their dot product may be defined to be

uv=uxvx+uyvy+uzvz

Let w=u×v be their cross product:

w=|i^j^k^uxuyuzvxvyvz|
=(uyvzuszvy,uzvxuxvz,uxvyuyvx).

The cross product is perpendicular to both of factors, u and v, as can be verified by taking dot products:

uw=ux(uyvzuzvy)+uy(uzvxuxvz)+uz(uxvyuyvx)
=uxuyvzuxuzvy+uyuzvxuyuxvz+uzuxvyuzuyvx=0

Assuming that both u and v are non-zero in length then the cosine of the angle between them yields 0; so the angle between them is a right angle; so u and w are perpendicular; i.e., u and u×v are perpendicular. [But the geometric interpretation for the 3D case has not been shown yet; would not this claim be circular then?]

Exercise: Show that v and w are perpendicular.

Let w^ be the normalized version of w, i.e.

w^=www

so that w has unit length, because

w^w^=wwww2=wwww=1

and w^w^=1=1. [Again, this calculation has used the geometric interpretation of the dot product already.]

Let u=w^×u, then u has the same length as u but is perpendicular to both w^ and u, so it is a rotation by 90° of u in the “w^ plane” (the plane whose normal is w^).

Likewise let v=w^×v. Let

u=cosθu+sinθu,
v=cosθv+sinθv.

Note: u is a rotation of u by an angle θ around axis w^. Likewise v is a rotation of v by an angle θ around axis w^.

uv=(cosθu+sinθu)(cosθv+sinθv)
=cos2θuv+cosθsinθuv+sinθcosθuv+sin2θuv
=cos2θuv+sin2θ(w^×u)(w^×v)+cosθsinθ(uw^×v+w^×uv)
u^w^×v=|uxuyuzwxwywzvxvyvz|

(i^,j^,k^ get replaced by ux,uy,uz due to the dot product; this combination of dot and cross product forming a determinant is called a vector triple product).

w^×uv=vw^×u

because the dot product is commutative.

vw^×u=|vxvyvzwxwywzuxuyuz|
=uw^×v

because there is an interchange of rows one and three in the determinant; so swapping two factors of a vector triple product changes its sign.

So uw^×v+w^×uv=0,

uv=cos2θuv+sin2θuv

Focusing on the last term (of the right-hand side (RHS)):

(w^×u)(w^×v)=(ww×u)(ww×v)
=1w2(w×u)(w×v)
=1w2((u×v)×u)((u×v)×v)

Summary of the argument coming up ahead: u is a 90° (counterclockwise) rotation of u in the w^ plane and v is a 90° (counterclockwise) rotation of v in the w^ plane, so

uv=uv

thus uv=cos2θuv+sin2θuv

=(cos2θ+sin2θ)uv
uv=uv (End of summary.)

The products (u×v)×u and (u×v)×v have the general form (b×c)×a. We will now derive a formula for a×(b×c).

The double cross product a×(b×c) has to be perpendicular to b×c, so it must be in the plane of both b and c; it must be a linear combination of b and c.

b×c=|i^j^k^bxbybzcxcycz|
=(byczbzcy,bzcxbxcz,bxcybycx)
a×(b×c)=|i^j^k^axayazbyczbzcybzcxbxczbxcybycx|
=(aybxcyaybycxazbzcx+azbxcz,
azbyczazbzcyaxbxcy+axbycx,
axbzcxaxbxczaybycz+aybzcy)
=(bxaycy+bxazczcxaybycxazbz,
byaxcx+byazczcyaxbxcyazbz,
bzaxcx+bzaycyczaxbxczayby)
=(bx(aycy+azcz)cx(ayby+azbz),
by(axcx+azcz)cy(axbx+azbz),
bz(axcx+aycy)cz(axbx+ayby))
=(bx(axcx_+aycy+azcz)cx(axbx_+ayby+azbz),
by(axcx+aycy_+azcz)cy(axbx+ayby_+azbz),
bz(axcx+aycy+azcz_)cz(axbx+ayby+azcz_))
=(bxaccxab,
byaccyab,
bzacczab)
=(bxac,byac,bzac)(cxab,cyab,czab)
=ac(bx,by,bz)ab(cx,cy,cz)
=(ac)b(ab)c=a×(b×c).

Back to the focused-on equation:

(u×v)×u=u×(u×v)
=[(uv)u(uu)v]
=u2v(uv)u
(u×v)×v=v×(u×v)
=[(vv)u(vu)v]
=(vu)vv2u

Thus

uv=1w2((u×v)×u)((u×v)×v)
=1w2{(u2v(uv)u)((uv)vv2u)}
=1w2{u2(uv)v2u2v2(uv)(uv)2(uv)+(uv)v2u2}
=1w2{u2v2(uv)(uv)3}
=uvw2{u2v2(uv)2}
w2=ww=(u×v)(u×v)

Now the first cross and the dot in the RHS may be swapped, because the product is a vector triple product:

w2=uv×(u×v)

and now there is a double cross product at the end of the RHS, so the formula can be applied:

w2=u[(vv)u(vu)v]
=u[v2u(vu)v]
=[v2u2(vu)2]

Thus

uvw2(u2v2(uv)2)=uv
uv=uv
uv=uv.

So rotating 3D vectors u and v by the same angle along their common plane leaves their dot product preserved.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Given a pair of 3D vectors u and v, what happens to the dot product uv if v is rotated around the axis u so that the angle between u and v is preserved?

Firstly we will derive the Rodrigues formula in order to perform such a rotation. Vector v must be analyzed into parts that are parallel and perpendicular to u: call them v and v. Firstly consider the normalized version of u:

u^=uu=uuu.

The projection of v onto the u^ axis is:

v=(vu^)u^

Now subtract v from v to obtain its perpendicular part:

v=vv

What is vu^?

vu^=(vv)u^
=(vu^(vu^))u^
=vu^(u^u^)(vu^)

Since u^ is a unit vector then u^u^=1, so

vu^=vu^vu^=0

which proves that v is perpendicular to u^, as expected. [Or does it? Has the geometric interpretation of the dot product been established yet? Is not the argument a bit circular?]

v=u^×v
v=v+cosθv+sinθv'

where θ is the angle of rotation.

v=v+cosθ(vv)+sinθu^×(vv)
(vu^)u^+cosθ(v(vu^)u^)+sinθu^×(v(vu^)u^)
(vu^)u^+cosθ(v(vu^)u^)+sinθu^×v

so a Rodrigues rotation of vector v around vector u by an angle θ is

Ru,θ(v)=(1cosθ)(vu^)u^+cosθv+sinθu^×v

Dot-multiplying the just-above by u yields

uRu,θ(v)=(1cosθ)(vu^)(uu^)+cosθvu+sinθuu^×v
uu^=uuu=u2u=u
uu^×v=u×u^v=1uu×uv=0

because u×u=0 for any u.

uv=(1cosθ)(vu^)u+cosθvu
=(1cosθ)(vu^u)+cosθvu
=(1cosθ)(vu)+cosθvu
=vu=uv

as claimed.

Any other rotations of a pair of vectors which leave the angle between them unchanged may be composed of these two kinds of rotation already considered: (1) Rodrigues rotation of one vector around the axis of the other vector, which also rotates the plane containing both vectors; and (2) a dual, “isoangular”, simultaneous pair of rotations of both vectors along their common plane, which leaves it fixed.

Both of these kinds of rotations have been shown to preserve the dot product between the two vectors; therefore any angle preserving (and magnitude preserving; but that should be implicit in the term “rotation”) rotational movement of the two vectors also preserves their dot product.

Homogeneity. Multiplying the lengths of u and v. Let u=λu, v=μv, i.e.,

u=(λux,λuy,λuz)
v=(μvx,μvy,μvz),

then

uv=λμuxvx+λμuyvy+λμuzvz
=λμuv.

Multiplying the length of u or v also multiplies the length of their dot product by the same factor.

What happens when both u and v are unit vectors? Rotate them in an angle-preserving way so as to place u along the x-axis. Then

u=(1,0,0).

Rotate v around u until v is contained by the xy-plane. Then

v=(vx,vy,0)=(cosϕ,sinϕ,0)

for some angle ϕ. The angle ϕ is now contained within the xy-plane:

uv=vx=cosϕ.
cosϕ=uv

because the rotation was also dot-product preserving.

For non-unit vectors u,v:

u=uu^,
v=vv^

where u=uu, v=vv.

uv=uu^vv^=uvu^v^

but u^v^=cosϕ so

uv=uvcosϕ

where u and v are the magnitudes of u,v respectively; and ϕ is the angle between them. This is the geometric interpretation of the dot product (in 3D; it looks the same as that for the plane).