I have a (probably simple) question whose answer seems obvious but I cannot prove it. It relates to the calculus of variations.
Let scalar $A = \Re[\int_a^bB(x)C(x)dx$], where $B$ and $C$ map $\mathbb{R}\mapsto\mathbb{C}$. Find the scalar function $B(x)$ which maximizes $A$ under the constraints that $\int_a^b|B(x)|^2=k^2$ for $k\in\mathbb{R}$ and $\int_a^b|C(x)|^2=q^2$ for $q\in\mathbb{R}$.
If necessary, assume $B$ and $C$ are everywhere finite and/or real and/or continuously differentiable and/or whatever else you think is necessary.
Intuition tells me that the solution must be $B(x)=pC(x)^\ast$ where $p=k/q^\ast$ and $\ast$ indicates complex conjugate, but I cannot prove it.
Have you tried using Lagrange multipliers? When I did this, using the functional $$L = \mathfrak{R}[ \int BC \; dx + \lambda \int |B^2| \; dx]$$
and take the usual Euler Lagrange differential, the result you state pops out.