Dot Products and Orthogonal Projection — Cheat sheet

Choose “Save as PDF” in the print dialog.
On this page

Core rule

p=aTbaTaa,r=b−p,aTr=0,∥b∥2=∥p∥2+∥r∥2.p=\frac{a^Tb}{a^Ta}a,\quad r=b-p,\quad a^Tr=0,\quad \|b\|^2=\|p\|^2+\|r\|^2.

Watch for

The direction vector must be nonzero. Projection onto a line is a vector, not just its scalar coefficient.