I have two 2D unit vectors a and b. I'd like to find the rotation matrix that rotates a to b. ((cos theta,- sin theta),(sin theta, cos theta))

Zoagliaj

Zoagliaj

Answered question

2022-07-16

I have two 2D unit vectors a and b. I'd like to find the rotation matrix that rotates a to b. The formulas I see online are for a rotation matrix are
( cos θ sin θ sin θ cos θ )
And I can get the angle between a and b with
θ = cos 1 ( a b )
My problem is that that doesn't give me the direction. For example, if θ is π / 2 when maybe the matrix should use π / 2

Answer & Explanation

ab8s1k28q

ab8s1k28q

Beginner2022-07-17Added 17 answers

You don’t need to compute the angle explicitly, or indeed refer to an angle at all.
Observe that the result of rotating any vector ( x , y ) T 90 degrees counterclockwise is ( y , x ) T . Then, using the fact that the columns of a transformation matrix are the images of the basis vectors, the matrix
[ x y y x ]
represents a rotation that maps ( 1 , 0 ) T onto the unit vector ( x , y ) T . Therefore, a rotation that takes the unit vector a = ( x a , y a ) T to the unit vector b = ( x b , y b ) T has the matrix
[ x b y b y b x b ] [ x a y a y a x a ] 1 = [ x b y b y b x b ] [ x a y a y a x a ] = [ x a x b + y a y b x b y a x a y b x a y b x b y a x a x b + y a y b ] .
Darian Hubbard

Darian Hubbard

Beginner2022-07-18Added 7 answers

My solution is to regard both vectors as complex numbers. Thus a = a x + a y i and b = b x + b y i . . If both are unit vectors, then to rotate a to b you need to multiply by
a 1 b = a ¯ b = ( a x a y i ) ( b x + b y i ) = ( a x b x + a y b y ) + ( a x b y a y b x ) i .
Since this is a unit vector it is of the form cos ( θ ) + sin ( θ ) i and you can get the rotation matrix
( cos θ sin θ sin θ cos θ )
directly from the complex number form.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?