Solution (source code)

= Solution

A classical string must also satisfy the equations obtained by varying the worldsheet metric before imposing <conformal gauge>. Vanishing of the worldsheet <stress-energy tensor> gives
$$
T_{++}=\frac1{\alpha'}\partial_+X\mathbin\cdot\partial_+X=0,
\qquad
T_{--}=\frac1{\alpha'}\partial_-X\mathbin\cdot\partial_-X=0.
$$
In modes these are the <Virasoro constraints>
$$
L_m=\frac12\sum_r\alpha_{m-r}\mathbin\cdot\alpha_r=0,
\qquad
\widetilde L_m=\frac12\sum_r\widetilde\alpha_{m-r}\mathbin\cdot\widetilde\alpha_r=0
$$
for every integer $m$. Reality of $X^\mu$ also requires
$$
(\alpha_r^\mu)^*=\alpha_{-r}^\mu,
\qquad
(\widetilde\alpha_r^\mu)^*=\widetilde\alpha_{-r}^\mu.
$$
Together with periodicity and the wave equation, these conditions remove the unphysical longitudinal worldsheet excitations.