Why transformation matrix has a last row of [0 0 1]? I'm trying to understand transformation matrices.
A rototranslation matrix has the following formula:
[ cos(theta)  -sin(theta)  x ]
[ sin(theta)   cos(theta)  y ]
[          0            0  1 ]

This matrix rotates a certain point theta radians with respect to the center and then translates it [x y]
In order to apply it to a 2D vector, we first increment its dimensionality and set the new dimension component to 1
[ ax ]       [ ax ]
[ ay ]   ->  [ ay ]
             [  1 ]

Then we do the product and we obtain
[ cos(theta)  -sin(theta)  x ]   [ ax ]     [ ax cos(theta) - ay sin(theta) + x ]
[ sin(theta)   cos(theta)  y ] * [ ay ]  =  [ ax sin(theta) + ay cos(theta) + y ] 
[          0            0  1 ]   [ 1  ]     [ 1 ]

And we obtain the rototranslated point, we just need to remove the extra dimension and we have it back to 2D
[ ax cos(theta) - ay sin(theta) + x ]       [ ax cos(theta) - ay sin(theta) + x ]
[ ax sin(theta) + ay cos(theta) + y ]  ->   [ ax sin(theta) + ay cos(theta) + y ]
[ 1 ]

I understand why we add this extra dimension to the vector, so we can not only rotate but also add a translation.
But I fail to see why the matrix has this extra row of [0 0 1]? Why we cannot simply do:
[ cos(theta)  -sin(theta)  x ]   [ ax ]     [ ax cos(theta) - ay sin(theta) + x ]
[ sin(theta)   cos(theta)  y ] * [ ay ]  =  [ ax sin(theta) + ay cos(theta) + y ] 
                                 [ 1  ]    

Am I missing something here?
 A: What you do is fine.
One reason I can see for using a $3\times 3$ matrix is that you might want to compose several of these transformations. Using the $3\times 3$ matrix, you translate your point at the beginning to $\mathbb{R}^{3}$, apply all these transformations, and then translate the resulting point back to $\mathbb{R}^{2}$.
Using the method you suggested, with $2\times 3$ matrices, you would have to translate your point to $\mathbb{R}^{3}$, apply the first transformation, translate the resulting point in $\mathbb{R}^{2}$ to $\mathbb{R}^{3}$ again, apply the second transformation, and so on.
A: The vectors you are operating on are of the form
$$v=\begin{pmatrix}a_x\\a_y\\1\end{pmatrix}$$
The purpose is to incorporate rotation and translation into one operation (matrix multiplication) with matrices of the form
$$M=\begin{pmatrix}
\cos \theta &-\sin\theta & t_x \\
\sin \theta &\cos\theta & t_y \\
0 & 0 & 1\\
\end{pmatrix}$$
Now we have $v\in\Bbb R^{3\times 1}$, and you want the result of the operation to be in the same space again, i.e. $Mv\in\Bbb R^{3\times 1}$ and where the 3rd component is just $1$.
If you drop the "superflouos" last line, you'd get $Mv\in\Bbb R^{2\times 1}$, so that it's no more possible to multiply that result with a matrix of type like $M$.
You could, of course, ditch any superflouos $0$'s and $1$'s altogether and express the one multiplication as two operations: A multiplication with a rotation matrix in $\Bbb R^{2\times 2}$ and addition of a translation vector in $\Bbb R^{2\times 1}$, but that would undo all the unification of representing rotation+shift under one umbrella.

Note: The operation can be regarded to take place in projective space $P\Bbb R^2$, but the argument stays the same.
A: I think a large part of the reason to specify a $3\times3$ matrix is in order to be able to describe the composition of transformations.
That is, if you say you are going to apply rototranslation $T_1,$
followed by rototranslation $T_2,$
the result is another rototranslation.
But exactly which rototranslation is it?
With $3\times3$ matrices, you simply take the matrix $M_1$ for $T_1$,
the matrix $M_2$ for $T_2$, and multiply them:
$$ M_3 = M_2 M_1. $$
(Note: the order is important.)
Now you have the matrix $M_3$ for the resulting rototranslation.
If you just apply one $2\times3$ matrix to a vector, then again augment the vector and apply another $2\times3$ matrix to it, you will find what the effect of the resulting rototranslation on the initial vector,
but you will not find a way to describe that rototranslation itself as a matrix.
Mathematically, you cannot multiply one $2\times3$ matrix by another $2\times3$ matrix, so the formula for getting the single matrix $M_3$ does not work.
In actual practice in software that does these kinds of transformations, you might actually not see the entire matrix literally stored in that format in memory,
because we know what the last row must be and how it will affect the product of two matrices. But that requires writing out different explicit formulas for each element of the resulting "matrix". Using $3\times3$ matrices when we work out these problems mathematically means we get to use a simple notation and a standard set of mathematical operations without continually having to write out all those low-level details.
