Originally Posted by

**Stereo**
The dot product should only produce a scalar, if you have W * W^T then W should be a 1x3 matrix, whereas W^T * W would use the 3x1 matrix. Both of those are W dot W; you transpose the one that makes sense.

Your projection function is just wrong; it should be (a dot b) * b / ||b||^2 to project a onto b. (note: this will produce a vector the same dimension as b, since (a dot b) is a scalar and so is ||b||)

In this case if you were projecting a=(2,1,2)' onto b=(1,1,1)'

so (a dot b) = 5, ||b||^2 = 3

5/3*(1,1,1)'

(not gonna do the actual question for you)

Actually that's another point. ||b||^2 is b dot b.

The 2-norm is sqrt(v_1^2+v_2^2+...+v_n^2), the square root of the sum of squares of each component. So squaring it you get ||v||^2 = v_1^2 + v_2^2 + ...

Which for ||(1,1,1)||^2 = 1^2 + 1^2 + 1^2 = 3 = (1,1,1) dot (1,1,1)

## Bookmarks