Finding the remainder. Let $a,b$ be positive integers such that $7$ divide $a^2+b^2$ .How to find the remainder when we divide $ab-1$ by $7$
 A: Note that $7$ divides $a^2+b^2$ if and only if $7$ divides both $a$ and $b$.
You can prove this in two ways. One way is to calculate $a^2+b^2$ modulo $7$ for all possibilities. This is not as tedious as it sounds, since a square is congruent to $0$, $1$, $4$, or $2$ modulo $7$. No sum of these is congruent to $0$ modulo $7$ except $0+0$.
Or else we can appeal to the general theorem that if $p$ is a prime of the form $4k+3$, then $-1$ is not a quadratic residue of $p$. If $a^2+b^2\equiv 0\pmod{p}$, then $b^2\equiv -a^2\pmod{p}$. If $b\not\equiv 0\pmod{p}$, then multiplying both sides by the inverse of $b$ modulo $p$, we would obtain $(ab^{-1})^2\equiv -1\pmod{p}$, contradicting the fact that $-1$ is not a quadratic residue of $p$. Thus the modular inverse of $b$ cannot exist, and therefore $b\equiv 0\pmod{p}$. Similarly, $a\equiv 0\pmod{p}$.
A: Hint $\rm\: mod\ 7\!:\ a^2\!+b^2\equiv 0\,\Rightarrow\,a,b\equiv 0,\:$  else $\rm\,a^2\! = -b^2\Rightarrow\:a^6\equiv -b^6\,\Rightarrow\,1\equiv -1,\,$ by little Fermat.
A: $a^2+b^2\equiv0(mod7) \Rightarrow a^2\equiv0(mod7)$ , $b^2\equiv0(mod7)$
Since 7 is a prime, 
$a^2\equiv0(mod7)  \Rightarrow a\equiv0(mod7)$
$b^2\equiv0(mod7)  \Rightarrow b\equiv0(mod7)$
$ab\equiv0(mod7)$
$ab-1\equiv-1(mod7)\Rightarrow ab-1\equiv6(mod7)$ 
Therefore, the remainder is $6$ .
A: Answer is 6
a^2+b^2+2=(a+b)^2-2ab+2
2(ab-1)=(a+b)^2-(a^2+b^2)-2
        =49d+7k-2
ab-1=7[k+7d]/2-1=7[k+7d]/2-7+6
Note that both a,b are divisible by 7
Assume if not a=7n+1,7n+2,7n+3,b=7m+1,7m+2,7m+3,etc. and check
