Suppose there are $n$ goods ($x_i$ with prices $p_i$) to be taxed with a sequence of ad valorem taxes whose rates are given by $t_i$. The total tax revenue is $T = \sum_{i=1}^{n} t_ip_ix_i$. For a fixed $\bar{T}$, find the tax rates $(t_1^{*}, \cdots, t_n^{*})$ that will minimize the total deadweight loss $DW = \sum_i DW(t_i)$.
Show that $t_i^* = \lambda (\frac{1}{e_{S,P}} - \frac{1}{e_{D,P}})$ where $e_{S,P}$ and $e_{D,P}$ are the price elasticities of supply and demand respectively, and $\lambda$ is the Lagrange multiplier for tax constraint.
The DW is given by $DW(t_i) = -0.5 t_i^2\frac{dQ^*}{dt_i}$. The Lagrangian can be set up as:
$$\mathcal{L}(t_1, \cdots, t_n, \lambda) = -0.5 t_i^2\frac{dQ^{*}}{dt_i} + \lambda(\bar{T} - \sum_i t_ip_ix_i)$$
The FOCs are $\frac{\partial \mathcal{L}}{\partial t_i} = -t_i \frac{dQ^*}{dt_i} - \lambda(p_ix_i) = 0 \implies t_i^{*} = \frac{\lambda(p_ix_i)}{\frac{dQ^*}{dt_i}}$ and $\bar{T} = \sum_i t_ip_ix_i$.
I don't see how to get to the solution. Any help will be appreciated.