QUESTION: Find the value of $k$ which minimises $$F(k)=\int_{0}^{4} |x(4-x)-k|dx$$
MY APPROACH: Clearly $4x-x^2$ is a downward concave parabola with the roots $0$ and $4$. And $y=k$ is a line parallel to the $x$ axis. Now, the modulus of the area bounded by these two curves can be divided into two parts -
A- the area under the parabola and above the line.
B- the area above the parabola and under the line.
Now, the line intersects the parabola at $4x-x^2=k$. Call the two roots of this equation $\alpha_k$ and $\beta_k$ (obviously, $\alpha$ and $\beta$ are functions of $k$). Without loss of generality, assume that $\alpha_k \le \beta_k$ (equality is achieved when the line is tangential to the parabola, at $(2,4)$ )
$$\therefore F(k)= \underbrace{ \int_{0}^{\alpha_k} \big( k - x(4-x) \big) dx}_{m} + \int_{\alpha_k}^{\beta_k} \big( x(4-x) - k \big) dx + \underbrace{\int_{\beta_k}^{4} \big( k - x(4-x) \big)}_{n} dx$$
Now, due to symmetry of the problem, $m$ and $n$ must have the same value. Hence, we can write,
$$F(k)= 2 \int_{0}^{\alpha_k}\big( k - x(4-x) \big) dx + \int_{\alpha_k}^{\beta_k} \big( x(4-x) - k \big) dx $$
And the rest of the problem can be solved by Leibniz rule of differentiating under the integral sign. But the problem is $$\alpha_k=\frac{4-\sqrt{16-4k}}{2}$$ and $$\beta_k= \frac{4 + \sqrt{16-4k}}{2}$$ which obviously doesn't look very nice..
I am stuck here.. Am I even going in the right direction ?
Your help to complete this sum and/or any alternate (hopefully simpler) solution is much appreciated..
Thank you so much ..
(I attach a graph below, for better clarity on whatever I have said above.. Note that: the green line is variable, that's $y=k$)


Refer to the following picture.
Notice that $F(k)$ is the area of highlighted region. If we increase $k$ by an infinitesimal $\epsilon$, left and right regions’ area increase by $x_{1}\epsilon$ and $(4-x_{2})\epsilon$ respectively, while middle region’s area decrease by $(x_{2}-x_{1})\epsilon$.
In other word, $\frac{d}{dk}F(k)=4-2(x_{2}-x_{1})$. Notice that $x_{1}=1$ , $x_{2}=3$ yields $\frac{d}{dk}F(k)=0$.
Substitute either $1$ or $3$ to $x(4-x)$ to obtain $k=3$