Question 1173061
<pre>
{{{drawing(400,400,-6,6,-6,6, line(-6,0,6,0), line(0,-6,0,6),
circle(0,0,sqrt(8)),

locate(4,0,"(k,0)"),locate(0,4.5,"(0,k)"),locate(-5.45,0,"(-k,0)"),locate(0,-4,"(0,-k)"),arc(0,0,4,-2sqrt(12)),arc(0,0,2sqrt(12),-4),
line(-4,0,0,4), line(0,4,4,0), line(4,0,0,-4), line(0,-4,-4,0) )}}}

Solving the system:

{{{system(x^2/a^2+y^2/b^2=1,x+y=k)}}} 

gives

{{{(b^2+a^2)x^2-2a^2kx+a^2k^2-a^2b^2=0}}}

which you have found.  That is the quadratic equation

{{{Ax^2+Bx+C=0}}}, where

{{{A=b^2+a^2}}}, {{{B=-2a^2k}}}, {{{C=a^2k^2-a^2b^2}}}

Its discriminant is {{{B^2-4AC}}}. Substituting,

{{{(-2a^2k)^2-4(b^2+a^2)(a^2k^2-a^2b^2)}}}

which simplifies to 

{{{4a^2b^2(a^2 + b^2 - k^2)}}}

The discriminant must be 0 in order for there to be only one solution
where the ellipse just touches each side of the square at only one
point.

{{{4a^2b^2(a^2 + b^2 - k^2)=0}}}

can only be true if and only if

{{{a^2+b^2=k^2}}}

Any of the four lines x+y=k, x-y=k, -x+y=k,-x-y=k 
gives the same discriminant, when solved simultaneously with
the ellipse.

So {{{a^2+b^2=k^2}}} is the necessary and sufficient condition.

Edwin</pre>