Vector maths – a primer for games programmers


Hello and welcome back to my blog!

I've decided to do something a little different this time around; I've updated and bought together some old reference material that I wrote, added some interactive demos and expanded on the diagrams. I hope that the result will serve as an accessible introduction to vector mathematics for games programmers.


  • Scalars are written in lower case: a, b, c
  • Vectors are written in upper case: A, B, C
  • Matrices are written in bold upper case: A, B, C
  • |a| mean abs(a), the absolute value of scalar a
  • ||A|| means magnitude, or length of the vector A
  • Ā means vector A is unit length
  • Matrices are in row-major order, which means the rows are left to right in the matrix
  • MT means the transpose of M

Reading order

This is designed to be read in the following order:


But of course you can just use it as reference material.



Magnitude of vector
Unit vector
Dot product
The Cross and Wedge Products
Perpendicular operator


Rotating a vector from world space into object space
Rotating a vector from object space to world space


Multiplying two matrices
Rotating a matrix from world space into object space
Rotating a matrix from object space into world space
Transform point from world space into object space
Transform point from object space into world space
Transformation matrices
Inverse of a matrix
Orthonormal matrix
Determinant of a matrix

Until next time, have fun!

Cheers, Paul.

11 Responses to Vector maths – a primer for games programmers

  1. Pingback: Vector maths | Code Dump

  2. Asyx says:


  3. Jim says:

    Great stuff – took me back to my a-levels. Bookmarked until I unshackle myself from L.O.B. or my kids grow up….

  4. Karv says:

    Great stuff. Thanks! :)

  5. Friend says:

    Great work. Keep it up.

  6. Jece says:

    Thank you very much sir!!..

  7. tim says:

    very cool of you. Keep it up!

  8. futaro says:

    thanks a lot!!!!

  9. Good article. Keep it up!

  10. math says:

    Great work.
    Good article.

  11. mymoon says:

    very useful! read multiple times, learned a lot.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

WP-SpamFree by Pole Position Marketing