The Diophantine equation $x^2 - 97 - 40 = 0$ I am trying to determine whether the equation below  has a solution or not

$$x^2-97y-40 =0.$$

If a solution exists, $x^2-40$ must be congruent to 0 modulo $97$.

If I could show the congruence above implies that solution exists.

Thanks for your help...
$\newcommand{\kron}[2]{\left( \frac{#1}{#2} \right)}$

We are interested in the value of the Legendre symbol $\kron{40}{97} = \kron{8}{97} \kron{5}{97}$. In general, $2$ behaves differently from the rest of the primes.

By what is sometimes called the second supplemental law of quadratic reciprocity, we know that $\kron{2}{p} = (-1)^{(p^2-1)/8}$, or rather that $2$ is a square mod a prime iff that prime is congruent to $\pm 1 \pmod 8$. Since $97 \equiv 1 \pmod 8$, we see that $2$ is a square mod $97$. (Proofs of the second supplemental law can be found both here on MSE and on my site, and in most elementary number theory texts).

We must still consider $\kron{5}{97}$. By quadratic reciprocity, this is the same as $\kron{97}{5} = \kron{2}{5}$. The squares mod $5$ are $1$ and $4$ (or alternatively, $5$ is not congruent to $\pm 1 \pmod 8$), so $\kron{2}{5} = -1$.

In total, we have that $\kron{40}{97} = 1 \cdot -1 = -1$, which means that $40$ is not a square mod $97$. And so this quadratic Diophantine equation has no solution. $\diamondsuit$
you can use legendre symbol for calculating quadratic residue.so you need to compute (40/97).

  (40/97)=(2/97).(2/97).(2/97).(5/97)

        =(2/97).(5/97)

        =(97/2).(97/5)

        =(1/2).(2/5)

       =1.(-1)=-1


so 40 is not a quadratic residue mod 97.

no solution exists.