I derived demand, given a Cobb-Douglas utility function but I am not really sure if I did it correctly. I am especially struggling with the sum signs and the subscripts of $i$ & $j$. It would be really great if someone could check. I want to maximize utility for 2 goods, here $j$ and $i$.
$\ u(x_i)=\prod_{i=1}^n x^a_i $
$\ s.t.:M=\sum_{j=1}^n p_jx_j $
$\ L= \sum_{i=1}^n a_ilogx_i+\lambda(M-\sum_{j=1}^np_jx_j) $
$ (1)\frac{\partial L}{\partial x_i} = \frac{a_i}{ x_i}-\lambda p_i=0$
$ (2)\frac{\partial L}{\partial x_j} = \frac{a_j}{ x_j}-\lambda p_j=0$
$ (3)\frac{\partial L}{\partial \lambda} = M-\sum_{j=1}^np_jx_j=0$
from (1) and (2) it follows:
$ \frac{p_i}{x_i} = \frac{a_i/x_i}{a_j/x_j}=\frac{a_ix_j}{a_jx_i}$
$ x_j = \frac{p_ja_jx_i}{p_ja_j}$
$ x_j$ into (3)
$ M = \sum_{j=1}^np_j(\frac{p_ja_jx_i}{p_j/a_j})=0$
$ x_i= \frac{a_iM}{\sum_{j=1}^na_jp_j}$
Furthermore I would like to interpret what happens if we have an efficency shock for good $i$. Meaning, good $i$ becomes cheaper. This leads to an increase in relative income. So $M$ increases which leads to an increased demand for good $x_i$, rest hold constant. Is that correct?