According to the quadratic formula,
-b plus or minus √(b^2 - 4ac)
x = ----------------------------------------------
2a
In this particular case (x^2 - 10x + q), a = 1, b = -10, and c = q. Thus:
-(-10) plus or minus √(100-4q) 10 plus or minus √4√(25-q)
x = ---------------------------------------------- = ---------------------------------------------
2 2
and this reduces to:
x = 5 plus or minus √(25-q).
Assuming that 5 + √(25-q) is larger than 5 - √(25-q), we can write:
5 + √(25-q) - (5 - √(25-q)) = 6, or √(25-q) + √(25-q) = 6, or √(25-q) = 3.
Squaring both sides, we get: 25-q = 9, or
q = 16 (answer)
If q = 16, then the difference between the two roots will be +6.