Maths - Dot Product

When we looked at vectors we saw that they must have two operations addition and scalar multiplication.

operation notation explanation
addition V(a+b) = V(a) + V(b) the addition of two vectors is done by adding the corresponding elements of the two vectors.
scalar multiplication V(s*a) = s * V(a) a scalar product of a vector is done by multiplying the scalar product with each of its terms individually.

These operations interact according to the distributivity property: s*(b+c)=s*b+s*c

In addition to these operations we can have other operations which we can apply to vectors such as the vector dot product:

Vector Dot Product

The dot product operation combines two vectors and produces a scalar output.

It is defined as follows:

Ax * Bx + Ay * By + Az * Bz

dot product

It is also given by A•B = |A| |B| cos(θ)


It is also equal to

A * projection of B on A


B * projection of A on B

The following is Java code for vector dot product.

double dot(sfvec3f other) {
   return (x * other.x) + (y * other.y) + (z * other.z);

The following is managed C++ code for vector dot product.

Double sfvec3f::dot(sfvec3f* other) {
   return (x * other->x) + (y * other->y) + (z * other->z);

This method will be used by the sfvec3f class.

Geometric Multiplication

Having two types of multiplication which give outputs that are not vectors is not altogether satisfactory. these operations are useful in that they have lots of practical applications. However, in mathematical terms, it would be better if we had a vector algebra that was 'closed' that is the outputs of the operations have the same form as the inputs.

This is not possible for vector algebra but it is possible if our elements are a superset of scalars, vectors, bivectors and higher order components. We can then define a general multiplication which is a combination of cross and dot multiplication.

This is Clifford Algebra/Geometric Algebra as described here.

Further Reading

Vectors can be manipulated by matrices, for example translated, rotated, scaled, reflected.

There are mathematical objects known a multivectors, these can be used to do many of the jobs that vectors do, but they don't have some of the limitations (for example vector cross product is limited to 3 dimensions and does not have an inverse).




metadata block
see also:


Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

cover Introduction to 3D Game Programming with DirectX 9.0 - This is quite a small book but it has good concise information with subjects like, maths introduction and picking.

cover If you are interested in 3D games, this looks like a good book to have on the shelf. If, like me, you want to have know the theory and how it is derived then there is a lot for you here. Including - Graphics pipeline, scenegraph, picking, collision detection, bezier curves, surfaces, key frame animation, level of detail, terrain, quadtrees & octtrees, special effects, numerical methods. Includes CDROM with code.

This book contains more mathematically rigorous methods for picking than described above.

Other Math Books

Terminology and Notation

Specific to this page here:


This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.