<s>[INST] 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
 [/INST] 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}}$
</s>