Solution (source code)

= Solution

Use the <classification of finite-dimensional sl2 representations>. In the irreducible representation $V(m)$, choose $v_j=f^jv_0$, $0\leq j\leq m$, so
$$
hv_j=(m-2j)v_j,\qquad fv_j=v_{j+1},\qquad
ev_j=j(m-j+1)v_{j-1},
$$
with vectors beyond the endpoints interpreted as zero. The <invariant form on an irreducible sl2 module> is
$$
\boxed{B(v_j,v_k)=\begin{cases}(-1)^j,&j+k=m,\\0,&j+k\ne m.\end{cases}}
$$
Its anti-diagonal entries are nonzero, so it is <nondegenerate>. <Lie-invariant bilinear form> invariance under $h$ follows from the sum of the two weights. For $f$, the two potentially nonzero terms are $(-1)^{j+1}$ and $(-1)^j$. For $e$, their coefficients coincide when $j+k=m+1$, and their signs are opposite. These checks prove invariance under the generators of the <sl2 Lie algebra>.

Interchanging $j,k$ multiplies the form by $(-1)^m$, giving
$$
\boxed{B\text{ is symmetric for even }m,\quad\text{alternating for odd }m.}
$$
Equivalently it is a <symmetric bilinear form> in <odd integer> <dimension> and an <alternating bilinear form> in <even number> <dimension>. The <Weyl complete reducibility theorem> expresses any finite-dimensional representation as a <direct sum> of these irreducibles. Give each summand the displayed form and make different summands orthogonal. The resulting form is invariant and nondegenerate. On a reducible representation with both parities, this orthogonal sum need not itself be symmetric or alternating; the dichotomy in the preceding part required irreducibility.