Solution (source code)

= Solution
{c}

Since the <general linear Lie algebra> $\mathfrak{gl}_1(k)$ has zero <Lie bracket>, identify it with $kz$. A <central extension of a Lie algebra> is a <short exact sequence>
$$
0\longrightarrow kz\xrightarrow{\iota}\widetilde{\mathfrak g}\xrightarrow{\pi}\mathfrak g\longrightarrow0
$$
of <Lie algebra homomorphisms> with $\iota(kz)$ contained in the <center of a Lie algebra> $Z(\widetilde{\mathfrak g})$. Thus $\pi$ is surjective, its <kernel> is precisely the indicated line, and that line commutes with all of $\widetilde{\mathfrak g}$.

Choose a <linear map> $s:\mathfrak g\to\widetilde{\mathfrak g}$ with $\pi s=\operatorname{id}$. Such a section exists by lifting a <basis>. Identify $\widetilde{\mathfrak g}$ with the <direct sum of vector spaces> $\mathfrak g\oplus kz$ by $(x,tz)\mapsto s(x)+t\iota(z)$. The difference $[s(x),s(y)]-s([x,y])$ belongs to the <kernel> of $\pi$, so there is a unique <bilinear map> $\alpha:\mathfrak g\times\mathfrak g\to k$ such that
$$
[s(x),s(y)]-s([x,y])=\alpha(x,y)\iota(z).
$$
It is an <alternating bilinear form>: $\alpha(x,x)=0$, equivalently $\alpha(x,y)=-\alpha(y,x)$ in <characteristic zero>. Taking the central component of the <Jacobi identity> gives the <Lie algebra two-cocycle> condition
$$
\alpha([x,y],w)+\alpha([y,w],x)+\alpha([w,x],y)=0\qquad(x,y,w\in\mathfrak g).
$$
Conversely, any <alternating bilinear form> satisfying this identity defines a <Lie algebra> by
$$
\boxed{[(x,tz),(y,uz)]=([x,y],\alpha(x,y)z).}
$$
Indeed its <Lie bracket> is an <alternating multilinear map> and a <bilinear map>, and the two components of its <Jacobi identity> are respectively the <Jacobi identity> in $\mathfrak g$ and the displayed <Lie algebra two-cocycle> condition. The line $kz$ is central, and projection to $\mathfrak g$ gives the required <central extension of a Lie algebra>.

For later use, replacing $s$ by $s'(x)=s(x)+t(x)\iota(z)$, where $t\in\mathfrak g^*$ is in the <dual space>, changes the <Lie algebra two-cocycle> to
$$
\boxed{\alpha'(x,y)=\alpha(x,y)-t([x,y]).}
$$
Thus changes of section add a <Lie algebra two-coboundary>, up to the conventional sign. A section that is a <Lie algebra homomorphism> has $\alpha'=0$ and gives a <direct sum of Lie algebras>.