# Finding the Transformation Matrix using the initial and resulting vectors.

Attached is a sequence of formulas. My understanding (perhaps wrong) of 2.10 is that the elements of the original transform matrix A can be reconstructed by taking the partial derivatives of the the x' vector with respect to the x vector.

I've simplified this in the code below to a 2x2 transformation matrix. What eludes me is how to perform the required operations to get the "partial derivatives". Can anyone either tell me I've interpreted this equation wrong or else offer the code that would reproduce the values in the A matrix given the two vectors? I will greatly appreciate any help you can offer to complete this.

import java.text.DecimalFormat;

public class Main { public static void main(String[] args) { double Y[] = new double[2]; double X[] = new double[2]; double A[][] = new double[2][2]; int i = 0; int j = 0; String line = new String(); DecimalFormat df = new DecimalFormat("#.##");

//Initialize A
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
A[i][j] = 0;

/*
* Establish a 3x3 square transform matrix A
*/
System.out.println("The array A is the following:");
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
{
double val = Math.sin(i + j);
A[i][j] = val;
line += df.format(val) + ", " + "\t";
}
System.out.println(line);
line = "";
}
System.out.println();

//Establish the X vector.
X[0] = 2.4; X[1] = 1.1;
System.out.println("The X vector (x1, x2) = (" + df.format(X[0]) + ", " + df.format(X[1]) + ")");
System.out.println();

//Compute the Y vector.  Y = AX
//for(i=0,2) Y[i] = Sum(j=0,2){A[i,j]*X[j]}
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
{
Y[i] += A[i][j] * X[j];
}
}

//Show the Y vector.
System.out.println("The Y vector (y1, y2) = (" + df.format(Y[0]) + ", " + df.format(Y[1]) + ")");
System.out.println();

/*
* The array A is the following:
* 0,     0.84,
* 0.84,   0.91,
*
* The X vector (x1, x2) = (2.4, 1.1)
* The Y vector (y1, y2) = (.93, 3.02)
*
* Ok, so given Y and X show the partial derivatives... delta y)i/delta X)j ==> a)ij
*/
double delta[][] = new double[2][2];

//Initialize delta
for (i = 0; i < 2; i++)
for (j = 0; j < 2; j++)
delta[i][j] = 0;
/*
* I know that the literature states that the partial derivatives ... but never
* states what the partial derivatives are.  So what is the answer?
*/


} //main }

Long Response: I realized that for the matrix multiplication Y = AX (in my code) I could write two equations that each has two unknowns. 0.93 = 2.4 (a00) + 1.1 (a01) and 3.02 = 2.4 (a10) + 1.1 (a11). For this set of linear equations having four unknowns I realized that I needed to transform more values to create the additional equations in order to solve for a00, a01, a10 and a11. Thank you for confirming that I can reconstruct A from three pairs. In addition you also helped me understand that the author presented a transformation matrix that is the Jacobian matrix. I observed in other literature that the Jacobian can be created using partial derivatives of a vector valued function, but that function is not presented here, just its Jacobian. This is my understanding. I hope I got this correct. Thanks again for your time to respond to my inquiry.

• It seems you have original and transformed vectors and the information that they are related by a linear transform, is that true? Are these measurements? – mvw May 14 '15 at 21:53
• Yes, the transform matrix is the A array shown. The values shown are simply an example. – John Hunsberger May 15 '15 at 12:29

The equation recognizes that the Jacobian of the transformation is given by the matrix $A$ (or its inverse, I have not checked the details).
This $A$ is the first order approximation of arbitrary coordinate transformations.
However the first equations up to (2.6) show that the coordinate transformation is linear. So you do not need any partial derivatives. You should be able to reconstruct $A$ from three pairs of linear independent vectors $x, x'$. $$X' = (x'_1, x'_2, x'_3) = A (x_1, x_2, x_3) = A X \Rightarrow \\ A = X' X^{-1}$$ If you are free to select the pairs, using the standard base vectors $e_i$ is the most convenient way, because this way $X=I$ and thus $A = X'$, the images of the standard base under the transformation.
For completeness: The partial derivative $\partial x'_i/\partial x_j$ Can be computed by $$\lim_{h\to 0} \frac{x'(x+he_j)_i - x'(x)_i}{h}$$ where $e_j$ is the unit vector in $j$-direction.