Let x = time it takes Kim when she works alone
Then, x - 3 = time it takes Sally if she works alone
1/x = amount done by Kim each hour
1/(x-3) = amount done by Sally in 1 hour
1/2 = amount done by both in 1 hour if they work together
Then, 1/x + 1/(x-3) = 1/2
Multiply by 2x(x-3) to get 2(x-3) + 2x = x(x-3)
4x - 6 = x2 - 3x
x2 - 7x + 6 = 0
(x-6)(x-1) = 0
x = 1 or x = 6
If x = 1, then x-3 is negative, which doesn't make sense, since x-3 is the number of hours that it takes for Sally to do the job alone.
So, x = 6 hours