This is how you get from your first equation to your second.
your utility function is $u(x_1, x_2)=x_1^a x_2^b$
since $a+b=1$ I'll change it slightly to a and (1-a)
In order to optimise these two choices, you need to maximise utility, wrt your choice variables.
subject to $p_1x_1 + p_2x_2 = w$
using Walras Law. Basically, in order to optimise utility, all money will be spent.
Cobb-Douglas functions are typically difficult for optimisation problems. A monotonic transformation which preserves the ordinal properties of the function can be used.
$aln(x_1) + (1 − a)ln(x_2)$
This will be used instead. The same budget constraint will be applied.
The Lagrange and First Order Conditions are Below
$L = aln(x_1) + (1 − a)ln(x_2) − \lambda(w − p_1x_1 − p_2x_2)$
$\frac{δL} {δx_1}= \frac{a} {x_1} − \lambda p_1 = 0$
$\frac {δL} {δx_2}=\frac{1 − a} {x_2} − \lambda p_2 = 0$
manipulating the First order conditions result in
$\lambda = \frac{a} {x_1p_1}$
$\lambda =\frac{(1 − a)}{ x_2p_2}$
$\frac{a} {x_1p_1}=\frac{(1 − a)}{ x_2p_2}$
substituting in the budget constraint $p_2x_2 = w − p_1x_1$
$\frac{a}{ x_1p_1}=\frac{(1 − a)} {w − p_1x_1}$
$x_1 =\frac{wa}{ p_1}$
and
$p_1x_1 = w − p_2x_2$
$\frac{a} {w − p_2x_2}=\frac{(1 − a)}{ p_2x_2}$
$w =\frac{a}{(1 − α)}p_2x_2 + p_2x_2$
$w(1 − a) = p_2x_2$
$x_2=\frac{w(1 − a)}{p_2}$
Using these results, we can work out the optimal consumption bundles of $x_1$ and $x_2$ for a given price, wealth combination.
$x_1 =\frac{wa}{ p_1}$
$x_2=\frac{w(1 − a)}{p_2}$