<s>[INST] Range of $f(x)= \frac{\tan{x}}{\tan{3x}} $ 
Prove that for the values of $x$ where the following $f(x)$ is defined, $f(x)$ does not lie between $\frac{1}{3}$ and $3$. $$f(x)=\frac{\tan{x}}{\tan{3x}}$$

My Attempt:
I wrote down, $$\tan{3x}=\frac{3\tan{x}-\tan^3{x}}{1-3\tan^2{x}}$$
This reduced $f(x)$ to,
$$f(x)=\frac{1-3\tan^2{x}}{3-\tan^2{x}}$$
I don't know how to solve any further. I thought of using derivative, but the function is dicontinuous at times. How do I solve it? Any hints would be helpful.
Thanks.
 [/INST] \begin{align*}
f(x)&=\frac{1-3\tan^2{x}}{3-\tan^2{x}}\\
&=\frac{1-3\frac{\sin^2{x}}{\cos^2{x}}}{3-\frac{\sin^2{x}}{\cos^2{x}}}\\
&=\frac{\cos^2{x}-3\sin^2{x}}{3\cos^2{x}-\sin^2{x}}\\
&=\frac{\cos^2{x}-3(1-\cos^2{x})}{3\cos^2{x}-(1-\cos^2{x})}\\
&=\frac{4\cos^2{x}-3}{4\cos^2{x}-1}\\
&=\frac{4\cos^2{x}-1}{4\cos^2{x}-1}-\frac{2}{4\cos^2{x}-1}\\
&=1-\frac{2}{4\cos^2{x}-1}
\end{align*}
Now $0\le \cos^2{x}\le1$, so at $\cos^2{x}=0$, $1-\frac{2}{4\cdot0-1}=1-\frac{2}{-1}=3$, and at at $\cos^2{x}=1$ $1-\frac{2}{4\cdot1-1}=1-\frac{2}{3}=\frac{1}{3}$. 
To investigate further take the derivative of $f$:
$$f'(x)=-\frac{16 \cos x \sin x}{(4 \cos x^2-1)^2}$$
Now at $\cos^2x=0$, we have $\cos x=0$ and so $f'(x)=0$. Similarly at $\cos^2x=1$, we have $\sin x=0$ and so $f'(x)=0$. Hence these are both stationary points for $f(x)$.
To investigate these stationary points take the scond derivative of $f$:
$$f''(x)=-\frac{256 \cos^2x \sin^2x}{(4 \cos x^2-1)^3}+
\frac{16 (\sin^2x -\cos^2x)}{(4 \cos x^2-1)^2}$$
Now at $\cos^2x=0$, we have $\sin^2x=1$ and so $f''(x)=16$, implying $f(x)=3$ is a local minimum. Similarly at $\cos^2x=1$, we have $\sin^2x=0$ and so $f''(x)=-16$ implying $f(x)=\frac{1}{3}$ is a local maximum. Putting these two results together shows $f(x)$ cannot have any value between $\frac{1}{3}$ or $3$ as required. (See plot of $f(x)$ below for illustration of result.)

</s>