Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Jose is given two 2-digit numbers AB and CD where (A, B, C, and D represent unique digits) and is told to find the difference between the squares of these numbers. However, Jose has dyslexia and reverses the digits of each number before finding the difference between the squares. Miraculously, Jose gets the correct answer nonetheless. Find the answer Jose obtained.

Hint: AB is a number that can be expressed as 10A + B.

share|cite|improve this question
up vote 4 down vote accepted

Let’s assume that the two-digit number $AB$ is greater than or equal to the two-digit number $CD$. The actual values of these numbers are $10A+B$ and $10C+D$, so the difference of their squares is $(10A+B)^2-(10C+D)^2$. If we reverse the digets to get $BA$ and $DC$, the values of these numbers are $10B+A$ and $10D+C$, and the difference of their squares is either $(10B+A)^2-(10D+C)^2$ or $(10D+C)^2-(10B+A)^2$, depending on which is larger.

In the first case, in which $BA$ is at least as large as $DC$, we have $$(10A+B)^2-(10C+D)^2=(10B+A)^2-(10D+C)^2\;,$$ or, after multiplying out the squares, $$\begin{align*}100A^2&+20AB+B^2-100C^2-20CD-D^2\\ &=100B^2+20AB+A^2-100D^2-20CD-C^2\;; \end{align*}$$

simplifying this yields the much nicer $$99A^2-99B^2=99C^2-99D^2\;,$$ or simply $A^2-B^2=C^2-D^2$. It may be helpful to rewrite this as $A^2+D^2=B^2+C^2$. Now you can simply look at the sums of the squares of the digits, as in the following table. I’ve blanked out the cases in which the two digits are identical, and I’ve included only the second one of pairs like $1^2+2^2$ and $2^1+1^2$.

$$\begin{array}{r|c} &\color{blue}{0}&\color{blue}{1}&\color{blue}{4}&\color{blue}{9}&\color{blue}{16}&\color{blue}{25}&\color{blue}{36}&\color{blue}{49}&\color{blue}{64}\\ \hline \color{blue}{1}&1\\ \hline \color{blue}{4}&4&5\\ \hline \color{blue}{9}&9&10&13\\ \hline \color{blue}{16}&16&17&20&\color{red}{25}\\ \hline \color{blue}{25}&\color{red}{25}&26&29&34&41\\ \hline \color{blue}{36}&36&37&40&45&52&61\\ \hline \color{blue}{49}&49&50&53&58&\color{red}{65}&74&\color{red}{85}\\ \hline \color{blue}{64}&64&\color{red}{65}&68&73&80&89&100&113\\ \hline \color{blue}{81}&81&82&\color{red}{85}&90&97&106&117&130&145 \end{array}$$

The sums that appears in two different places are $\color{red}{25}$, $\color{red}{65}$, and $\color{red}{85}$, corresponding to $$\begin{align*}3^2+4^2&=0^2+5^2\;,\tag{1}\\ 4^2+7^2&=1^2+8^2\;,\text{ and}\tag{2}\\ 6^2+7^2&=2^2+9^2\;.\tag{3} \end{align*}$$

We’ll take them in order. In $(1)$ the $0$ cannot be $A$ or $C$, since these are supposed to be genuine two-digit numbers. If $B=0$, then $C=5$; in that case $A$ must be $2$ or $3$, and $AB$ is smaller than $CD$, contrary to our original assumption. Thus, $D=0$, $A=5$, and our numbers are either $AB=53$ and $CD=40$, or $AB=54$ and $CD=30$. Both of these pairs work: $$53^2-40^2=2809-1600=1209=1225-16=35^2-4^2\;,$$ and $$54^2-30^2=2916-900=2016=2025-9=45^2-3^2\;.$$

In $(2)$ the possibilities are $AB=87$ and $CD=41$, $AB=84$ and $CD=71$, $AB=78$ and $CD=14$, and $AB=48$ and $CD=17$. (Note that the last two are the reversals of the first two; they are still distinct solutions, however.)

Similarly, in $(3)$ the possibilities are $AB=97$ and $CD=62$, $AB=96$ and $CD=72$, and the reversals $AB=79$ and $CD=26$, and $AB=69$ and $CD=27$.

Altogether we have the following ten pairs of numbers as solutions:

$$\begin{array}{} (54,30)&(53,40)\\ (87,41)&(84,71)&(78,14)&(48,17)\\ (97,62)&(96,72)&(79,26)&(69,27) \end{array}$$

The corresponding differences of squares are:

$$\begin{array}{} 2016&1204\\ 5888&2015&5888&2015\\ 5565&4032&5565&4032 \end{array}$$

Thus, there are (at least) six answers that Jose could have obtained.

In the second case, in which $BA$ is smaller than $DC$ we have $$(10A+B)^2-(10C+D)^2=(10D+C)^2-(10B+A)^2\;;$$ if we attempt the same approach, we get

$$\begin{align*}100A^2&+20AB+B^2-100C^2-20CD-D^2\\ &=100D^2+20CD+C^2-100B^2-20AB-A^2\;, \end{align*}$$

or $$101A^2+40AB+101B^2=101C^2+40CD+101D^2\;.$$

This time the mixed products don’t disappear, and I see no simple way to investigate possible solutions.

share|cite|improve this answer
If you will not accept the original question being $35^2 - 04^2$ or $45^2 - 03^2$, then I do not see how you can accept $53^2 - 40^2$ or $54^2 - 30^2$ since José will then face an unacceptable question an realise an error. Nor do I think there are any examples for your second case. – Henry Apr 5 '12 at 7:44
@Henry: I thought about it but decided to leave that one in as a borderline case and let the OP decide how to interpret it. I probably should have said so, and I’m not at all sure that I’d not decide differently were I to do it again, but these comments are probably sufficient prophylaxis for me to leave it as is. I suspect that you’re right about the second case, but I didn’t pursue it; I mentioned it mostly to emphasize the rather unsatisfactory nature of the problem. – Brian M. Scott Apr 5 '12 at 7:52

Hint: You can write it as $(10A+B)^2-(10C+D)^2=(10B+A)^2-(10D+C)^2$. Now expand, collect terms and something miraculous happens.

share|cite|improve this answer
....and you might just as well have spoken of a sum of squares rather than of a difference of squares $48^2+71^2$ $=84^2+17^2.$ – Michael Hardy Apr 4 '12 at 23:17
I did that and in the end I got 100( A^2 - B^2 - C^2 + D^2) = A^2 - B^2 - C^2 + D^2 – Constanza Apr 4 '12 at 23:30
@Constanza: that is equivalent to $99(A^2 - B^2 - C^2 + D^2)=0$ and you can divide both sides by $99$ – Henry Apr 4 '12 at 23:32
Thank you everyone. – Constanza Apr 4 '12 at 23:57

Even if $A,B,C,D$ must be distinct and non-zero, I seem to have four sets of solutions (or perhaps two pairs of sets) to $A^2-B^2=C^2-D^2$, such as

$$8^2-7^2 = 15 =4^2-1^2 \text{ so } 87^2-41^2 = 5888 = 78^2-14^2$$

$$8^2-4^2 = 48 = 7^2-1^2 \text{ so }84^2-71^2 = 2015 = 48^2-17^2$$

$$9^2-7^2 = 32 =6^2-2^2 \text{ so }97^2-62^2 = 5565 = 79^2-26^2$$

$$9^2-6^2 = 45 =7^2-2^2 \text{ so } 96^2-72^2 = 4032 = 69^2-27^2$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.