I'm trying to solve the following optimization problem:
$$\underset{f:[-A,A]\to\mathbb{R^+}}{\mathrm{argmin}}\left\{\int_{-A}^{A}f(u)\log_2[f(u)]\ \mathrm{d}u\right\}\qquad\mathrm{s.t.}\ \int_{-A}^{A}f(u)\ \mathrm{d}u=1$$
In other words - I am trying to find the PMF $f(u)$ of a random variable $U\in[-A,A]$ that maximizes the differential entropy. I am aware that the solution is a uniform random variable; i.e. $f(u)=1/2A$. I somehow managed to get to this solution - my attempt was Euler Lagrange Equations - defining the Lagrangian:
$$\mathcal{L}[f]\equiv f(u)\log_2[f(u)]+\lambda\left[\frac{1}{2A}-f(u)\right]$$
One gets:
$$0=\frac{\partial\mathcal{L}}{\partial f(u)}-\frac{\mathrm{d}}{\mathrm{d}u}\frac{\partial\mathcal{L}}{\partial f'(u)}=\log_2[f(u)]+\frac{1}{\ln(2)}-\lambda\implies f(u)=\mathrm{const}$$
And then of course, the constant must be $1/2A$ (due to the normalization constraint). However, I'm not sure if this solution is correct, and overall, I don't think I'm allowed to use Euler Lagrange Equations for this.
Thanks!