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.
 A: Solve for $a$ in the second equation. Plug that into the first. Then solve for $b$. You get:
$b=A\pm \sqrt{A^2-B^2}$.
Plug in for $A=10x+y$ and $B=10y+x$ and expand. You get:
$b=10x+y\pm 3\sqrt{11(x^2-y^2)}$
The only multiples of 11 that are perfect squares are even powers of 11 times even powers of other primes. So, either $x^2=y^2$, which would give $A=B$, or $x^2-y^2=11$. Since $x,y \in \{1,2,3,4,5,6,7,8,9\}$, it is a simple matter of trial and error to find $6^2-5^2 = 36-25=11$.
Again with simple trial and error, you can verify that you cannot achieve $x^2-y^2$ to be 11 times some product of primes to even powers.
Edit: Check out this table of possible results:
http://www.wolframalpha.com/input/?i=Table%5BTable%5B(x,y,(x%5E2-y%5E2)%2F11),%7Bx,y%2B1,9%7D%5D,%7By,1,8%7D%5D
A: 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$.
A: Note that $$A+B = 11(x+y)$$
and $$A-B = 9(x-y)$$
where $$1\le y \le x \le 9$$
Considering all our options, we see $x+y=9$ and $x-y=1$ provides the  given solution of A=54 and B=45.  
A: 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.
