How to calculate the Casimir operator of a Lie algebra? Given a Lie group algebra with generators $ X_{i} $ how can I calculate the Casimir generator $ H= X_{i}X^{i} $? If possible with two examples please


*

*The generator of translation in 2 dimensions $ P_{i} $ i=x,y with commutation relations $[P_{i},P_{j} ]=0 $

*The generator of the angular momentum with commutation relations $ [L_{i} , L_{j}]=\epsilon _{ijk}L_{k} $
Here $ X^{i} $ is the 'dual' of $ X_{i} $.
 A: First, you are confusing Lie groups with Lie algebras. Casimir elements are objects that can be attached to certain Lie algebras.
Second, Casimir elements do not always exist. For any Lie algebra $\mathfrak{g}$, there is a canonical bilinear form, the Killing form
$$B(x, y) = \text{tr}(\text{ad}_x \text{ad}_y)$$
where $\text{ad}_x(y) = [x, y]$ is the adjoint action of $\mathfrak{g}$ on itself. The Casimir element exists if and only if the Killing form is nondegenerate, which is equivalent to $\mathfrak{g}$ being semisimple (in particular, finite-dimensional). Concretely this means that $B(x, -)$ is a nonzero linear functional for any nonzero $x$. Abstractly this means that the map
$$\mathfrak{g} \ni x \mapsto B(x, -) \in \mathfrak{g}^{\ast}$$
(where $\mathfrak{g}^{\ast}$ is the dual space of linear functionals $\mathfrak{g} \to k$ for our base field $k$ of characteristic zero) is an isomorphism. For an abelian Lie algebra, the Killing form is identically zero, and so the Casimir element does not exist in that case.
In the semisimple case, the Killing form itself defines a linear functional $\mathfrak{g} \otimes \mathfrak{g} \to k$ (where $\otimes$ denotes the tensor product), or an element of $\mathfrak{g}^{\ast} \otimes \mathfrak{g}^{\ast}$, and because of the above isomorphism one can equivalently write the Killing form as an element of $\mathfrak{g} \otimes \mathfrak{g}$. This is the Casimir element.
Concretely, we can compute the Casimir element as follows. Given a basis $e_1, ... e_n$ of $\mathfrak{g}$, compute the Killing form $B$ using the structure constants of $\mathfrak{g}$, then compute the dual basis $f_1, ... f_n$, which is the unique basis satisfying
$$B(e_i, f_j) = \delta_{ij}.$$
Then the Casimir element is given by $\sum e_i \otimes f_i$. Since you are aware of this definition, perhaps what you're stuck on is either computing the Killing form or computing the dual basis. For fixed $\mathfrak{g}$ both of these are fairly straightforward linear algebra. Which step are you having trouble with? 
