An almost impossible limit The following limit appeared in a qualification exam: Find the limit of
$$\lim_{x \to 0} \left( \frac{\tan (\sin (x))-\sin (\tan (x))}{x^7} \right).$$
I ended up doing it in Mathematica, is there any other way?
Thanks in advance!
 A: Recall that 
$$\sin(x) = x-x^3/6+x^5/120-x^7/5040+O(x^9)$$
$$\tan(x)=x+x^3/3+2x^5/15+17x^7/315+O(x^9)$$
thus
$$\begin{align}
\tan(\sin(x)) &= x-x^3/6+x^5/120+17x^7/315+O(x^9)\\
 &\;+\;(x-x^3/6+x^5/120+17x^7/315+O(x^9))^3/3\\
 &\;+\;2(x-x^3/6+x^5/120+17x^7/315+O(x^9))^5/15\\
 &\;-\;(x-x^3/6+x^5/120+17x^7/315+O(x^9))^7/5040+O(x^9)\\
&= x-x^3/6+x^5/120+17x^7/315+O(x^9)\\
 &\;+\;(x\cdot x \cdot x+3x\cdot x\cdot -x^3/6+3x\cdot (-x^3/6)^2+3x\cdot x\cdot x^5/120 + O(x^9))/3\\
 &\;+\;2(x\cdot x\cdot x\cdot x\cdot x + 5x\cdot x\cdot x\cdot x\cdot -x^3/6 + O(x^9))/15\\
 &\;-\;(x\cdot x\cdot x\cdot x\cdot x\cdot x\cdot x + O(x^9))/5040\\
&= x + x^3/6-x^5/40-107x^7/5040 + O(x^9)
\end{align}$$
which agrees with WolframAlpha's result. Similarly we can compute
$$\sin(\tan(x))=x + x^3/6-x^5/40-55x^7/1008 + O(x^9)$$
and so
$$\begin{align}
\lim_{x\to 0}\frac{\tan(\sin(x))-\sin(\tan(x))}{x^7}
&=\lim_{x\to 0}\frac{-107x^7/5040 + 55x^7/1008+O(x^9)}{x^7}\\
&=\frac{-107}{5040}+\frac{55}{1008}=\frac{1}{30}
\end{align}$$
A: I have not been able to find an elementary solution which avoids Taylor's series but I think we can provide much simpler approach in terms of calculations while following the Taylor's series approach.
Let $\tan x = t$ so that $\sin x = t/\sqrt{1 + t^{2}} = s$ and then $$\tan(\sin x) - \sin (\tan x) = \tan s - \sin t$$ Since $(\tan x)/x \to 1$ as $x \to 0$ we can replace the $x^{7}$ in denominator in the question by $t^{7}$. So the desired limit is equal to $$L = \lim_{t \to 0}\frac{\tan s - \sin t}{t^{7}}$$ where $s = t/\sqrt{1 + t^{2}}$. We will now need the expansion $$\tan s = s + \frac{s^{3}}{3} + \frac{2s^{5}}{15} + \frac{17s^{7}}{315} + \cdots$$ And then we have the tedious algebra $$\begin{aligned}A &= s + \frac{s^{3}}{3} + \frac{2s^{5}}{15}\\
&= \frac{t}{\sqrt{1 + t^{2}}} + \frac{t^{3}}{3(1 + t^{2})\sqrt{1 + t^{2}}} + \frac{2t^{5}}{15(1 + t^{2})^{2}\sqrt{1 + t^{2}}}\\
&= \frac{15t(1 + t^{2})^{2} + 5t^{3}(1 + t^{2}) + 2t^{5}}{15(1 + t^{2})^{2}\sqrt{1 + t^{2}}}\\
&= \frac{22t^{5} + 35t^{3} + 15t}{15(1 + t^{2})^{2}\sqrt{1 + t^{2}}}\\
&= \frac{22t^{5} + 35t^{3} + 15t}{15}\cdot(1 + t^{2})^{-5/2}\\
&= \left(t + \frac{7t^{3}}{3} + \frac{22t^{5}}{15}\right)\cdot\left(1 - \frac{5t^{2}}{2} + \frac{35t^{4}}{8} - \frac{105t^{6}}{16} + \cdots\right)\\
&= t + t^{3}\left(\frac{7}{3} - \frac{5}{2}\right) + t^{5}\left(\frac{35}{8} - \frac{35}{6} + \frac{22}{15}\right) + t^{7}\left(-\frac{105}{16} + \frac{245}{24} - \frac{22}{6}\right) + \cdots\\
&= t - \frac{t^{3}}{6} + \frac{t^{5}}{120} - \frac{t^{7}}{48} + \cdots\\
&= t - \frac{t^{3}}{3!} + \frac{t^{5}}{5!} - \frac{t^{7}}{48} + \cdots\end{aligned}$$ Note how nicely the first three terms match with those in expansion of $\sin t$.
The above tedious algebra was the only part which dealt with calculation of coefficients in a certain power series. One can see that it involves very less calculation and the series for $(1 + t^{2})^{-5/2}$ needs to be calculated till 3 terms only (ignoring the obvious first term 1).
Now the limit $L$ can be calculated very easily as follows $$\begin{aligned}L &= \lim_{t \to 0}\frac{\tan s - \sin t}{t^{7}}\\
& = \lim_{t \to 0}\frac{\tan s - A}{t^{7}} + \frac{A - \sin t}{t^{7}}\\
&= \lim_{t \to 0}\frac{\tan s - A}{s^{7}}\cdot\left(\frac{s}{t}\right)^{7} + \frac{A - \sin t}{t^{7}}\\
&= \frac{17}{315} - \frac{1}{48} + \frac{1}{7!} = \frac{1}{30}\end{aligned}$$ In the above we have used the expansion of $\sin t$ and $\tan s$ and we can see that the appropriate number of terms cancel because of the term $A$ and only the terms containing $s^{7}$ and $t^{7}$ are significant while the terms with higher powers of $s, t$ tend to $0$ and do not contribute to the limit. Also we have used the fact that as $t \to 0$ the variable $s \to 0$ and $s/t = 1/\sqrt{1 + t^{2}} \to 1$.
Note: An approach which avoids use of Taylor series and uses LHR is presented here (but it is really laborious).
A: Claim: Suppose for some integer $n\gt1$,
$$
f(x)=x+a_nx^n+a_{2n-1}x^{2n-1}+a_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)
$$
and
$$
g(x)=x+b_nx^n+b_{2n-1}x^{2n-1}+b_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)
$$
Then
$$
\begin{align}
&f(g(x))-g(f(x))\\
&=\left((n-1)(a_{2n-1}b_n-a_nb_{2n-1})+\frac{n(n-1)}{2}a_nb_n(b_n-a_n)\right)x^{3n-2}+o\left(x^{3n-2}\right)
\end{align}
$$

Applying the claim to
$$
\tan(x)=x+\frac13x^3+\frac2{15}x^5+\frac{17}{315}x^7+o\left(x^7\right)
$$
and
$$
\sin(x)=x-\frac16x^3+\frac1{120}x^5-\frac1{5040}x^7+o\left(x^7\right)
$$
yields
$$
\begin{align}
&\tan(\sin(x))-\sin(\tan(x))\\[9pt]
&=\left(2\left(-\frac2{15}\cdot\frac16-\frac13\cdot\frac1{120}\right)+3\cdot\frac13\cdot\frac16\left(\frac16+\frac13\right)\right)x^7+o\left(x^7\right)\\
&=\frac1{30}x^7+o\left(x^7\right)
\end{align}
$$

Proof of Claim: Simply, compose the series:
$$
\begin{align}
f(g(x))
&=\left(x+b_nx^n+b_{2n-1}x^{2n-1}+b_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)\right)\\
&+a_n\left(x+b_nx^n+b_{2n-1}x^{2n-1}+b_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)\right)^n\\
&+a_{2n-1}\left(x+b_nx^n+b_{2n-1}x^{2n-1}+b_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)\right)^{2n-1}\\
&+a_{3n-2}\left(x+b_nx^n+b_{2n-1}x^{2n-1}+b_{3n-2}x^{3n-2}+o\left(x^{3n-2}\right)\right)^{3n-2}\\
&+o\left(x^{3n-2}\right)\\
&=x+(a_n+b_n)x^n+(a_{2n-1}+b_{2n-1}+na_nb_n)x^{2n-1}\\
&+\left(a_{3n-2}+b_{3n-2}+na_nb_{2n-1}+\frac{n(n-1)}{2}a_nb_n^2+(2n-1)a_{2n-1}b_n\right)x^{3n-2}\\
&+o\left(x^{3n-2}\right)
\end{align}
$$
Note that the first three terms are symmetric in $a$ and $b$, so they will vanish in the difference.
Similarly,
$$
\begin{align}
g(f(x))
&=x+(a_n+b_n)x^n+(a_{2n-1}+b_{2n-1}+na_nb_n)x^{2n-1}\\
&+\left(a_{3n-2}+b_{3n-2}+na_{2n-1}b_n+\frac{n(n-1)}{2}a_n^2b_n+(2n-1)a_nb_{2n-1}\right)x^{3n-2}\\
&+o\left(x^{3n-2}\right)
\end{align}
$$
Subtract.
QED
