Solve the differential equation, $$ z=\frac{\partial z}{\partial x}x + \frac{\partial z}{\partial y}y+ (\frac{\partial z}{\partial x})^2 + \frac{\partial z}{\partial x}\frac{\partial z}{\partial y}+ (\frac{\partial z}{\partial y})^2.$$
Can you please solve and explain the solution assuming that I don't have any idea.
For any function $\phi$ and coordinate variable $w$, we will use $\partial_w$ and $\phi_w$ as a shorthand of the differential operator $\frac{\partial}{\partial w}$ and the partial derivative $\partial_w \phi = \frac{\partial\phi}{\partial w}$.
Consider following change of variables
$$(x,y) = \left(\frac{\sqrt{3}u+v}{2}, \frac{\sqrt{3}u-v}{2}\right)\quad\iff\quad (u,v) = \left(\frac{x+y}{\sqrt{3}},x-y\right)$$
We have $$ \begin{cases} \partial_u &= \frac{\sqrt{3}}{2}(\partial_x + \partial_y)\\ \partial_v &= \frac12(\partial_x - \partial_y) \end{cases} \;\;\implies\;\; \begin{cases} u z_u + v z_v &= x z_x + y z_y\\ z_u^2 + z_v^2 &= \frac34(z_x + z_y)^2 + \frac14(z_x - z_y)^2 = z_x^2 + z_xz_y + z_y^2 \end{cases} $$
Let $\rho^2 = u^2 + v^2$ and $\varphi = z + \frac{\rho^2}{4}$. The PDE at hand can be transformed to
$$\begin{array}{rrcl} & z &=& uz_u + v z_v + z_u^2 + z_v^2\\ \iff & z + \frac{\rho^2}{4} &=& \left(z_u + \frac{u}{2}\right)^2 + \left(z_v + \frac{v}{2}\right)^2\\ \iff & \varphi &=& \varphi_u^2 + \varphi_v^2\tag{*1} \end{array} $$ The last equation in $\varphi$ has a trivial solution $\varphi \equiv 0$. This leads to one solution for $z$:
$$z = -\frac{\rho^2}{4} = -\frac{u^2+v^2}{4} = -\frac{x^2 - xy + y^2}{3}\tag{S.1}$$
On those places where $\varphi \ne 0$, we have $\varphi > 0$. Introduce another function $\psi$ such that $$\psi = \sqrt{4\varphi}\quad\iff\quad \varphi = \frac{\psi^2}{4}$$
the function $\psi$ will satisfy
$$|\nabla \psi|^2 = \psi_u^2 + \psi_v^2 = 1\tag{*2}$$
Conversely, given any solution of $(*2)$, the PDE in $z$ will have a solution of the from
$$z = \frac14(\psi^2 - \rho^2)\tag{*3}$$
For example,
$$\begin{align} z &= \frac14\left((u+\sqrt{3}(a+b))^2 + (v+(a-b))^2 - u^2 - v^2\right)\\ &= a x + b y + a^2 + ab +b^2 \end{align}\tag{S.2} $$
These $3$ solutions $(S.1)$, $(S.2)$ and $(S.3)$ are all the global solutions I can find. If one drop the requirement that $z$ is defined for all $(x,y)$, there are other ways to construct more solutions.
Let
Outside $K$, $d_K(p)$ is smooth, positive and $|\nabla d_K| = 1$. For any constant $\psi_0 \ge 0$, we can set $\psi$ to $d_k + \psi_0$ and use $(*3)$ to construct a solution for the PDE over there.