How to compute elasticity of substitution in labor market of blacks and whites using experience-education groups? I'm reading &quot;Competition in the Promised Land – Black Migrants in Northern Cities and Labor Markets&quot;, by Leah Boustan, and I'm trying to understand her computation of black and white elasticity of substitution in labor market
She uses a Cobb-Douglas function:
$$Y=AL^{\alpha}K^{1-\alpha}$$
and then defines aggregate labor as:
$$L=\left(\sum_{e=1}^{n} \left(L_{e} \theta_{e}\right)^{\frac{\delta - 1}{\delta}}\right)^{\frac{\delta}{\delta - 1}}$$
aggregate labor by educational group as:
$$L_{e}=\left(\sum_{\substack{1 \leq e \leq n\\1 \leq x \leq m}} \left(L_{ex} \theta_{ex}\right)^{\frac{\eta - 1}{\eta}}\right)^{\frac{\eta}{\eta - 1}}$$
and aggregate labor by experience and educational group by:
$$\left(\left(L_{exb} \theta_{exb}\right)^{\frac{\sigma - 1}{\sigma}} + \left(L_{exw} \theta_{exw}\right)^{\frac{\sigma - 1}{\sigma}}\right)^{\frac{\sigma}{\sigma - 1}}
$$
Then she derivates the production function relative to $L_{exr}$ (where $r=w,b$) and obtains:
$$ln w_{exr}=ln(A^{\frac{1}{\alpha}}k^{\frac{(1-\alpha)}{\alpha}})+\frac{1}{\delta}\cdot ln(L)+ln\theta_{e}-(\frac{1}{\delta}-\frac{1}{\eta})\cdot ln(L_{e})+ln\theta_{ex}-(\frac{1}{\eta}-\frac{1}{\delta})\cdot ln(L_{ex})+ln\theta_{e_{exr}}-\frac{1}{\delta}\cdot ln(L_{exr})$$
I cannot figure out how to reach this expression. I thought what I need is just 1) to substitute the L terms backwardly, 2) take the derivative, and 3) apply log. The substitution gives:
$$A K^{1 - \alpha} \left(\left(\sum_{e=1}^{n} \left(\theta_{e} \left(\sum_{\substack{1 \leq e \leq n\\1 \leq x \leq m}} \left(\theta_{ex} \left(\left(L_{exb} \theta_{exb}\right)^{\frac{\sigma - 1}{\sigma}} + \left(L_{exw} \theta_{exw}\right)^{\frac{\sigma - 1}{\sigma}}\right)^{\frac{\sigma}{\sigma - 1}}\right)^{\frac{\eta - 1}{\eta}}\right)^{\frac{\eta}{\eta - 1}}\right)^{\frac{\delta - 1}{\delta}}\right)^{\frac{\delta}{\delta - 1}}\right)^{\alpha}
$$
But the derivative of this expression relative, for example, to $L_{exb}$ is a equation very different from the expression showed by the author (even after the log).
I must be making a very silly mistake here, but how can I get the desired expression from the equations of L? Is there a textbook where I can find a discusson about elasticity of substitution between demographic groups?
EDIT:  paper version of this part of the book can be found here. In my research I noted that Boustan's work is based on Ottaviano (2006), and Card and Lemieux (2001).
Here is a jupyter notebook with the equations
I dont want to be rude but the only equation you copied correctly is the
productivity augmented Cobb-Douglas production function.
Equation 2 is equation 2 from Ottaviano, Peri (2008) (on page 8) it says:
$$L=\left(\sum_{e=1}^{n} \theta_{e}L_{e}^{\frac{\delta - 1}{\delta}}\right)^{\frac{\delta}{\delta - 1}}$$.
In the remaining equations $\theta$ is not under the exponent as well:
$$L_{e}=\left(\sum_{\substack{1 \leq e \leq n\\1 \leq x \leq m}} \theta_{ex} L_{ex} ^{\frac{\eta - 1}{\eta}}\right)^{\frac{\eta}{\eta - 1}}$$
Is the equivalent of Ottaviano, Peri (2008) equation 3 on page 9 and
$$\left(\theta_{exb} L_{exb}^{\frac{\sigma - 1}{\sigma}} + \theta_{exw} L_{exw} ^{\frac{\sigma - 1}{\sigma}}\right)^{\frac{\sigma}{\sigma - 1}}
$$
Is the equivalent of Ottaviano, Peri (2008) equation 4 on page 9 and
the expression for the logarithm of the wage is equation 2 on page 11 of Boustan(2008):
$$ln w_{exr}=ln(A^{\frac{1}{\alpha}}k^{\frac{(1-\alpha)}{\alpha}})+\frac{1}{\delta}\cdot ln(L)+ln\theta_{e}-(\frac{1}{\delta}-\frac{1}{\eta})\cdot ln(L_{e})+ln\theta_{ex}-(\frac{1}{\eta}-\frac{1}{\sigma})\cdot ln(L_{ex})+ln\theta_{e_{exr}}-\frac{1}{\sigma}\cdot ln(L_{exr})$$
Whith the correct expressions its all boring algebra:
Fn. 29 on page 11 says:

Following Ottaviano and Peri (2006), I first express output as a function of the capital-output ratio (κ = K/Y)

Thus we have:
$Y=AK^{1-\alpha}L^{\alpha} \Leftrightarrow Y=A\big(\frac{K}{Y}\big)^{1-\alpha}L^{\alpha}Y^{1-\alpha} \Leftrightarrow \\Y^{\alpha}=Ak^{1-\alpha}L^{\alpha}\Leftrightarrow Y=A^{\frac{1}{\alpha}}k^{\frac{1-\alpha}{\alpha}}L$
Observe that:
$$W = x^{\frac{\zeta}{\zeta-1}} \Leftrightarrow \frac{\partial W}{\partial L_{exr}} = \frac{\zeta}{\zeta-1}x^{\frac{1}{\zeta-1}}\frac{\partial x}{\partial L_{exr}} =\frac{\zeta}{\zeta-1}W^{\frac{1}{\zeta}}\frac{\partial x}{\partial L_{exr}} (*)$$
$\omega_{exr} = \frac{\partial Y}{\partial L_{exr}} = A^{\frac{1}{\alpha}}k^{\frac{1-\alpha}{\alpha}}\big(\sum_{e=1}^n\theta_eL_e^{\frac{\delta-1}{\delta}}\big)^{\frac{1}{\delta-1}}\theta_eL_e^{\frac{-1}{\delta}}\frac{\partial L_e}{\partial L_{exr}} \overset{(*)}= A^{\frac{1}{\alpha}}k^{\frac{1-\alpha}{\alpha}}\theta_e\frac{\partial L_e}{\partial L_{exr}}L^{\frac{1}{\delta}}L_e^{\frac{-1}{\delta}}(1)$
$\frac{\partial L_e}{\partial L_{exr}} \overset{(*)}= \theta_{ex}\frac{\partial L_{ex}}{\partial L_{exr}}L_e^{\frac{1}{\eta}}L_{ex}^{\frac{-1}{\eta}} (2)$
$\frac{\partial L_{ex}}{\partial L_{exr}} \overset{(*)}= \theta_{exr}L_{ex}^{\frac{1}{\sigma}}L_{exr}^{\frac{-1}{\sigma}} (3)$
Plug back (2) and (3) into (1), take logs and you will obtain the result.
NOTE I dont quite understand why the derivative of $k = \frac{K}{Y}$ wrt L is not taken here.