# What is the relation between complex numbers and transformation matrices?

I read addition and multiplication with complex numbers can be represented as translation and rotation in a 2D plane.

I am using this to move around objects on the screen. I have an offset number, that I multiply by a number representing an angle. I then use the offset to move an object in a certain direction.

To draw the actual object, I came across affine transformations, represented as a 3x3 matrix. I was wondering if I could apply these transformations directly to the matrix.

I can't say I fully understand matrix multiplication, but as far as I can tell, translation can be expressed using matrix multiplication.

So what about rotation a point around an origin?

-
Consider the matrix $\begin{pmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{pmatrix}$. –  Zhen Lin Feb 18 '12 at 11:18
Very related... –  Guess who it is. Feb 18 '12 at 11:34
Also: the matrix multiplication view of translation only works if you use homogeneous coordinates. Otherwise, you can only translate by adding an appropriate vector to your original vector. –  Guess who it is. Feb 18 '12 at 11:37

If you have a point $(x,y)$ (equivalently, $z=x+yi$) represented by $\begin{bmatrix}x\\y\\1\end{bmatrix}$, you can translate it by the vector $\langle t_x,t_y\rangle$ (equivalently, adding $t_x+t_yi$) by multiplying: $$\begin{bmatrix}x'\\y'\\1\end{bmatrix}=\begin{bmatrix}1&0&t_x\\0&1&t_y\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}.$$ You can rotate it by $\theta$ about the origin (equivalently, multiply by $e^{i\theta}$) by multiplying: $$\begin{bmatrix}x'\\y'\\1\end{bmatrix}=\begin{bmatrix}\cos\theta&-\sin\theta&0\\\sin\theta&\cos\theta&0\\0&0&1\end{bmatrix}\begin{bmatrix}x\\y\\1\end{bmatrix}.$$
If you represent $(x,y)$ as $\begin{bmatrix}x\\y\end{bmatrix}$, translation by $\langle t_x,t_y\rangle$ can be done with addition: $$\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}x\\y\end{bmatrix}+\begin{bmatrix}t_x\\t_y\end{bmatrix}$$ and rotation with multiplication: $$\begin{bmatrix}x'\\y'\end{bmatrix}=\begin{bmatrix}\cos\theta&-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}.$$