Part of one of my calculations involves (the innocent looking) expression $\sum_{\alpha\in\Sigma} (\alpha,\alpha)$ for simple Lie algebras. I have two methods of calculating it -- which don't agree. I'm pretty sure that the first one is wrong, but I don't know why. Any help is welcome (which is why I posted here)!

First my starting 'facts' (see e.g. the free book by Cahn or the comprehensive Knapp):

Given a simple Lie algebra $\mathfrak{g}$ and a basis to the Cartan subalgebra $\{h_i\ ,\ i=1\ldots,r\}$, the components of the roots are defined by $$[h_i,e_\alpha] = \alpha_i e_\alpha$$

The Killing form restricted to the Cartan subalgebra is (Knapp Cor (2.24): but with index ridden notation) $$ g_{ij}=\mathrm{tr}h_i h_j = \sum_{\alpha\in\Sigma}\alpha_i\alpha_j $$ The inner product on the root space is defined via the Killing form (Knapp eqn (2.28)): $$(\alpha,\beta) = \alpha^i\beta_i = \alpha_i g^{ij} \beta_j=\mathrm{tr}(h_\alpha h_\beta)\ ,\qquad g^{ij}g_{jk}=\delta^i_k$$

So we get our first (and probably wrong) way of calculating: $$\sum_{\alpha\in\Sigma} (\alpha,\alpha) = g^{ij}\sum_{\alpha\in\Sigma} \alpha_i\alpha_j = g^{ij}g_{ij} = \sum_i \delta^i_i = \mathrm{rnk} \mathfrak{g} $$

The second method is to just enumerate and sum over all roots. For a *simply laced* Lie algebra this is easy, because all roots have the same length $(\alpha,\alpha)=l$:
$$\sum_{\alpha\in\Sigma} (\alpha,\alpha) = l\sum_{\alpha\in\Sigma} 1
= l\ (\mathrm{dim}\mathfrak{g}-\mathrm{rnk}\mathfrak{g})
$$

These results are not compatible...