Supose that the line divedes the line segment joining (-3,1) and ( 8,9) in the ratio k:1 in the point P(say).
using the section formula, we get,
the coordinates of P are
But P must lie o the line x-y-2=0
So, the coordinates of P must satisfy the equation x-y-2=0
So, substitute the coordinates of P in this equation and you will get the value of k.
That will give you the required ratio k:1