Are there any shortcuts to tell if a square matrix is orthogonal?

So, if one is asked if a given matrix $A$ is symmetric, one could compute $A^T$ and check if $A^T=A$, however you can also simply check the symmetric entries accross the diagonal and see if they are equal (i.e whether $A_{ij}=A_{ji}$).

If one wishes to check if a square matrix is orthogonal, one could compute all the dot products of it's rows and columns, which, assuming an $n\times n$ matrix, requires $2\times\binom{n}{2}$ dot products (and this is without taking into account that as $n$ increases, so does the number of arguments in the sum of each dot product).

So, is there a shortcut that one may use to tell that a given matrix is orthogonal without having to compute all the dot products?

• "simply check the symmetric entries accross the diagonal and see if they are equal" is exactly the same as checking that $A^T=A$, so I don't know why you call that a shortcut. Commented Nov 25, 2017 at 22:58
• Think of it algorithmically, computing $A^T$ takes $O(n\times n)$ steps, however checking the symmetric entries only takes $2O(n)=O(n)$. It's a shortcut in the sense that if I ahve to code it, it's much shorter that way. Like computing 2*a+2*b+2*c = 2(a+b+c), they are the same, but the right hand side is much faster computationally. Commented Nov 25, 2017 at 23:16
• checking the symmetric entries is still an $O(n^2)$ since you have to read all the matrix, and check a condition of the type $a=b$ at least $n(n-1)/2$ times Commented Nov 26, 2017 at 1:57
• You are correct, I messed up my analysis, however checking the entries diagonally will still require less computations (the asymptotic running time is the same I agree, I was wrong), since you don't have to compute $A^T$ and then check the entries in between $A$ and $A^T$ Commented Nov 26, 2017 at 6:15
• This is the algorithm shortcut in numpy: given a Matrix M, Transpose T, Identity I. we execute the following code: Q = M.dot(M.T) # M*T product if array_equal(Q,I): print('''The M matrix is ortogonal) Commented Sep 15, 2021 at 10:25

Computing the dot product is the same as computing the matrix product $A^TA$ and checking it is equa to the identity matrix $I$, that, with the naive algorithm, costs $O(n^3)$ FLOPS.
With fast matrix multiplications, though, you can get down to $O(n^{2.3728639})$ FLOPS, so you can gain something substantial in time.
• @hyprfrcb With the fast multiplication of matrices you are saving operations with respect to doing all dot products. Moreover, a saving of the order of $\sqrt n$ has full meaning especially for big size matrices, and the saving is much more than 90% Commented Nov 28, 2017 at 15:01