# Find all the numbers $\overline{abcd}$ (4-digit number in base 10) that check the relationship. $5a^2+5b^2+2c^2+2d^2-2ac-2cd-4ab-4bd-16a+16b-4d+20=0$

the question

Find all the numbers $$\overline{abcd}$$ (4-digit number in base 10) that check the relationship. $$5a^2+5b^2+2c^2+2d^2-2ac-2cd-4ab-4bd-16a+16b-4d+20=0$$

my idea

I tried grouping them in a whole perfect square or I tried using formulas such as

$$a^2+2ab+b^2=(a+b)^2$$

$$a^2-2ab+b^2=(a-b)^2$$

I tried many of this variants but none of them got me to a useful form.

I don't know where to start! THope one of you can help me! Thank you!

• what is d? please elaborate as you gave the number as $\overline{abc}$, so should the number be $\overline{abcd}$? Commented Feb 7 at 17:24
• @peterwhy see the edited. sorry for my misspelling. Commented Feb 7 at 17:35
• @SarbanBhattacharya see the edited. sorry for my misspelling Commented Feb 7 at 17:36
• I do not see any useful sort of pattern and would resort to coding a brute force search. In doing so, you can find the only solution is $2022$. Commented Feb 7 at 17:37
• @Dan Yes, it is! Commented Feb 8 at 7:33

The given expression can be written $$(a-c)^2 +(c-d)^2 + (2a-b-4)^2 + (2b-d+2)^2$$ Knowing this is zero, immediately gives us $$\overline{abcd}=2022$$ I confess that it took me a while to find this - annoyingly WA was no help.
• You should preferably use $\overline{abcd} \$ in place of $abcd$. Commented Feb 7 at 19:01
• nice idea...I wrote software for what Kap called a "homothety" meaning take symmetric integer matrices $A,B,$ find out if there are any matrices $P$ of integers with $P^T A P = B$ where I also supply a bound on the absolute values of the entries of $P.$ Taking just the quadratic form part only, it returns exactly your expression (without the constants $-4,2$ ). If I'd thought to check that.... Commented Feb 7 at 20:36
Complete square with respect to $$a$$, then $$b$$, then $$c$$, then $$d$$. The left side turns out to be $$5 \left(a -\frac{2 b}{5}-\frac{c}{5}-\frac{8}{5}\right)^{2} + \frac{21}{5} \left(b -\frac{2 c}{21}+\frac{8}{7}-\frac{10 d}{21}\right)^{2} + \frac{37}{21} \left(c -\frac{24}{37}-\frac{25 d}{37}\right)^{2}+ \frac{9}{37} \left(d -2\right)^{2}$$ and the unique solution to the equations \eqalign{a -\frac{2 b}{5}-\frac{c}{5}-\frac{8}{5} &= 0\cr b -\frac{2 c}{21}+\frac{8}{7}-\frac{10 d}{21} &= 0\cr c -\frac{24}{37}-\frac{25 d}{37} &= 0\cr d - 2 &= 0\cr} is $$a = 2$$, $$b = 0$$, $$c = 2$$, $$d = 2$$.