Artificial intelligent assistant

How to prove rows matrix norm formula? I found a very elegant way to compute the norm of each row in a $n \times 3$ matrix on Matlab %M is my nX3 matrix normatrix = sqrt(diag(M*M')) How can I prove (not with empiric test), that is correct?

The $i,j$-th entry of $MM^T$ is the dot product of the $i$-th row of $M$ with the $j$-th column of $M^T$ (which is the $j$-th row of $M$).

So, the $i$-th entry on the diagonal of $MM^T$ is the $i$-th row of $M$ dotted with itself, which is the norm squared of the $i$-th row.

* * *

Note that if you're actually wanting to calculate the norm of each row, this is a slow way to do it, cause you'll do the $i$-th row dotted with the $j$-th row for $i \
eq j$ as well (this has the complexity of matrix multiplication; if $A$ is m x n, this is $O(m^2n)$ in complexity, roughly (i.e. scales superlinearly in the number of entries in the matrix). A cleaner way is to do


sqrt(sum(M.^2,2))


which is $O(mn)$, i.e. scales linearly with the number of entries in the matrix.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy baf349cc448055b39d6fa004b397711d