Proof $(k^2 - 4)x^2 +4k$ can be a perfect square only if $k$ is a perfect square.
$k$ and $x$ are positive integers.
I have come to this formula while solving 1988 IMO #6 without using Vieta jumping, which means
$$ \frac{x^2+y^2}{xy+1} = k $$
can be expressed as
$$ y = \frac{1}{2} \left(k x - \sqrt{4 k - 4 x^2 + k^2 x^2} \right) $$
I thought if $4 k - 4 x^2 + k^2 x^2$, which is $(k^2 -4)x^2 +4k$ is a perfect square, eventually, $k$ will be an integer.
Let $\,a,k,x\,$ be positive integers, that is, $\,a,k,x\in\mathbb N\,.$
So far I cannot give a complete answer, but I will prove that
$\left(k^2-4\right)x^2+4k=a^2\;\implies\;k\leqslant x^2\,.\quad\color{blue}{(*)}$
Proof :
If $\;k>x^2\,,\,$ then
$\big(kx\big)^2\!\!<k^2x^2-4x^2+4k=a^2<k^2x^2+4kx<\!\big(kx+2\big)^2\;\;,$
therefore , $\;\;a^2=\big(kx+1\big)^2\;\;,$
$k^2x^2-4x^2+4k=k^2x^2+2kx+1\;\;\;,$
$4\big(k-x^2\big)=2kx+1\;\;\;,$
which is impossible because the LHS is an even number but the RHS is an odd number.
Addendum :
Now, I will prove that
$\left(k^2-4\right)x^2+4k=a^2\;\implies\;k=\lambda^2\;\;$ where $\;\lambda\in\mathbb N\,.$
Proof :
There are two possible cases :
$1)\quad1\leqslant k\leqslant 3\;;$
$2)\quad k\geqslant4\;.$
$\color{brown}{\text{Case }1) :}$
If $\;1\leqslant k\leqslant 3\;,\;$ then $\;k=1\;,\;$ indeed
$k=2\implies8=a^2\;$ which is impossible in $\;\mathbb Z_3\;,$
$k=3\implies5x^2+12=a^2\;$ which is impossible in $\;\mathbb Z_5\;.$
Hence, in the first case, it results that
$k=\lambda^2\;$ where $\;\lambda=1\in\mathbb N\,.$
$\color{brown}{\text{Case }2) :}$
From $\;(*)\;,\;$ it follows that $\;4\leqslant k\leqslant x^2\;,\;$ therefore ,
$\big(k\!-\!1\!\big)^2\!x^2<\left(k^2\!-\!4\right)\!x^2<a^2=k^2x^2+4\!\left(k\!-\!x^2\right)\leqslant k^2x^2\;,$
hence ,
$kx-x<a\leqslant kx\;,$
consequently ,
$0\leqslant\dfrac{kx-a}2<\dfrac x2\;.$
Since $\;k^2x^2-a^2=4\left(x^2-k\right)\;$ is an even integer, then $\;k^2x^2\,,\;a^2\;$ are both even integers or $\;k^2x^2\,,\;a^2\;$ are both odd integers, consequently ,
$kx\;,\;a\;$ are both even integers or $\;kx\;,\;a\;$ are both odd integers, but in any case it results that
$kx-a\;$ is an even integer.
Let $\;x_1=\dfrac{kx-a}2\in\mathbb N\cup\big\{0\big\}\;.$
If $\;x_1=0\;,\;$ then $\;a=kx\;$ and $\;k=x^2\;,\;$ therefore
$k=\lambda^2\;$ where $\;\lambda=x\in\mathbb N\;.$
If $\;x_1\geqslant1\;,\;$ it results that
$\begin{align} &16<\left(k^2-4\right)x_1^2+4k=\\ &=k^2x_1^2-\big(kx-a\big)^2+4k=\\ &=k^2x_1^2-k^2x^2-a^2+2akx+4k=\\ &=k^2x_1^2-k^2x^2-\left(k^2x^2-4x^2+4k\right)+2akx+4k=\\ &=k^2x_1^2-2k^2x^2+4x^2+2akx=\\ &=k^2x_1^2-4kx\left(\dfrac{kx-a}2\right)+4x^2=\\ &=\big(kx_1-2x\big)^2\;. \end{align}$
Let $\;a_1=\big|kx_1-2x\big|\quad\big(\implies a_1\in\mathbb N\;\land\;a_1>4\big).$
It results that
$\left(k^2-4\right)x_1^2+4k=a_1^2\quad$ where $\quad1\leqslant x_1<\dfrac x2\;.$
Moreover, from $\;(*)\;$ with $\;x=x_1\;$ and $\;a=a_1\;,\;$ it follows that $\;4\leqslant k\leqslant x_1^2\;.$
By proceeding analogously, we obtain two finite sequences $\big\{x_1,x_2,\ldots,x_n,x_{n+1}\big\}\subseteq\mathbb N\!\cup\!\big\{0\big\}\;$ and $\;\big\{a_1,a_2,\ldots,a_n\big\}\subseteq\mathbb N\;$ such that
$\left(k^2-4\right)x_1^2+4k=a_1^2\quad$ where $\quad1\leqslant x_1<\dfrac x2<x\;,$
$\left(k^2-4\right)x_2^2+4k=a_2^2\quad$ where $\quad1\leqslant x_2<\dfrac{x_1}2<x_1\;,$
………………………………………………………………
$\left(k^2-4\right)x_n^2+4k=a_n^2\quad$ where $\quad1\!\leqslant\!x_n\!<\!\dfrac{x_{n-1}}2\!<\!x_{n-1}\,,$
$0=x_{n+1}=\dfrac{kx_n-a_n}2<\dfrac{x_n}2<x_n\;.$
Therefore ,
$a_n=kx_n\;\;$ and $\;\;k=x_n^2\;,$
consequently ,
$k=\lambda^2\;$ where $\;\lambda=x_n\in\mathbb N\;.$