Sally paints a room in x hours, so she paints 1/x of the room in 1 hour.
Henry paints a room in x+8 hours, so he paints 1/(x+8) of the room in 1 hour.
Together they paint the room in 3 hours, so they paint 1/3 of the room in an hour.
1/x + 1/(x+8) = 1/3
Multiply each term by the least common multiple of the denominators (3x2 + 24x) to eliminate them.
3x + 24 + 3x = x2 + 8x
x2 + 2x - 24 = 0
(x + 6)(x - 4) = 0
x = -6, 4
Sally can't do it in negative time, so it takes her 4 hours by herself.