# How to use Pythagoras theorem with alternative axes

please see the following picture and tell me if you know the solution. Thank you very much.!

-

If $B$ is the matrix of your basis vectors (as column vectors) then to find the coordinates of any $\vec{x}$ in the new basis $B$, you have $B \vec{x}_B = \vec{x}$, therefore you could compute $\vec{x}_B = B^{-1} \vec{x}$ or, more efficiently on the computer, solve the system by Gaussian Elimination.

In your case, you may combine a couple of vectors into a matrix, to do this in parallel. In other words, to solve a couple like that, let $V$ be the matrix of column-vectors you want in the new basis, then $V_B = B^{-1}V$.

EDIT 1 Here is the more detailed version. Get or implement a routine to run Gaussian Elimination (pseudocode on the Wiki page, most libraries support it). That solves the system $A \vec{z} = \vec{x}$ given $A$ and $\vec{x}$. This should also support solving this system simultaneously for multiple vectors, i.e.

$$A \left[ \vec{z_1} | \ldots | \vec{z}_n \right] = \left[ \vec{x_1} | \ldots | \vec{x}_n \right]$$

given $A$ and the vectors $\vec{x_1}, \ldots, \vec{x}_n$.

Now for your problem. You have three vectors in regular coordinates $(1,0)^T, (0,1)^T, (1,1)^T$ which you need to express as a linear combination of vectors in your new basis $B$, so let these 3 be the vectors you know ($\vec{x}$'s) and use Gaussian Elimination to solve $B Z = X$, where $X$ and $B$ are known and you need to find $Z$ - that would get you all the coordinates of each of the vectors you want in terms of your new coordinates $B$.

-
Thank you, it is quite hard for me to understand because I haven't used a matrix and mathematical shorthand for many years, I would understand very well in code however :) –  comprehensible Mar 20 '13 at 19:54
@ufomorace Please see the edit. –  gt6989b Mar 20 '13 at 20:12