If $f(\theta)=\min\left(|2x-7|+|x-4|+|x-2-\sin(\theta)|\right)$, where $x, \theta \in R$, then maximum value of $f(\theta)$ is
My Approach:
Since $2+\sin(\theta)<\dfrac{7}{2}<4$.
Case 1: $x\geq4$
$f(\theta)=4x-13-\sin(\theta)$
$f(\theta)\geq2$ because $x\geq4\implies f(\theta)\geq 3-\sin(\theta)\implies f(\theta)\geq 2$
Case 2:
$\dfrac{7}{2}\leq x<4$
$f(\theta)=2x-5-\sin(\theta)$
In this case
$f(\theta)\geq 2-\sin(\theta)\implies f(\theta)\geq1$
Case 3:
$2+\sin(\theta)<x<\dfrac{7}{2}$
$f(\theta)=-2x+9-\sin(\theta)$
In this case $f(\theta)>2-\sin(\theta) \implies f(\theta)>1$
Case 4:
$x\leq2+\sin (\theta)$
$f(\theta)=-4x+13+\sin(\theta)$
In this case $f(\theta)\geq 5-3\sin(\theta)\implies f(\theta)\geq2$
So from Case 1, Case 2, Case 3, Case 4
$f(\theta)=2-\sin (\theta)$
Hence $\max(f(\theta))=3$.
Is my approach correct? Also is there any short method to solve this problem?
A short method uses the fact that a minimizer of the sum of absolute distances from the points of a data set $x_i \in \mathbb R,\: i=1,\ldots , n$ is a median $x_M$ of the data set: $$ \min \sum_{i=1}^n|x-x_i| = \sum_{i=1}^n|x_M-x_i|$$
For your function write $$f(\theta) = \min(|x- 3.5| + |x-3.5| + |x-4| + |x-(2+\sin \theta)|)$$ So, a minimizer is $$x_M = 3.5 \quad \text{This is the median of } 2+\sin \theta,\; 3.5,\;3.5,\;4$$ Now, plug in $x_M = 3.5$ and maximize $$\max f(\theta) = \max_{\theta \in [0,2\pi]}(0.5 + |1.5-\sin \theta |) = 0.5+2.5 = \boxed{3}$$
Here you can check it graphically. Maximum is attained at $\theta = \frac 32 \pi $.