I have the following function of $x$ $$f(x)=\max \left\{\sqrt{a^2+x^2-2ax\cos\left(\frac{\theta}{2}\right)},\sqrt{b^2+x^2-2bx\cos\left(\frac{\theta}{2}\right)}\right\}$$ where $x>a$ and $b>x$. $\theta$ can be any value from $0$ to $\pi$. $a,b,\theta$ are constants and I want to minimize this function with respect to $x$. I know that the derivative of the first term is positive but still I can not find how to solve this problem because of dependence on $\theta$.
Any help in this regard will be much appreciated. Thanks in advance.
I am extremely thankful to @Jack D'Aurizio and @Yves Daoust for their answers. Specially the image that was added by @Jack D'Aurizio which helped me understanding the above problem. Although we can follow the steps mentioned by these two people to find the answer. However, I also have a reasoning (based on the image attached by @Jack D'Aurizio) which also lead to the same answer (I think so). We have to find the optimal value of $x$ in [a,b]. First, we note that as we move from point $a$ toward point $b$ we note that until a certain point ($L$) the first argument increases while the second argument decreases. Therefore, if we are asked to find the optimal point between the interval $[a,L]$ then our answer will be obtained by equating the two arguments of $\max$ function in my first equation (which will be $\frac{a+b}{2\cos(\theta)}$). Now if $\frac{a+b}{2\cos(\theta)} \geq b\cos(\theta)$ then the value of $x$ which minimizes $f(x)$ is actually $b\cos(\theta)$ since if we move further right then both of the arguments of $\max$ function increase. Therefore, moving further right can not be an optimal solution.
