Find a matrix M that rotates vector A to the same direction and sense of vector B

53 Views Asked by At

Let $M$ be a matrix, $A$ and $B$ be vectors of the same dimension $n$, $A\cdot B$, their dot product and $k$ a scalar.

Given the $a_1...a_n$ coordinates of A and $b_1...b_n$ coordinates B, I'm trying to find the $n \times n$ cofficients of the matrix $M$ that maps (rotates) $A$ to a vector of the same direction and sense of $B$, while preserving the length of A. In other words, the following conditions must be satisfied:

  1. $(M \cdot A) $ = $kB$

  2. $|A| = |kB|$

Condition 1 leads to the following system of $n$ equations: \begin{align*} \\ m_{11} . a_1 + m_{12} . a_2 +... m_{1n} . a_n = k.b_1 \\ m_{21} . a_1 + m_{22} . a_2 +... m_{2n} . a_n = k.b_2 \\ &\vdots\\ m_{n1} . a_1 + m_{n2} . a_n + ... m_{nn} . a_n = k.b_n \end{align*}

While condition 2 adds one equation more:

$\sqrt[2]{a_1^2+a_2^2+...a_n^n} = \sqrt[2]{(k.b_1)^2+(k.b_2)^2+...(k.b_n)^2}$

Which can be rewritten as:

$\sqrt[2]{a_1^2+a_2^2+...a_n^n} = k.\sqrt[2]{[(b_1)^2+(b_2)^2+...(b_n)^2]}$

In other words, with knowledge of values of $A$ and $B$, condition 1 and 2 define an (underdetermined) system of $n+1$ equations and $n \times n + 1$ variables. How can a solution for this system be found, that is, a matrix M that would satisfy both conditions given A and B?