Center of the universal enveloping algebra Suppose I have non-abelian 2-dimensional Lie algebra or 3-dimensional Heisenberg algebra.
How to calculate the center of universal enveloping algebra in this cases?
 A: Let $U(\mathfrak h)$ be the enveloping Lie algebra of the heisenberg algebra $\mathfrak h$. The algebra $\mathfrak h$ has a basis formeb by
$$X:=
\left(\begin{array}{ccc}
0 & 1 & 0 \\
0 & 0 & 0 \\
0 & 0 & 0
\end{array}\right),\quad
Y:=
\left(\begin{array}{ccc}
0 & 0 & 0 \\
0 & 0 & 1 \\
0 & 0 & 0
\end{array}\right)\quad
\text{ and }\quad Z:=
\left(\begin{array}{ccc}
0 & 0 & -1 \\
0 & 0 & 0 \\
0 & 0 & 0
\end{array}\right).$$
Hence, we have a PBW basis for $U(\mathfrak h)$ given by
$$\{X^aY^bZ^c\colon a,b,c\geqslant 0\}.$$
The relations
$$[X,Y]=Z,\quad [X,Z]=0\quad\text{ and }\quad [Y,Z]=0$$
in $\mathfrak h$ provide the relations
$$YX=XY+Z,\quad ZX=XZ\quad\text{ and }\quad ZY=YZ.$$
Thus, $Z$ is in the center $\operatorname Z(U(\mathfrak h))$ of $U(\mathfrak h)$. We will show above that $Z(U(\mathfrak h))$ is the subalgebra of $U(\mathfrak h)$ generated by $Z$ (i.e. the polynomials in $Z$).
One can prove, by induction in $n\in\mathbb Z_+$, that
$$Y^nX=XY^n + nY^{n-1}Z$$
and
$$YX^n=X^nY + nX^{n-1}Z.$$
The cases where $n=1$ are just the relation $YX=XY+Z$ given above.
With the equations above, one can show that if
$$\alpha = \sum_{i=1}^m\lambda_{a_i,b_i,c_i}X^{a_i}Y^{b_i}Z^{c_i}$$
is not in the subalgebra generated by $Z$ then $\alpha$ is not in $Z(U(\mathfrak h))$ (more specifically, $\alpha$ will not commute with both $X$ and $Y$):


*

*Suppose without generality that $(a_i,b_i)\neq (0,0)$ for each $i$.

*Take
$$c=\operatorname{max}\{c_1,\dots,c_n\}.$$

*If
$$a=\operatorname{max}\{a_i\colon c=c_i,\quad i=1,\dots,n\}>0$$
and $(a,b,c)=(a_i,b_i,c_i)$ then $\alpha$ does not commute with $Y$ because $Y\alpha$ will have a component in the vector $X^{a-1}Y^bZ^{c+1}$ of the PBW basis and $\alpha Y$ will not.

*Similarly, if
$$b=\operatorname{max}\{b_i\colon c=c_i,\quad i=1,\dots,n\}>0$$
and $(a,b,c)=(a_i,b_i,c_i)$ then $\alpha$ does not commute with $X$ because $\alpha X$ will have a component in the vector $X^aY^{b-1}Z^{c+1}$ of the PBW basis and $X\alpha$ will not.


Therefore, $Z(U(\mathfrak h))$ must be the subalgebra generated by $Z$. Which is, by the way, the subalgebra of $U(\mathfrak g)$ generated by the center of $\mathfrak h$.
The case of the bi-dimensional non-abelian algebra $\mathfrak g$ can be attacked in a similar way. The center of $U(\mathfrak g)$ is the vectorial subspace generated by element $1$. Take a basis formed by $X$ and $Y\in\mathfrak g$ such that $[X,Y]=Y$ in $\mathfrak g$ and consider a PBW basis of $U(\mathfrak g)$ induced by $X$ and $Y$. Then prove that no element in $U(\mathfrak g)\backslash\mathbb K 1$ commute with both $X$ and $Y$.
A: The universal enveloping algebra of the Heisenberg Lie algebra over a field $K$ is generated by $x,y,c$ with relations $xy-yx=c, xc=cx,yc=cy$. Its centre is "almost trivial", equal to the polynomial algebra $K[c]$, if $K$ has characteristic zero. 
Edit: Dixmier has computed the center of the universal enveloping algebra for all nilpotent Lie algebras of dimension $n\le 5$, see Proposition $2$ of his article "Sur les representations unitaires des groupes de Lie nilpotents.III", page 326. The elements $f\in Z(U(\mathfrak{h}_1))$ are the elements of the symmetric algebra $S(\mathfrak{h}_1)$ satisfying the equation
$$
[x,y]f'_y+[x,c]f'_c=0,
$$
which implies $f'_x=f'_y=0$, so that $f$ is a polynomial in $c$. From this it follows then $Z(U(\mathfrak{h}_1))=K[c]$.
