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.

Rearrange
$B=\sqrt{ab}$
to get
$B^2/a=b.$
Substitute in to get
$2A=a+B^2/a.$
Rearrange and solve:
$a^2-2Aa+B^2=0$
$(a-A)^2-A^2+B^2=0$
$a=A\pm\sqrt{A^2-B^2}.$
So we need $A^2-B^2=C^2$ for some $C$.
$(10x+y)^2-(10y+x)^2=C^2$
$((10x+y)-(10y+x))((10x+y)+(10y+x))=C^2$
$(9x-9y)(11x+11y)=C^2$
$3^211(x-y)(x+y)=C^2$
So we need $11(x-y)(x+y)$ to be a square for digits $x$ and $y$. Clearly we need one of the factors to be $\pm 11$ and the other to be $\pm 1$. Then since $x-y$ is smaller than $x+y$ we need $x-y=1$, $x+y=11$. Hence $x=6$ and $y=5$.
