Differential Equation by Minimization

Suppose we want to solve $$u + xu' = 0$$, which has the general solution $$u = \frac{C}{x}$$, by minimizing the length squared of $$u + xu'$$. This should work due to the positive definite condition of inner products.

The inner product $$\int_{-1}^{1} p(x)q(x)\ dx$$ appears as good as any. This gives us $$\int_{-1}^{1} u^2 + 2xuu' + x^2(u')^2\ dx$$. According to the Euler-Lagrange Equation, we want to solve $$\frac{\partial (u^2 + 2xuu' + x^2(u')^2)}{\partial u} - \frac{d}{dx}(\frac{\partial (u^2 + 2xuu' + x^2(u')^2)}{\partial u'}) = 0$$. Simplifying, $$2u + 2xu' - \frac{d}{dx}(2xu + 2x^2u') = 0$$, thus $$x^2u'' + 2xu' = 0$$. Wolfram solves this second order ODE as $$u = \frac{C_1}{x} + C_2$$.

The problem is that unless $$C_2 = 0$$, this doesn't satisfy the original ODE. It doesn't even have the right number of arbitrary constants. $$C_1$$ behaves as it should in a general solution, but $$C_2$$ demands to be fixed at a particular value. What is wrong with my reasoning and/or calculations?

The problem is that the Euler-Lagrange equation is incomplete information for an extremal with the free end points (no constraints on $$u(0)$$ and $$u(1)$$). It must be completed with the natural boundary conditions. In your case, the latter becomes $$\frac{d}{du'}L(x,u(x),u'(x))\Big|_{x=1}=0\quad\Leftrightarrow\quad u(1)+u'(1)=0\quad\Leftrightarrow\quad C_1+C_2-C_1=C_2=0.$$