Show that the line through $P$ and $Q$ is perpendicular to the surface at $P$. Consider a smooth surface given by the function $z = f(x,y)$, such that the partial
derivatives of $f(x,y)$ exist. Suppose $Q$ is a point that does not lie on the surface,
and $P$ is the nearest point on the surface to $Q$. Show that the line through $P$ and
$Q$ is perpendicular to the surface at $P$.

The question is incorrect I am afraid. $Q$ also must be at a minimum distance to   the surface.
The required normal direction comes from cross-product $ \partial z / \partial x$ X $   \partial z / \partial y $
