Transform a point into another point I have the following problem:

Give a matrix that will transform the point $(x,y,z)$ into the point $(\frac{2}{x+y}, \frac{5y + z}{2x + 2y}, 3)$.

I have been reading my book to find a way to solve it without success. I will very much appreciate your feedback about how to solve it.
The hint with the perspective division was already mentioned by ratchet freak, but I'd like to add some explanation of how to come up with the solution.



First of all, remember that homogenous coordinates add a fourth value $w$ to your 3D vector. For points in the 3D space, $w \neq 0$ holds and $[x, y, z, w] = [n*x, n*y, n*z, n*w]$ also holds for every $n$.

Now the goal is to find a transformation matrix $T$, which solves

$$
    \begin{bmatrix} \frac{2}{x + y} \\ \frac{5y + z}{2x + 2y} \\ 3 \\ 1 \end{bmatrix}
= T \cdot 
\begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}
=
\begin{bmatrix} t_{11} &amp; t_{21} &amp; t_{31} &amp; t_{41}  \\ t_{12} &amp; t_{22} &amp; t_{32} &amp; t_{42} \\ t_{13} &amp; t_{23} &amp; t_{33} &amp; t_{43} \\ t_{14} &amp; t_{24} &amp; t_{34} &amp; t_{44} \end{bmatrix}
\cdot \begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}
$$

These are basically four equations, but having a look at the first row, being

$$\frac{2}{x + y} = t_{11}\cdot x + t_{21}\cdot y + t_{31} \cdot z + t_{41}$$

and trying to find values for the $t$s, you'll see that this is not possible without further restructuring. The main problems are the $x$ and $y$ in the denominator. But as we can make use of the fourth value in the vector, we can expand the $w$.

$$
\begin{bmatrix} \frac{2}{x + y} \\ \frac{5y + z}{2x + 2y} \\ 3 \\ 1 \end{bmatrix}
=
\begin{bmatrix} \frac{2}{x + y} \\ \frac{2.5y + 0.5z}{x + y} \\ 3 \\ 1 \end{bmatrix}
=
\begin{bmatrix} 2 \\ 2.5y + 0.5z \\ 3(x + y) \\ x + y \end{bmatrix}
$$

In the first step, I removed the factor of $2$ from the second values denominator, leading to every values denominator either being $1$ or $(x + y)$. In the second step, I made use of the above mentioned rule ($[x, y, z, w] = [n\cdot x, n\cdot y, n\cdot z, n\cdot w]$), setting $n = (x + y)$, thus eliminating the denominator of the first two values.

Now we've got

$$
\begin{bmatrix} 2 \\ 2.5y + 0.5z \\ 3(x + y) \\ x + y \end{bmatrix}
=
\begin{bmatrix} t_{11} &amp; t_{21} &amp; t_{31} &amp; t_{41}  \\ t_{12} &amp; t_{22} &amp; t_{32} &amp; t_{42} \\ t_{13} &amp; t_{23} &amp; t_{33} &amp; t_{43} \\ t_{14} &amp; t_{24} &amp; t_{34} &amp; t_{44} \end{bmatrix}
\cdot
\begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}
$$

which is not that hard anymore.

$$
\begin{bmatrix} 2 \\ 2.5y + 0.5z \\ 3(x + y) \\ x + y \end{bmatrix}
=
\begin{bmatrix} 0  &amp;  0 &amp;   0  &amp;  2   \\ 0 &amp;  2.5 &amp; 0.5 &amp;  0 \\ 3 &amp;   3  &amp;  0 &amp;   0 \\ 1  &amp;  1  &amp;  0  &amp;  0 \end{bmatrix}
\cdot
\begin{bmatrix} x \\ y \\ z \\ 1 \end{bmatrix}
$$



TL;DR


Remember the advantage of homogenous coordinates $w$.
$[x, y, z, w] = [n\cdot x, n\cdot y, n\cdot z, n\cdot w]$ is the key.
Push everything that's in the denominator to the $w$ coordinate.