# Math Help - how can this evaluate to a matrix?

1. ## how can this evaluate to a matrix?

Hello I'm trying to understand the formula for getting a rotation matrix for a rotation about an axis. I just need to understand it enough so I can implement it in some code. Any extra gems of knowledge you have are welcome of course : ).

The specific bit I don't get is the $uu^T$ bit in the second line. Does that mean the dot product of u with the transpose of u? Why do they transpose it? Is taking the dot product of a vector with the transpose of itself a normal and reasonable thing to do?

This is from page 754 of the OpenGL programming guide:

$v$ is the axis of rotation and $a$ is the angle of rotation.

Let $v=(x,y,z)^T
$
and $
u=\frac{v}{ \parallel v \parallel } = (x', y', z')^T
$

Also let
$
S=
\begin{bmatrix}
0 & -z' & y' \\
z' & 0 & -x' \\
-y' & x' & 0 \end{bmatrix}
$
and $
M = uu^T + (\cos a)(I-uu^T) + (\sin a) S
$

Also does the "I" represent the identity matrix so that $(I-uu^T)$ is simple scalar subtraction from the identity matrix (assuming $uu^T$ is the dot product producing a scalar value)?

Thanks alot for having a look.

2. Originally Posted by tleave2000
Hello I'm trying to understand the formula for getting a rotation matrix for a rotation about an axis. I just need to understand it enough so I can implement it in some code. Any extra gems of knowledge you have are welcome of course : ).

The specific bit I don't get is the $uu^T$ bit in the second line. Does that mean the dot product of u with the transpose of u? Why do they transpose it? Is taking the dot product of a vector with the transpose of itself a normal and reasonable thing to do?
No, it's not "the dot product of a vector with the transpose of itself". If u is written as a "column matrix", say $\begin{bmatrix}u_x \\ u_y \\ u_z\end{bmatrix}$ then its transpose is the "row matrix", $\begin{bmatrix} u_x & u_y & u_z\end{bmatrix}$ and the product you indicate is the matrix product $u u^T= \begin{bmatrix}u_x \\ u_y \\ u_z\end{bmatrix}\begin{bmatrix} u_x & u_y & u_z\end{bmatrix}= \begin{bmatrix}u_x^2 & u_xu_y & u_xu_z \\ u_yu_x & u_y^2 & u_yu_z \\ u_zu_x & u_zu_y & u_z^2\end{bmatrix}$.

In fact, a common way of denoting the dot product of a vector with itself is the other way around: $u^T u= \begin{bmatrix} u_x & u_y & u_z\end{bmatrix}\begin{bmatrix}u_x \\ u_y \\ u_z\end{bmatrix}= \begin{bmatrix}u_x^2+ u_y^2+ u_z^2\end{bmatrix}$.

This is from page 754 of the OpenGL programming guide:

$v$ is the axis of rotation and $a$ is the angle of rotation.

Let $v=(x,y,z)^T
$
and $
u=\frac{v}{ \parallel v \parallel } = (x', y', z')^T
$

Also let
$
S=
\begin{bmatrix}
0 & -z' & y' \\
z' & 0 & -x' \\
-y' & x' & 0 \end{bmatrix}
$
and $
M = uu^T + (\cos a)(I-uu^T) + (\sin a) S
$

Also does the "I" represent the identity matrix so that $(I-uu^T)$ is simple scalar subtraction from the identity matrix (assuming $uu^T$ is the dot product producing a scalar value)?

Thanks alot for having a look.
Yes, I is the identity matrix but there is no such thing as "scalar subtraction"- you can't subtract a scalar from a matrix. However, as I said above, $uu^T$ is not a dot product and so not a scalar value. It is a matrix which can be subtracted from the identity matrix. With u as above, $I- uu^T= \begin{bmatrix}1 -u_x^2 & -u_xu_y & -u_xu_z \\ -u_yu_x & 1 - u_y^2 & -u_yu_z \\ -u_zu_x & -u_zu_y & 1 -u_z^2\end{bmatrix}$

3. Thanks that helped alot.

Ok so it's the outer product (once I knew how it expanded I had an idea what to look out for on wiki) which can be looked at as a special case of the kronecker product. Is that why it gets around the problem with matrix multiplication (at least the kind I knew about) not normally being defined between matrices where the number of columns in the first matrix is different to the number of rows in the second? I think that's what threw me off, I'd never really seen the outer product before.

Is all that more or less right?