Maxmin sum of squares construction 
In triangle ABC construct thru B a line so that the sum of squared
  distances from A and C to this line was MAX, MIN, or a given p*p.

How to do this construction?
 A: Let $y = Ax^2 + By + C$ be a quadratic curve with $A > 0$.
Fact-1: $A>0$ implies the curve concaves upward with a minimum occurs when $x = \frac {–B} {2A}$.
Fact-2: Intuitively, the above curve attains its maximum when $x -> ±∞$.
-----[For simplicity, we restrict ourselves to $+∞$ only.]
Consider figure 1:-

WLOG, we can assume $AC = 1$ unit. Let the required line be BP where is P divides CA internally in the ratio $CP : PA = x : (1 – x)$.
By similar triangles, $d_1 = kx$ and $d_2 = k(1 – x)$ for some non-zero proportional constant k.
∴ $D = d_1^2 + d_2^2 = k^2x^2 + k^2(1 – x)^2 = … = 2k^2x^2 – 2k^2x + k^2$; which is quadratic with ‘A’ > 0.
Applying fact-1, we have the min(D) is at $x = … = 1/2$. 
That is, P is midway between A and C.
[**If the red line is drawn outside the triangle, the result is the same by using a similar approach.]
For max(D), we use fact-2.
Geometrically, x is infinitely produced such that CA and BP will never meet.
That is, BP // CA. (See figure 2.)
Thus, $max(D) = …= 2h_B^2$; where $h_B$ is the altitude from B to CA (produced if necessary).
As for the $D = p^2$ part, I am still seeking help. See problem #688841. 
