In the field $\mathbb{Z_{19}}$, consider the equation $x^2+\bar{5}x-\bar{7}$. Let $r_1$ and $r_2$ be the roots of the equation. If the polynomial $P(x) = x^2+\bar{5}-\bar{7}$ is reducible, then the roots belong to $\mathbb{Z_{19}}$. If it is irreducible, then they belong in the Galois field $F = GF(19,P(x))$. Compute $r_1^2 + r_2^2$.
This is what I'm working on. In the class of $\mathbb{Z_{19}}$, we have the elements ${\bar 0,\bar 1,\bar 2,\bar 3,\bar 4...\bar {16},\bar {17},\bar {18}}$. So basically, I believe I have to find two solutions to the polynomial $P(x) = x^2+\bar{5}x-\bar{7}$. Or, in other words, $ x^2+\bar{5}x-\bar{7} \equiv 0$ (mod $19)$. I could use the trial and error method, but for future problems, what if I work with a different field with more elements in its class, such as $\mathbb{Z_{29}}$ for example? There must be an efficient way of finding these roots without doing the trail and error approach.
(Edited to incorporate some comments made after question was clarified.)
Notice that if $r_1 $ and $r_2$ are the two roots of the quadratic in a splitting field, then $$ (x - r_1)(x - r_2) = x^2 + \bar 5 x - \bar 7.$$
Therefore, $$ r_1 + r_2 = - \bar 5, \ \ \ \ \ r_1 r_2 = - \bar 7.$$
From here, we have $$ r_1^2 + r_2^2 = (r_1 + r_2)^2 - 2r_1 r_2 = (- \bar 5)^2 - 2 ( - \bar 7) = \bar 1 \in \mathbb Z_{19}.$$
In fact, the quadratic does not split in $\mathbb Z_{19}$. One easy way to see this is to complete the square, i.e. write it as $(x + \overline{12})^2 + \bar 1$. Now note that $- \bar 1$ is not a quadratic residue mod $19$, since $-1$ is the ninth power of the generator of the group of units mod $19$, and nine is odd. So the splitting field for the quadratic is the finite field of order $19^2$, and the roots $r_1$ and $r_2$ live in this splitting field.