# How can i represent 3D space using 4x4 matrix?

I want to represent 3D space using 4x4 matrix as we represent 2D plane using following form.

$$\begin{bmatrix} cos\theta & sin\theta & 0 \\ -sin\theta &cos\theta & 0 \\ x & y & 1 \\ \end{bmatrix}$$

can 3D space be presented in 4x4 matrix?

how can i apply operations like rotation,translation and transformation to the object using this transformation matrix?

• See for example here for the direct generalization. – Raymond Manzoni Jun 13 '15 at 9:11
• What do you mean by represent? In what sense? – mathreadler Jun 13 '15 at 9:35
• @mathreadler i mean to represent them in matrix format. in accordance with 2D representation. using which we can multiply standard matrix directly to that presented matrix to do transformations. – Rajendrasinh Parmar Jun 13 '15 at 9:56

## 1 Answer

Matrices of the form $$\begin{bmatrix} a&c&0\\ b&d&0\\ u&v&1 \end{bmatrix}$$ does not represent the $2D$-plane, but affine transformations in the $2D$-plane when the points of this space are represented by means of homogeneous coordinates $P=(x,y,1)$.

In this case the product $$(x,y,1) \begin{bmatrix} a&c&0\\ b&d&0\\ u&v&1 \end{bmatrix}= (ax+by+u,cx+dy+v,1)$$ represents the combination of a linear transformation (given by the $2\times 2$ matrice with the terms $a,b,c,d$) and a translation given by $x,y$.

We can extend the use of homogeneous coordinates to any space $\mathbb{R}^n$ and in the case $n=3$ the points can be represented by a quadruple $P= (x,y,z,1)$ and a matrix of the form: $$\begin{bmatrix} a&d&g&0\\ b&e&h&0\\ c&f&k&0\\ u&v&w&1 \end{bmatrix}$$ represents, in the same manner, a combination of a translation given by the vector $(u,v,w)$ and a linear transformation given by the $3\times 3$ matrices with the other entries.

• Thank you for the answer. it's really useful. – Rajendrasinh Parmar Jun 18 '15 at 3:59