Indeed,

This \(\displaystyle kx-4\) can only be a tangent when the equation \(\displaystyle x^2+x=kx-4\) has exactly one solution, that is, like you stated when the discriminant of \(\displaystyle f(x)=x^2+(1-k)x+4=0\) is equal to zero.

Hence you must find k such that \(\displaystyle \Delta(f) = (1-k)^2-16= 0\)