As seen on projective geometry the perspective phenomenon is where an object appears to be smaller the further away is from the point of view
We can again use some concepts of projective geometry to understand perspective projection, particularly the fact that any object in our 3D world is represented in the 4D projective hyperplane by the homogeneous coordinate $(x, y, z, 1)$, now any finite point with $w \not = 1$ can be projected to the 4D hyperplane $w = 1$ by dividing each coordinate by $w$ i.e. $(\tfrac{x}{w}, \tfrac{y}{w}, \tfrac{z}{w})$, a key observation in the values of $w$ is that the higher the value of $w$ the smaller the object will be when they get projected to the $w=1$ hyperplane
Perspective is implemented in 3D by using a transformation matrix that changes the value of $w$ based on how far the object is ($z$-coordinate)
Now let’s imagine that we want to project the points that exists in our world to the plane $z = d$
By similar images we can see that the projected value of the $y$ coordinate is
The projected value of the $x$ coordinate can be computed in a similar way
The projected value of the $z$ coordinate is the same for all the points
Summarizing
Manipulating the last equation so that it has a common denominator
The point above expressed in 4D homogeneous coordinates is
Finally the transformation matrix that transforms $\mathbf{v}$ to $\mathbf{v’}$ is