How do I extract the factor in Mathematica

103 Views Asked by At

If I get a equation

$\left(\left(1-s_K\right) K^w+\left(1-s_L\right) L^w\right)\left(4 b a_m-4 a+2 b \tau +c \tau n^w-2 c n \tau \right)-\left(s_K K^w+s_L L^w\right)\left(4 b a_m-4 a+2 b \tau -c \tau n^w+2 c n \tau \right)$

, and how do I use Mathematica to change it into the following form?

$\left(K^w+L^w\right)\left(4 b a_m-4 a+2 b \tau +c \tau n^w-2 c n \tau \right)-\left(s_K K^w+s_L L^w\right)\left(\left(4 b a_m-4 a+2 b \tau +c \tau n^w-2 c n \tau \right)-\left(4 b a_m-4 a+2 b \tau -c \tau n^w+2 c n \tau \right)\right)$

Thx!