[Math] Multiply a matrix by its transpose

matrices

I'm using some material found on the internet for learn how to use R.
One exercise is asking to return the result of a multiplication of a $15\times 3$ matrix by its transpose. Being the transpose a $3\times 15$ matrix, I would assume the result is a matrix of dimension $15\times 15$.

Am I wrong?

The code suggested on the answers return a matrix of dimension $3\times 3$.
I think I found the right code but before email the professor I would like to check with you if I'm right.

Thank you in advance.

Best Answer

You are not wrong. If you work through matrix multiplication, you will see that the result always will have the same number of rows as the left factor and the same number of columns as the right factor. So if $A$ is an $m\times n$ matrix, $AA^T$ will have $m$ rows and $m$ columns, while $A^T\!A$ will have $n$ rows and $n$ columns.