Find transformation to map one vector to another vector

1.6k Views Asked by At

I need to implement a transformation for a project I'm working on, but I'm having difficulties googling it since I probably don't have the right English terminology.

The problem is situated in a general $n$-dimensional space, and I need to transform the coordinates such that a given hyperplane becomes the hyperplane with coordinate $x_n$ equal to a constant. If I'm not mistaking, this should be equivalent to the transformation that maps the normal of the hyperplane to the vector $(0,\ldots,0,1)$. There should be no other deformations, so I guess I'm looking for a combination of rotations, so I'm looking for a $n\times n$ matrix which is symmetric and has determinant equal to 1.

I guess I can just write the matrix with variables and then solve it. There should be a lot of degrees of freedom, because you can still move around within the hyperplane and that shouldn't affect the normal. However, I need to implement this in a general programming language (without a computer algebra system), so I'm looking for just a solution in an easy way.

So the question is: what is the easiest way to find such a transformation which transform $(a_1,\ldots,a_n)$ to $(0,\ldots,0,1)$?

1

There are 1 best solutions below

3
On BEST ANSWER

An arbitray linear transformation will not work. You should aim at an orthogonal transformation, so that the fact that $(a_1,\ldots,a_n)$ gets transformed into $(0,\ldots,0,1)$ assures that your hyperplane gets transformed into the hyperplane $x_n=0$.

You can get that by taking $n-1$ linearly independent vectors in $(a_1,\ldots,a_n)^\perp$ and applying Gram-Schmidt to them in order to get orthogonal vectors $\{v_1,\ldots,v_{n-1}\}$. Now, let $v_n=(a_1,\ldots,a_n)$ and consider the linear map which maps $v_k$ into the $k$th vector of the canonical basis of $\mathbb R^n$.