When does $\frac{a+b}{2}$ and $\sqrt{ab}$ have inversed tens digits and ones digits? Let $a$ and $b$ be natural numbers, and

$$A = \frac{a+b}{2}$$
$$B = \sqrt{ab}$$

It's given that $A$ and $B$ are two-digit numbers such that the tens digit of $A$ is the same as the ones digit of $B$, and the tens digit of $B$ is the same as the ones digit of $A$.

So $A = 10x + y\;\,$and$\;B = 10y + x$.

Also given is $A\ne B$.

What is $a$ and $b$?

My teacher gave us the answer without explaining it as: $a = 98$ and $b = 32$, which makes $A = 65$ and $B=56$.

My question is: How do you prove this? I know $98 = 2\cdot 7^2$ and $32 = 2^5$, but I don't understand how to find this specific answer.

Since $a+b=2A$, and $ab=B^2$, it follows that $a,b$ are roots of the quadratic equation
$$t^2-(2A)t+B^2=0$$
so the discriminant
$$D=4(A^2-B^2)$$
must be a perfect square, hence $A^2-B^2$ must be a perfect square.

Also, since $A\ne B$, we get that $A^2-B^2$ is a nonzero perfect square.
\begin{align*}
\text{Then}\;\;A^2-B^2&=(A+B)(A-B)\\[4pt]
&=\bigl((10x+y)+(10y+x)\bigr)\bigl((10x+y)-(10y+x)\bigr)\\[4pt]
&=\bigl(11(x+y)\bigr)\bigl(9(x-y)\bigr)\\[4pt]
\end{align*}
hence $11(x+y)(x-y)$ must be a nonzero perfect square.

So we must have $x > y$, and at least one of the factors $(x+y),\;(x-y)$ must be a multiple of $11$. 

But $x-y$ can't be a multiple of $11$, since $1 \le x-y \le 8$.

Then since $3 \le x+y \le 17$, we get that $x+y=11$, and $x-y$ is a perfect square.

Of the pairs $(x,y)$ of digits 
$$(x,y) = (9,2),\;\;(x,y) = (8,3),\;\;(x,y) = (7,4),\;\;(x,y) = (6,5)$$
with $x > y$ and $x+y=11$, the pair $(x,y)=(6,5)$ is the only one for which $x-y$ is a perfect square.
