# Maximum value of $f(x) = \log_{(\tan x + \cot x)}(\det A)$ for a diagonal matrix $A$

If $$A =\begin{pmatrix} d_1 & 0 & 0 & 0 \\ 0 & d_2 & 0 & 0\\ 0 & 0 & d_3 & 0\\ 0 & 0 & 0 & d_4\\ \end{pmatrix}$$ where $d_i>0$ $\forall$ $i=1,2,3,4$ is a diagonal matrix of order 4

such that $d_1+2d_2+4d_3+8d_4=16$ then the maximum value of $f(x)=\log_{(\tan x+\cot x)}(\det(A))$ where $x \in (0,\pi/2)$ is equal to

My attempt at the solution-

I have no idea how to approach this one. All I did was calculated the $|A|$, which came out to be $d_1 d_2 d_3 d_4$ . I further calculated the minimum value of $\tan x+\cot x$ by expressing it in form of $\sin(2x)$. The minimum value comes out to be 2 (at $x=\pi/2$)

So I am now left with the expression $\log_2 d_1 d_2 d_3 d_4$ and cannot move further. I have no idea how to use the given equation in the solution.

The answer comes out to be equal to $2$.

hint: Use AM-GM inequality $$d_{1}+2d_{2}+4d_{3}+8d_{4}\ge 4\sqrt[4]{2^2\cdot 2^3\cdot 2 d_{1}d_{2}d_{3}d_{4}}=8\sqrt{2}\cdot\sqrt[4]{\det{(A)}}$$ so $$\det{(A)}\le 4$$ and since $$\tan{x}+\cot{x}\ge 2$$ so $$f(x)\le log_{2}{4}=2$$