All problems
Orthogonal Matrix Check
Problem
Return True if the square matrix A is orthogonal, meaning its columns form an orthonormal set:
sum_k A[k][i] * A[k][j] = 1 if i == j else 0.
Use a tolerance of 1e-9 when comparing.
Hint
An orthogonal matrix satisfies A^T A = I.
Test cases
case 1
in: [[[1,0],[0,1]]]
expected: true
case 2
in: [[[0,-1],[1,0]]]
expected: true
case 3
in: [[[1,1],[0,1]]]
expected: false
case 4
in: [[[0.6,0.8],[-0.8,0.6]]]
expected: true
Starter codePython
def is_orthogonal_matrix(A):
# Your code here
pass4 test cases · run your code against them in the editor