# Matrix multiplication/subtraction problem

I have the formula (part of the formulation for a homography):

$R*(n^T*x_p*I-t*n^T)$

and I don't understand how it can work given:

• $R$ is size 3x3
• $n^T$ is size 3x1
• $x_p$ is size 3x1
• $I$ is size 3x3
• $t$ is size 3x3

The result should be a 3x3 matrix, but I cannot multiply a $x_p$ (3x1) with $I$ (3x3) for starters? Is there a different precedence? If a result is a 1x1 matrix should I consider it a scalar?

Thanks

-

Since $n^Tx_p$ is a (1x1) scalar, $n^T \cdot x_p \cdot I = (n^Tx_p)I$ is a scalar multiple of the identity matrix.

Now we have that $n^Tx_pI$ is a (3x3) matrix while $tn^T$ is a (3x1) vector. Are you sure $t$ isn't a scalar?

EDIT: If $n^T$ is (3x1) and $x_p$ is (3x1), then $n^Tx_p$ doesn't make sense. Did you mean for $n$ to be (3x1) so that $n^T$ is (1x3)?

EDIT 2: Here is a consistent set of dimensions (which is hopefully correct)

• $R$ is a (3x3) rotation matrix

• $n$ is a (3x1) vector, so $n^T$ is (1x3)

• $x_p$ is a (3x1) vector

• $I$ is the (3x3) identity matrix

• $t$ is a (3x1) vector

The dimensions should work out now.

-
Thanks, so a 1x1 is a scalar. $t*N^T$ would be a scalar too then? And then it would be an element-by-element subtraction from the scalar multiple of the identity matrix? – aledalgrande Aug 5 '14 at 2:03
Actually the right part ($t*N^T$) gives me a 3x3, but it is a mistery to me why... – aledalgrande Aug 5 '14 at 2:07
Just saw your edit: the $T$ superscript means transpose, so your first version makes sense. $t$ is a 3D translation, so safe to assume it's a 3x1. – aledalgrande Aug 5 '14 at 2:08
Yes, that is the correct set of dimensions. The mystery is still $t*n^T$ which means (3x1) * (1x3), how does that work? In the matrix library I use, the result is 3x3, but can't understand why? – aledalgrande Aug 5 '14 at 2:47
How is that a mystery? The inner dimensions match, and the result is the outer dimensions i.e. (3x1)*(1x3) yields a (3x3) matrix. – JimmyK4542 Aug 5 '14 at 2:52