An optimization problem The following problem optimization problem arose in a project I am working on with a student. I would like to minimize the quantity:
$$ M=\frac{1}{12} + \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right)^2 Q(x)^2 \ dx - 4 \left[ \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) Q(x) \  dx\right]^2 $$
over all continuously differentiable functions $Q$ subject to the conditions that $Q(\tfrac{1}{2})=0$ and
$$ \int_0^\frac{1}{2}  Q(x)^2 \ dx = 1.$$
Is it possible to explicitly solve such a problem? (The presence of the constant $1/12$ should ensure that $M$ is positive for all $Q$.)
 A: I'll change the variable $y=\frac 12-x$ to make typing easier. Since, as Peter already observed, the condition $Q(0)=0$ is worthless and since $\frac 1{12}$ is just an additive constant, we are just to minimize $\int_0^{1/2}y^2Q^2-4\left(\int_0^{1/2}yQ\right)^2$ under the condition $\int_0^{1/2}Q^2=1$. Since everything is about pure quadratic forms, we just need to find the least $a>0$ such that $\int_0^{1/2}y^2Q^2-4\left(\int_0^{1/2}yQ\right)^2+a^2\int_0^{1/2}Q^2\ge 0$. Then $-a^2$ ($+\frac 1{12}$, if you want to keep that term) is the answer. That is just a Cauchy-Schwarz type thingy and the answer is given by $\int_0^{1/2}\frac{4y^2}{y^2+a^2}dy=1$ with $Q$ proportional (with the coefficient to determine from the $\int_0^{1/2}Q^2=1$ condition) to $\frac {2y}{y^2+a^2}$ (so the condition that is worthless is automatic as well). 
The integral determining $a$ is $2-4a\arctan\frac{1}{2a}$, so we need $a\arctan\frac 1{2a}=\frac 14$, which is something that one has to solve numerically. I've got $a\approx 0.2144889545$.
A: Here's an interesting/natural observation which might be useful.
Let $U$ be a uniform$(0,1/2)$ random variable, so that $U$ has density function $f(x)=2$,  $0 \lt x \lt 1/2$, and define a function $Y$ by $Y(x)=(1/2-x)Q(x)$, $0 \lt x \lt 1/2$. Then, $M=1/12 + \frac{1}{2}{\rm E}(Y^2 ) - {\rm E}^2 (Y)$. (Interestingly, a uniform$(0,1)$ random variable has variance equal to $1/12$.)
A: I tried calculus of variations. It's been a while since I've done calculus of variations, so I could be messing it up completely. Also, this isn't completely rigorous. There are ways of making calculus of variations rigorous, but I don't know them, and they're a lot harder than just doing calculations.
By my comment above, the $Q(\frac{1}{2})=0$ constraint is worthless, so we will ignore it.
Assume $Q$ is the minimum function (this is the first, and most important, non-rigorous step, since we are assuming a minimum exists). Now, let's plug in $Q+\epsilon$, where $Q$ and $\epsilon$ are both functions of $x$. We have
$$M=\frac{1}{12} + \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right)^2 (Q+\epsilon)^2 \ dx - 4 \left[ \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) (Q+\epsilon) \  dx\right]^2 .$$
Extracting the first-order terms in $\epsilon(x)$, we get
$$\Delta M = 2\int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right)^2 Q \epsilon \ dx -8 \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) Q \  dx \  \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) \epsilon \  dx .$$
If we change $Q$ by adding an infinitessimal $\epsilon$, and keeping the normalization condition on $Q$, then $\Delta M$ has to be 0, or otherwise $Q$ wouldn't be a minimum.
We still have to take care of the normalization condition $\int_0^\frac{1}{2}  Q(x)^2 \ dx = 1$. We do this using Lagrange multipliers, and so we get the expression
$$2\int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right)^2 Q \epsilon \ dx -8 \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) Q \  dx \  \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) \epsilon \  dx + \lambda \int_0^\frac{1}{2}  Q \epsilon\ dx .$$
This has to be zero for all functions $\epsilon(x)$. To simplify things further, let
$$C =  \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) Q \  dx,$$
since it's a constant independent of $\epsilon$. Now, we have
$$2 \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right)^2 Q \epsilon \ dx -8 C \  \int_0^\frac{1}{2} \left( \tfrac{1}{2}-x \right) \epsilon \  dx + \lambda \int_0^\frac{1}{2}  Q \epsilon\ dx $$
or, putting everything in the same integral sign, 
$$ \int_0^\frac{1}{2} 2 \left( \tfrac{1}{2}-x \right)^2 Q \epsilon -8 C \left( \tfrac{1}{2}-x \right) \epsilon  + \lambda   Q \epsilon\ dx $$
and for this to be $0$ for all functions $\epsilon$, we must have
$$Q = \frac{ (\frac{1}{2}-x)}{\alpha(\frac{1}{2}-x)^2+\beta}$$
for some $\alpha$, $\beta$. 
Note that, if $\beta \neq 0$, we get $Q(\frac{1}{2}) = 0$, as desired.
A Maple or Mathematica program should at least let you calculate $\alpha$ and $\beta$ numerically. 
