# Finding the matrix to do given transformations

#### burt

##### Junior Member
I was given the following question:
Find the $$3 \times 3$$ matrix that produces the described composite $$2$$D transformation below, using homogeneous coordinates.
Translate by $$(-3,2)$$, and then scale the $$X$$-coordinate by $$0.2$$ and the $$Y-$$coordinate by $$1.2.$$

I have the answer key and don't need to send in an answer, so I'm not simply looking for the solution. I want to know how to solve it so I can solve similar problems.

Can anyone help me out at all?

I would like to be able to solve this kind of problem, but I don't understand the method of solving it.

#### Subhotosh Khan

##### Super Moderator
Staff member
I was given the following question:
Find the $$3 \times 3$$ matrix that produces the described composite $$2$$D transformation below, using homogeneous coordinates.
Translate by $$(-3,2)$$, and then scale the $$X$$-coordinate by $$0.2$$ and the $$Y-$$coordinate by $$1.2.$$

I have the answer key and don't need to send in an answer, so I'm not simply looking for the solution. I want to know how to solve it so I can solve similar problems.

Can anyone help me out at all?

I would like to be able to solve this kind of problem, but I don't understand the method of solving it.
Suppose you just needed to translate by (-3,2) - what would the transformation look like?

Please show us what you have tried and exactly where you are stuck.

Please follow the rules of posting in this forum, as enunciated at:

#### burt

##### Junior Member
Suppose you just needed to translate by (-3,2) - what would the transformation look like?

Please show us what you have tried and exactly where you are stuck.

Please follow the rules of posting in this forum, as enunciated at:

#### burt

##### Junior Member
Thank you. The problem is I am totally stuck - otherwise I would show the steps I have taken. I know I need a three times three matrix, and I know that the first column in that matrix is for x and the second column is for y, but I don't understand the reason it's not a two times two matrix. How do I start this problem?

#### HallsofIvy

##### Elite Member
I am puzzled by this. The problem says "use homogenous coordinates". Do you not know that is?

With "Homogeneous Coordinates", https://www.bing.com/search?q="homogeneous+coordinates"&cvid=3ca12d4a266f4082be941bf26b795272&FORM=ANAB01&PC=HCTS, we represent the two dimensional point (x, y) by the three vector (x, y, 1) with the understanding that (ax, ay, a), for any non-zero a, is the same as (x, y, 1).

Then $$\displaystyle \begin{bmatrix}1 & 0 & dx \\ 0 & 1 & dy \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix} x \\ y \\ 1\end{bmatrix}= \begin{bmatrix}x+ dx \\ y+ dy \\ 1\end{bmatrix}$$
a translation by (dx, dy).

#### burt

##### Junior Member
I am puzzled by this. The problem says "use homogenous coordinates". Do you not know that is?

With "Homogeneous Coordinates", https://www.bing.com/search?q="homogeneous+coordinates"&cvid=3ca12d4a266f4082be941bf26b795272&FORM=ANAB01&PC=HCTS, we represent the two dimensional point (x, y) by the three vector (x, y, 1) with the understanding that (ax, ay, a), for any non-zero a, is the same as (x, y, 1).

Then $$\displaystyle \begin{bmatrix}1 & 0 & dx \\ 0 & 1 & dy \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix} x \\ y \\ 1\end{bmatrix}= \begin{bmatrix}x+ dx \\ y+ dy \\ 1\end{bmatrix}$$
a translation by (dx, dy).
Okay, I see that. But now how do I do my scaling? Working on the matrix that does a transformation by (-6,4) and scales the x-coordinate by 0.7 and the y-coordinate by 1.8. I multiplied the matrix $$\left[\begin{matrix}1&0&-6\\0&1&4\\0&0&1\\\end{matrix}\right]$$ by $$\left[\begin{matrix}.7&0&0\\0&1.8&0\\0&0&1\\\end{matrix}\right]$$. The result of this is the matrix $$\left[\begin{matrix}.7&0&-6\\0&1.8&4\\0&0&1\\\end{matrix}\right]$$. The only problem is that this solution is different than the one given in the answer key, so I am assuming that I made a mistake.

The answer key gives: $$\left[\begin{matrix}.7&0&-4.2\\0&1.8&7.2\\0&0&1\\\end{matrix}\right]$$

#### burt

##### Junior Member
Okay, I see that. But now how do I do my scaling? Working on the matrix that does a transformation by (-6,4) and scales the x-coordinate by 0.7 and the y-coordinate by 1.8. I multiplied the matrix $$\left[\begin{matrix}1&0&-6\\0&1&4\\0&0&1\\\end{matrix}\right]$$ by $$\left[\begin{matrix}.7&0&0\\0&1.8&0\\0&0&1\\\end{matrix}\right]$$. The result of this is the matrix $$\left[\begin{matrix}.7&0&-6\\0&1.8&4\\0&0&1\\\end{matrix}\right]$$. The only problem is that this solution is different than the one given in the answer key, so I am assuming that I made a mistake.

The answer key gives: $$\left[\begin{matrix}.7&0&-4.2\\0&1.8&7.2\\0&0&1\\\end{matrix}\right]$$
I did notice that if I switch the order of my matrices for my multiplication, I get the correct solution. How do I know which order to put my matrices in when multiplying?

#### Jomo

##### Elite Member
Which do you do first, scaling or shifting? Based on your answer to this question which matrix goes first? 2nd?

#### burt

##### Junior Member
Which do you do first, scaling or shifting? Based on your answer to this question which matrix goes first? 2nd?
I know that in this case the matrix I put second has to go first. You are telling me that in general we first scale then shift, correct?

#### Jomo

##### Elite Member
I know that in this case the matrix I put second has to go first. You are telling me that in general we first scale then shift, correct?
I am not telling you anything. I just suggested that you think about whether you should shift first and scale later or to do it the other way. That is how you learn--by thinking about it. Take an example, scale it and then shift it and then do it in reverse order. Do you get the same answer? Which of the two results do you want. Think about it!