The simple way to get a perpendicular vector is to remember that the dot product must be zero.
Starting with vector (x,y) you just swap the two numbers and make one of them negative.
One possible result is (y,-x). The dot product with (x,y) is
x*y + y*(-x) = x*y - x*y = 0.
So (y,-x) is perpendicular to (x,y).
Of course, (-y,x) works as well. Which is a right turn and which is left depends on the coordinate system used. Just try them both and see what they do.
Starting with vector (x,y) you just swap the two numbers and make one of them negative.
One possible result is (y,-x). The dot product with (x,y) is
x*y + y*(-x) = x*y - x*y = 0.
So (y,-x) is perpendicular to (x,y).
Of course, (-y,x) works as well. Which is a right turn and which is left depends on the coordinate system used. Just try them both and see what they do.