What is the value of D here? Number $S$ is obtained by squaring the sum of digits of a two digit number $D$. If the difference between $S$ and $D$ is $27$, then the two digit number $D$ is?
My thoughts:
Let the two digit number $D$ be $AB$. 
And so $S=(A+B)^2$
If $\,S-D=27,\,$ then $\,(A+B)^2 -AB=27$
$$A^2 + 2AB + B^2 - AB=27$$
Now how to obtain the value of $D$ further?
 A: To try and approach systematically: 
We know $|S-D|=27$. 
Let $D$ is comprised of the digits $A$ and $B$, with each of $A, B$ each a single digit integer. Let $A$ be the left-most digit (the "ten's digit of $D$), and let $B$ be the right-most digit (the "one's" digit of $D$). 
So $S = (A + B)^2$ and $D = 10 \cdot A + B.\;\;\;\;$(*)
Then 
$$|S - D| = 27 \iff  |(A + B)^2 - (10A + B)| = 27, \quad (0 < A < 10, \;0 \le B < 10)$$
$$\quad\quad\quad\quad\quad\quad\quad\quad\iff (A+B)^2 - (10A + B) = 27,\quad\text{OR}\quad (10 A + B) - (A + B)^2 = 27$$
$$\text{with}\quad(0 < A < 10, \;0 \le B < 10)$$
(*) For example, if $D = 54$, then $D = 5 \cdot 10 + 4$, $S = (5 + 4)^2 = 81,\; S - D = 27$; $\quad\;$ and if $D = 73 = 7\cdot 10 + 3\;\;, S = (7 + 3)^2 = 10^2 = 100; \;S - D = 27.$
A: I believe I see 2 solutions for this problem.  First let's redefine $D$ algebraicly as $D=10A+B$.  So our equation is
$$(A+B)^2-10A-B=27$$
I don't know if you know any modular arithmetic.  You may at least be aware of the divisibility test for $9$.  The sum of the digits of a number is closely related to its remainder when divided by $9$.  So it is a reasonable guess that we try to determine the remainder of both sides when divided by $9$.  This simplifies the equation to
$$(A+B)^2-A-B\equiv0\pmod9$$
$$(A+B)^2-(A+B)\equiv0\pmod9$$
$$(A+B)(A+B-1)\equiv0\pmod9$$
So we have the product of 2 consecutive integers has a remainder of $0$ when divided by $9$, or in other words this product is divisible by $9$. Since 2 consecutive numbers share no common factors besides $1$, either $A+B$ is divisible by $9$, or $A+B+1$ is divisible by $9$.  $D=99$ is too large and $D=10$ is too small, leaving 2 possibilities.
Our first possibility is $A+B=9$.  This gives us
$$S=9^2=81$$
$$D=S-27=81-27=54$$
Our second possibility is $A+B-1=9$ or $A+B=10$.  This yields
$$S=10^2=100$$
$$D=S-27=100-27=73$$
Both values check out.  $D$ is either $54$ or $73$.
A: it is: $81 = (5 + 4)^2$ and $81 - 54 = 27$. so the $S=81$ and $D=54$
