Find the shortest distance from the triangle with vertices $(1,1,0),(3,3,1),(6,1,0)$ to the point $(9,5,0)$ I have to find the shortest distance from the triangle with vertices in $(1,1,0),(3,3,1),(6,1,0)$ to the point $(9,5,0)$.
I cannot figure out how to do this. There are three possible cases: the minimum lies inside the triangle, on an edge or at a vertex. But what is a reasonable way to understand in which case we are?
 A: The plane $\pi$ through $(1,1,0),(3,3,1),(6,1,0)$ has equation $y-2z=1$, so it is perpendicular to the vector $(0,1,-2)$. There is an only value of $\lambda$ for which:
$$ (9,5,0)+\lambda (0,1,-2) \in \pi $$
and that gives the projection of $P=(9,5,0)$ on $\pi$, that is the point on $\pi$ with the minimal distance from $P$. If we solve the previous equation, we have that the projection of $P$ on $\pi$ lies in:
$$ Q = \left(9,\frac{21}{5},\frac{8}{5}\right)=-\frac{39}{25}(1,1,0)+\frac{8}{5}(3,3,1)+\frac{24}{25}(6,1,0) $$
i.e. outside the triangle made by $A=(1,1,0),B=(3,3,1),C=(6,1,0)$. This gives that the solution is not inside $ABC$, so it is somewhere on the perimeter of $ABC$, maybe in a vertex. Among $A,B,C$, the closest point to $Q$ is $C$. Let we compute the squared distance of a point of $BC$ from $P$:
$$ \|t(3,3,1)+(1-t)(6,1,0)-(9,5,0)\|_{2}^{2} = 25+2t+14t^2 $$
The RHS is obviously an increasing function on $[0,1]$, hence the optimal point on the $BC$ edge is the vertex $C$. The same happens for the $AC$ edge, while on the $AB$ edge the winner is the $B$ vertex, so the solution is given by the vertex $\color{red}{C}$, with distance $\color{red}{5}$ from $P$.
