Find the value of $k$ for which $f(x)$ is minimum 
Find value of $k$ for which  $\displaystyle f(x)=\int^{\pi}_{0}|\sin x-kx|$ is minimum where $0<k<1$.

My Try: $$f(x) = \int^{\alpha}_{0}|\sin x-kx|dx+\int^{\pi}_{\alpha}|\sin x-kx|dx$$ Where $0<\alpha <\pi$
$$f(x) = \int^{\alpha}_{0}(\sin x-kx)dx+\int^{\pi}_{\alpha}(kx-\sin x)dx$$
$$ = 1-\cos \alpha-\frac{k\alpha^2}{2}+\frac{k\pi^2}{2}-1-\frac{k\alpha^2}{2}-\cos \alpha$$
$$f(\alpha)=k\frac{\pi^2}{2}-k\alpha^2-2\cos \alpha$$ 
for maximum or minimum $k'(\alpha) = 2k\alpha+2\sin \alpha=0$ and $k''(\alpha)=2k+2\cos \alpha$
could some help me how to solve it, thanks
 A: You are on the right track. Note that $f$ is a  function of $k\in(0,1)$,
$$f(k)=\int^{\pi}_{0}|\sin x-kx|dx=k\frac{\pi^2}{2}-k\alpha(k)^2-2\cos(\alpha(k))$$
where $\alpha(k)$ is the unique point in $(0,\pi]$ such that $\sin(\alpha)=k\alpha$. Hence
$$\begin{align}
f'(k)&=\frac{\pi^2}{2}-\alpha(k)^2-2k\alpha(k)\alpha'(k)+2\sin(\alpha(k))\alpha'(k)\\&=\frac{\pi^2}{2}-\alpha(k)^2-2k\alpha(k)\alpha'(k)+2k\alpha(k)\alpha'(k)=\frac{\pi^2}{2}-\alpha(k)^2.\end{align}$$
We have that $\alpha(k)$ is strictly decreasing from $\alpha(0)=\pi$ to $\alpha(1^-)=0^+$. Let $\alpha_0=\pi/\sqrt{2}$, and $k_0=\sin(\alpha_0)/\alpha_0\approx 0.3582\in (0,1)$ then $f'(k_0)=0$, $f'(k)<0$ in $(0,k_0)$ and $f'(k)>0$ in $(k_0,1)$, which means that the minimum of $f$ is attained at $k_0$.
A: You have your relations mixed up. The integral is a function of $k$
$$ f(k) = k\left(\frac{\pi^2}{2}-\alpha^2\right) - 2\cos\alpha $$
where $\alpha(k)$ satisfies $\sin\alpha - k\alpha = 0$
Now we can minimize $f(k)$, keeping in mind that $\alpha$ also depends on $k$
$$ \begin{align} 
f'(k) &= \frac{\pi^2}{2} - \alpha^2 - 2k\alpha \frac{d\alpha}{dk} + 2\sin\alpha \frac{d\alpha}{dk} \\
&= \frac{\pi^2}{2} - \alpha^2 + 2(\sin\alpha-k\alpha) \frac{d\alpha}{dk} \\
&= \frac{\pi^2}{2} - \alpha^2
\end{align} $$
$f'(k) = 0$ when $\alpha = \dfrac{\pi}{\sqrt{2}}$ or $k = \dfrac{\sin\alpha}{\alpha} \approx 0.358 $
If you want to go further and show that this is indeed a minimum and not a maximum, we can apply the second derivative test
$$ f''(k) = -2\alpha\frac{d\alpha}{dk} $$
then using implicit differentiation on the original relation we have
$$ \cos\alpha\frac{d\alpha}{dk} - \alpha - k\frac{d\alpha}{dk} = 0 $$
$$ \frac{d\alpha}{dk} = \frac{\alpha}{\cos\alpha-k} $$
Thus
$$ f''(k) = \frac{2\alpha^2}{k-\cos\alpha} = \frac{2\alpha^3}{\sin\alpha-\alpha\cos\alpha} $$
You can check that this is positive for $\alpha=\dfrac{\pi}{\sqrt{2}}$
