I understand the traditional way(use similar triangle and make depth value linear) to deduce the perspective projection matrix. But I want to try another approach after I read this text: Fundamentals of Texture Mapping and Image Warping.
On page 17, it says that a quad can be mapped to a square using projective transformation, which can be expressed as a rational linear mapping:
$$\mathit{x} = \frac{\mathit{a}\mathit{u} + \mathit{b}\mathit{v} + \mathit{c}} {\mathit{g}\mathit{u} + \mathit{h}\mathit{v} + \mathit{i}}\\ \mathit{y} = \frac{\mathit{d}\mathit{u} + \mathit{e}\mathit{v} + \mathit{f}} {\mathit{g}\mathit{u} + \mathit{h}\mathit{v} + \mathit{i}}$$
After I substitute four vertices of the quad and square, I get a linear system. By solving the linear system I can get the projective transformation matrix.
Similarly, I conceive that a 3D projective mapping can be denoted as a rational linear mapping as well. And this rational linear mapping can map a frustum to a NDC cube.(note that because of the use of homogeneous coordinate, the last element of matrix(right bottom one) can be set to 1)
$$ \mathit{x} = \frac{\mathit{a}\mathit{u} + \mathit{b}\mathit{v} + \mathit{c}\mathit{w} + \mathit{d}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1}\\ \mathit{y} = \frac{\mathit{e}\mathit{u} + \mathit{f}\mathit{v} + \mathit{g}\mathit{w} + \mathit{h}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1}\\ \mathit{z} = \frac{\mathit{i}\mathit{u} + \mathit{j}\mathit{v} + \mathit{k}\mathit{w} + \mathit{l}} {\mathit{m}\mathit{u} + \mathit{n}\mathit{v} + \mathit{o}\mathit{w} + 1} $$
But when I try to solve this system, the result matrix is not as same as the one in 3D API(like OpenGL) specification.
My question is: is there any extra properties of a perspective projection matrix that a rational linear mapping does not have?
EDIT: I found that in the 2D version we have 8 unknowns(3*3, and one matrix element set to 1 excluded), which equals exactly the number of equations in the linear system(4 vertices in a quad, and 2 corrdinate components in each of them). However in the 3D version, the number of unknowns and the number of equations does not match. I suspect I misunderstand the rational linear mapping, and the reason why it can applied to a 2D version is just a coincidence. I will do more learn on this topic.