To form the greatest number from the given digits, we have to arrange the digits in descending order keeping in mind that each digit is used at least once.
Number of digits given = Six (0, 8, 9, 7, 6, 4).
To form a 9-digit number, three more digits will be required. So, we will use the greatest digit (9) from the given digits in place of those three required digits to get the greatest 9-digit number.
The greatest 9-digit number will be: 999987640.
To form the smallest number from the given digits, we have to arrange the digits in the ascending order. If 0 is also there in the given digits, then it mustn't be placed at 1st position from the left as it will not give the required number of digits in final.
Here, given number of digits = 6.
So, to form the smallest 9-digit number, we will use the smallest digit (0) from the given digits in place of those three required digits.
The smallest 9-digit number will be: 400006789.
Difference = 999,987,640 - 400,006,789 = 599,980,851.