# Minimum Difference between two special numbers

a,b,c,d are different numbers from each other and 0. abcd is a 4 digits number. ab and cd are two digits numbers.

what should be a,b,c,d to make abcd-(ab*cd) minimum?

(Note: I'm assuming that "$ab$" refers to the two-digit number $10a+b$ and not to $a\times b$, and similarly that $abcd$ refers to the four digit number whose digits are $a,b,c,d$, since otherwise the question makes no sense.)

$a=1,b=2,c=9,d=8$

so that

$abcd=1298$, $ab\times cd=1176$, $abcd-ab\times cd = 122$

and this is the minimum that's possible to achieve, because

Write the quantity we're trying to minimize as

$abcd-ab\times cd=(ab\times100+cd)-ab\times cd=ab\times(100-cd)+cd$.

This shows that the dependence on $a$ and $b$ is such that it pays to take $ab$ as small as possible, namely $a=1$, $b=2$, $ab=12$. Then, rewrite the quantity yet again as

$abcd-ab\times cd=(ab\times100+cd)-ab\times cd=ab\times100-(ab-1)\times cd$

which shows that it pays to take $cd$ as large as possible, namely $c=9$, $d=8$, $cd=98$.

• Correct answer. – Oray Jan 17 '16 at 22:59