You would have to take the following steps to answer this question.
1. 2x + 4 = gx [I just switched the order around for the xg to make it easier]
- Subtract gx from both sides.
2. 2x - gx + 4 = 0
- Combine the 2x and gx and subtract 4 from both sides.
3. (2 - g)x = -4
- Divide both sides by 2 - g.
4. x = -4/(2 - g)
I hope this helps!