<s>[INST] solve trigonometric lim with tan Hi guys I tried to solve the following problem lately and got stucked.
I'd love to get some help and guidance. 
consider this:
$$\lim_{x \rightarrow\infty}\tan\left(\frac{\pi x}{2x+1}\right)^{\frac{1}{x}}
$$
I did the following:
1. break to sin and cos :
$$
\lim_{x \rightarrow\infty}\tan\left(\frac{\pi x}{2x+1}\right)^{\frac{1}{x}} = \lim_{x\rightarrow\infty}\frac{\left(\sin\left(\frac{\pi x}{2x+1}\right)\right)^\frac{1}{x}}{\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)^\frac{1}{x}}$$


*use log rules:


$$\lim_{x\rightarrow\infty}\frac{\left(\sin\left(\frac{\pi x}{2x+1}\right)\right)^\frac{1}{x}}{\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)^\frac{1}{x}} =  \lim_{x\rightarrow\infty}\frac{e^{\frac{1}{x}\ln\left(\sin\left(\frac{\pi x}{2x+1}\right)\right)}}{e^{\frac{1}{x}\ln\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)}}$$


*Numerator converges to one so I am going to work with the denominator:
$$
 \lim_{x \rightarrow \infty}e^{\frac{1}{x}\ln\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)} = e^\left(\lim_{x \rightarrow \infty}{\frac{1}{x}\ln\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)}\right) 
$$


$$
\lim_{x \rightarrow \infty}{\frac{1}{x}\ln\left(\cos\left(\frac{\pi x}{2x+1}\right)\right)} = \frac{-\infty}{\infty}$$


*at this point I tried to apply l'hopital but encountered a huge mess, and now I feel that maybe I chose the wrong way. Please help me guys.

 [/INST] Considering $$A=\tan\left(\frac{\pi x}{2x+1}\right)^{\frac{1}{x}}$$ first $$\tan\left(\frac{\pi x}{2x+1}\right)=\tan\left(\frac{\pi} 2-\frac{\pi }{2(2 x+1)}\right)=\cot \left(\frac{\pi }{2(2 x+1)}\right)$$ So $$\log(A)=\frac 1 x \log\left(\cot \left(\frac{\pi }{2(2 x+1)}\right)\right)$$ Now, using Taylor series starting with $$\cot(\epsilon)=\frac{1}{\epsilon }-\frac{\epsilon }{3}-\frac{\epsilon ^3}{45}+O\left(\epsilon
   ^4\right)$$ and replacing $\epsilon=\frac{\pi }{2(2 x+1)}$ and continuing the expansion $$\cot \left(\frac{\pi }{2(2 x+1)}\right)=\frac{4 x}{\pi }+\frac{2}{\pi }-\frac{\pi }{12
   x}+O\left(\frac{1}{x^2}\right)$$ $$\log\left(\cot \left(\frac{\pi }{2(2 x+1)}\right)\right)=\log \left(\frac{4}{\pi }\right)+\log
   \left({x}\right)+\frac{1}{2 x}+O\left(\frac{1}{x^2}\right)$$ $$\log(A)=\frac 1x\log \left(\frac{4}{\pi }\right)+\frac{\log
   \left({x}\right)}x+O\left(\frac{1}{x^2}\right)$$ $$A=e^{\log(A)}=1+\frac{\log \left(\frac{4 x}{\pi }\right)}{x}+O\left(\frac{1}{x^2}\right)$$ which shows the limpit and how it is approached.
To check how good (or bad) is the approximation, let us set $x=10^k$ and compute the exact and approximate values 
$$\left(
\begin{array}{ccc}
 k & \text{approximation} & \text{exact} \\
 1 & 1.295772742 & 1.254414957 \\
 2 & 1.049713236 & 1.048467347 \\
 3 & 1.007175440 & 1.007149320 \\
 4 & 1.000945642 & 1.000945190 \\
 5 & 1.000117552 & 1.000117545 \\
 6 & 1.000014057 & 1.000014057
\end{array}
\right)$$
</s>