# Figuring out rows and columns after matrix multiplication

• Oct 23rd 2009, 03:06 AM
garymarkhov
Figuring out rows and columns after matrix multiplication
Suppose A is a n x k matrix and you have \$\displaystyle A(A^TA)^{-1}A^T\$. All that is equivalent to \$\displaystyle I\$, but how many rows does I have? Is it n or k, and what is a quick way to figure it out?
• Oct 23rd 2009, 05:18 AM
HallsofIvy
Quote:

Originally Posted by garymarkhov
Suppose A is a n x k matrix and you have \$\displaystyle A(A^TA)^{-1}A^T\$. All that is equivalent to \$\displaystyle I\$, but how many rows does I have? Is it n or k, and what is a quick way to figure it out?

If matrix X has m columns and n rows and matrix Y has p columns and q rows, in order to be able to multiply XY, we must have that m= q and then XY has p columns and n rows.

If A has n columns and k rows then \$\displaystyle A^T\$ has k columns and n rows. In order to be able to multiply \$\displaystyle (A^TA)^{-1}A^T\$, \$\displaystyle (A^TA)^{-1}\$ must have n columns and, since it is invertible it is square, n rows. That means that \$\displaystyle (A^TA)^{-1}A^T\$ has k columns and n rows. And then \$\displaystyle A(A^TA)^{-1}A^T\$ is the product of a matrix with n columns and k rows by a matrix with k columns and n rows. k= k and the product is a square matrix with n rows and columns.