How to solve a linear equation with an unknown on both sides