# Minimum value of trigonometric function

The minimum value of the expression $\left|\sin x+\cos x+\tan x+\cot x+\sec x+\mathrm{cosec} x\right|$ can be expressed as $(\sqrt a-\sqrt b)$ where a and b are natural number then find the value of $(a-b)?$

My attempt:I applied AM-GM inequality (but AM GM inequality can be applied when all quantities are positive and all trigonometric ratios are not positive except when in first quadrant.)

$$\frac{\sin x+\cos x+\tan x+\cot x+\sec x+\mathrm{cosec} x}{6}\geq\sqrt[6]{\sin x.\cos x.\tan x.\cot x.\sec x.\mathrm{cosec} x}$$

$\sin x+\cos x+\tan x+\cot x+\sec x+\mathrm{cosec} x\geq6$

but this is the minimum value of $\sin x+\cos x+\tan x+\cot x+\sec x+\mathrm{cosec}x$ ,not minimum value of $\left|\sin x+\cos x+\tan x+\cot x+\sec x+\mathrm{cosec} x\right|$ and it not expressible as $\sqrt a -\sqrt b$

Someone help me find $a$ and $b$.Thanks in advance..

Let $y=x+\frac{\pi}{4}$. Then: $$\begin{eqnarray*} f(x)&=&\sin x+\cos x+\tan x+\cot x+\sec x+\text{cosec } x\\&=&\sqrt{2}\,\sin\left(x+\frac{\pi}{4}\right)+\frac{2+2\sqrt{2}\,\sin\left(x+\frac{\pi}{4}\right)}{\sin(2x)}\\&=&\sqrt{2}\,\sin(y)-\frac{2+2\sqrt{2}\sin(y)}{\cos(2y)}\end{eqnarray*}$$ hence by setting $u=\sqrt{2}\sin y$ we just need to find the stationary points of: $$g(u) = u-\frac{2+2u}{1-u^2} = u-\frac{2}{1-u}$$ over $[-\sqrt{2},\sqrt{2}]$. $g'(u)$ vanishes at $u=1-\sqrt{2}$, and since: $$g(1-\sqrt{2})=1-2\sqrt{2}$$ it follows that: $$\min_{x\in\mathbb{R}}\left|f(x)\right| = 2\sqrt{2}-1 = \sqrt{8}-\sqrt{1}$$ hence the answer is $\color{red}{7}$. I bet it is a problem from Brilliant, am I right?