# Transformation Matrix Problem with translation, scaling and rotation

I have a line with points A(1,2,1) and B(3,4,1). What would be the coordinates of the A and B if:

• midpoint of the line is translated to origin
• rotating line for 45 degrees
• scaling the line in y direction by 2
• translating the midpoint back to original position

After I get midpoint(2,3,1) and transformation Matrices and multiply them in reverse order I get transformation matrix as (took cos45 and sin45 as 0.7)

$$\begin{matrix} 0.7 & -0.7 & 2.7 \\ 1.4 & 1.4 & -4 \\ 0 & 0 & 1 \\ \end{matrix}$$

then I multiplied this matrix by A(1,2,1) and B(3,4,1) and I get that new coordinates of A'(2,0.2,1) and B'(2,5.8,1). However, in available answers in test there is no such answer. The closest to what I got is that A'(0.2,2,1) and B'(5.8,2,1). Can it be that question mixed x and y coordinates or I did a mistake somewhere? Here are my defined matrices which I multiplied in a reverse order:

$$\begin{matrix} 1 & 0 & -2 \\ 0 & 1 & -3 \\ 0 & 0 & 1 \\ \end{matrix}$$

$$\begin{matrix} 0.7 & -0.7 & 0 \\ 0.7 & 0.7 & 0 \\ 0 & 0 & 1 \\ \end{matrix}$$

$$\begin{matrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 1 \\ \end{matrix}$$

$$\begin{matrix} 1 & 0 & 2 \\ 0 & 1 & 3 \\ 0 & 0 & 1 \\ \end{matrix}$$

• An observation: the midpoint is $(2,3,1)$ not $(2,3)$. Then what do you mean rotation by $45^\circ$? What's the rotation axis? It looks like maybe $z$. Also, please look up Mathjax, and format your question, so it's easier to read. Thank you. – Andrei Feb 3 at 2:48
• @Andrei In the question it is not specified what is the rotation axis. – Augustas Feb 3 at 2:50
• I've got the same answer as you. And I did calculate the intermediate steps. Notice that for your transformations the final midpoint should be the same as the initial midpoint, and the answer in the book does not obey this. – Andrei Feb 3 at 3:10