All problems
Orthogonal Complement Basis 2D
Problem
Return a basis vector for the orthogonal complement of v in R^2, namely [-v[1], v[0]].
Return None if v is the zero vector.
Hint
Rotating a 2D vector by 90 degrees gives a vector orthogonal to it.
Test cases
case 1
in: [[1,0]]
expected: [0,1]
case 2
in: [[1,1]]
expected: [-1,1]
case 3
in: [[2,-3]]
expected: [3,2]
case 4
in: [[0,0]]
expected: null
Starter codePython
def orthogonal_complement_basis_2d(v):
# Your code here
pass4 test cases · run your code against them in the editor