de-CH
utf-8
math math-format
Calculate Coordinate Vector
la-02-01
multiple
65536
randRangeNonZero(-8,8) randRangeNonZero(-8,8) randRangeNonZero(-8,8) randRangeNonZero(-8,8)
A*D-B*C randRangeExclude(-8,8,[0,A,B]) randRangeExclude(-8,8,[0,C,D]) fractionReduce(D*X-B*Y,det) fractionReduce(A*Y-C*X,det)

Given v = \begin{pmatrix}X \\ Y \end{pmatrix} and a basis \mathcal B = \left\{ \begin{pmatrix} A \\ C\end{pmatrix}, \begin{pmatrix} B \\ D \end{pmatrix} \right\}.

Calculate the coordinate vector [v]_{\mathcal B} = \begin{pmatrix} {\color{red}X} \\ {\color{blue}Y} \end{pmatrix} of v with respect to the basis \mathcal B .

a \color{red} X = (D*X-B*Y)/det
b \color{blue} Y = (A*Y-C*X)/det

We looking for {\color{red}X} and {\color{blue}Y} to form the unique solution of the system of linear equations \begin{pmatrix}X \\ Y \end{pmatrix} = {\color{red}X} \begin{pmatrix} A \\ C\end{pmatrix} + {\color{blue}Y} \begin{pmatrix} B \\ D\end{pmatrix}.

This can be done either using Gaussian elimination or with the matrix A= \begin{pmatrix} A & B \\ C & D \end{pmatrix} .

This matrix is invertible with \det(A) = det and A^{-1}= \dfrac 1{det}\begin{pmatrix} D & -B \\ -C & A \end{pmatrix}.

Write the system of linear equations \begin{pmatrix}X \\ Y \end{pmatrix} = {\color{red}X} \begin{pmatrix} A \\ C\end{pmatrix} + {\color{blue}Y} \begin{pmatrix} B \\ D\end{pmatrix} as \begin{pmatrix}X \\ Y \end{pmatrix} = \begin{pmatrix} A & B \\ C & D\end{pmatrix} \begin{pmatrix} {\color{red}X} \\ {\color{blue}Y} \end{pmatrix} and multiply by A^{-1} from the left.

This yields \begin{pmatrix} {\color{red}X} \\ {\color{blue}Y} \end{pmatrix} = \dfrac 1{det}\begin{pmatrix} D & -B \\ -C & A \end{pmatrix} \begin{pmatrix}X \\ Y \end{pmatrix} = \begin{pmatrix} {\color{red}SX} \\ {\color{blue}SY} \end{pmatrix} .