I don't see why the following equation is true - although wolfram-alpha gives me the same result, I can't figure out the steps that were made. Sure, we can simply divide the equation by $p_x$, but what happens when we also divide $(1 + {(1 - a) \over a})$?
$p_x$$x$ $(1 + {(1 - a) \over a})$ = $p_x w_x + p_y w_y$ $\Rightarrow$ $x$ = $a$ ${p_x w_x + p_y w_y } \over p_x$