In my work which is related to user association with cellphone towers, I had the following optimization problem: 
and the Lagrangian function of this optimization problem is given as 
Also $\mu_{ij} = \text{log}\frac{r_{ij}}{P_i}$ and there are two expressions for $r_{ij}$ depending on value of $i$ and those are:
and
.
Also the expression of $P_i$ is 
My query is how the eq (13) is obtained from eq (8-12). Any help in this regard will be highly appreciated.