A tough limit problem involving $1/(\sin x - \sin a)$ and its generalization Long back I had encountered the following problem in Hardy's Pure Mathematics (originally from the infamous Mathematical Tripos 1896):
If $$f(x) = \frac{1}{\sin x - \sin a} - \frac{1}{(x - a)\cos a}$$ then show that $$\frac{d}{da}\{\lim_{x \to a}f(x)\} - \lim_{x \to a}f'(x) = \frac{3}{4}\sec^{3}a - \frac{5}{12}\sec a$$
I had solved it using Taylor series expansions and even then it involved good amount of calculation. I suppose applying L'Hospital would be even more arduous.
On the other hand both the Taylor series and L'Hospital Rule are discussed later in Hardy's book suggesting that it could be solved via elementary techniques (i.e. using algebra of limits and Squeeze theorem and if needed one can use mean value theorem). Please let me know if such a solution is possible.
Also I believe there might be a suitable generalization applicable to functions of type $$g(x) = \frac{1}{\phi(x) - \phi(a)} - \frac{1}{(x - a)\phi'(a)}$$ and perhaps the expression $$\frac{d}{da}\{\lim_{x \to a}g(x)\} - \lim_{x \to a}g'(x)$$ has some significance. Any ideas in this direction would be helpful.
 A: $$\begin{align} \lim_{x \to a} f(x) &= \lim_{x\to a}\frac{1}{\sin x - \sin a} - \frac{1}{(x - a)\cos a} \\= \ & \sec a\lim_{x\to a}\dfrac{(x-a)\cos a + \sin a - \sin x}{(x-a) (\sin x - \sin a)}\\= \ & \sec a\lim_{x\to a}\dfrac{(x-a)\cos a + \sin a - \sin x}{(x-a) (\sin x - \sin a)} \end{align}$$
Let $ y = x - a$; Since $\sin x - \sin a = 2\sin \left(\dfrac{x-a}{2}\right) \cos \left(\dfrac{x+a}{2}\right)$
$$\begin{align}\sec a\lim_{x\to a}\dfrac{(x-a)\cos a + \sin a - \sin x}{(x-a) (\sin x - \sin a)} & = \dfrac{\sec^2 a}{2}\lim_{y \to 0} \dfrac{(y - \sin y) \cos a + \sin a (1 - \cos y)}{y \sin(y/2)} \\=\ & \sec^2 a\lim_{y \to 0} \dfrac{(y - \sin y) \cos a}{y^2} + \sec^2 a\lim_{y\to0 }\dfrac{\sin a (1 - \cos y)}{y^2 }. \end{align}$$
It is common knowledge that $\lim_{y \to 0} \dfrac{y -\sin y}{y^2} = 0$ and $\lim_{y\to0 }\dfrac{ 1 - \cos y}{y^2 } = \dfrac12$ can be proved only using standard limits(I omitted the proof for the sake of brevity).
Therefore $$\bbox[5px,border-style: solid; border-color:black; border-width: 2px]{\lim_{x \to a} f(x) = \dfrac12 \sec a \tan a.} \tag 1$$

$$f'(x) = \dfrac{1}{(x-a)\cos a} - \dfrac{\cos x}{(\sin x - \sin a)^2}$$
$$\begin{align}\lim_{x \to a} f'(x) = & \sec a \lim_{x\to a}\dfrac{(\sin x -\sin a)^2 - (x-a)^2\cos x \cos a }{(x-a)^2 (\sin x - \sin a)^2} \\= \ & \dfrac{\sec^3 a}{4} \lim_{x\to a}\dfrac{(\sin x -\sin a)^2 - (x-a)^2\cos x \cos a }{(x-a)^2 \sin^2\left(\dfrac{x-a}{2}\right)}  \end{align}$$
Letting $ y = x - a$ the above limit becomes,
$$\begin{align}\sec^3 a\lim_{y \to 0} \dfrac{(\sin(y + a ) - \sin a)^2 - y^2 \cos (y +a )\cos a}{y^4}. \end{align}$$
Expanding the numerator completely in terms of $\sin a, \cos a, \sin y $ and $\cos y$, we get 
$$\begin{align}\sec^3 a \lim_{y \to 0} \dfrac{\sin^2 y \cos^2 a + \cos^2 y \sin^2 a + \sin^2 a + 2\sin a \cos a \sin y \cos y \\- 2 \sin a \cos a \sin y - 2\sin^2 a \cos y - y^2 \cos y \cos a^2 + y^2 \sin y \sin a \cos a}{y^4}\end{align}$$
Collecting terms simplifies this to 
$$\sec^3 a\lim_{y\to 0} \dfrac{\cos^2 a(\sin^2 y - y^2 \cos y) + \sin a \cos a \sin y (2 \cos y  - 2+ y^2) + \sin^2 a (\cos y - 1)^2}{y^4}$$


*

*Solving $\lim_{y \to 0} \dfrac{\sin^2 y - y^2 \cos y}{y^4}$ :


$$\begin{align} \lim_{y \to 0} \dfrac{\sin^2 y - y^2 \cos y}{y^4} =& \lim_{y \to 0} \dfrac{\sin^2 y - y^2 }{y^4}+\lim_{y \to 0}\dfrac{1-  \cos y}{y^2}  \\= \ &\lim_{y \to 0} \left(\dfrac{\sin y - y }{y^3}\right)\left(\dfrac{\sin y + y }{y}\right)+\lim_{y \to 0}\dfrac{1-  \cos y}{y^2}\end{align}$$
Using $\lim_{y \to 0} \dfrac{\sin y - y}{y^3} = \dfrac{-1}{6}$(proved here using only standard limits) and couple other familiar limits, we get the limit as $\dfrac 16$.


*

*Solving $\lim_{y \to 0} \sin y\dfrac{(2 \cos y - 2 + y^2)}{y^4}$:


$$\begin{align}\lim_{y \to 0} \sin y\dfrac{(2 \cos y - 2 + y^2)}{y^4} 
 = &\lim_{y \to 0} \dfrac{\sin y}{y}\left(\dfrac{ y^2 - 4\sin^2(y/2)}{y^3}\right) \\=\ &\lim_{y \to 0} \dfrac14\left(\dfrac{ y/2 - 2\sin(y/2)}{(y/2)^3}\right)(y + 2 \sin(y/2)) \\ = \ & \dfrac16 \cdot 0 = 0.
  \end{align}$$ 


*

*Lastly we use our "common knowledge" to show to conclude that $\lim_{y \to 0} \dfrac{(\cos y - 1)^2}{y^4} = \dfrac14$.


Using above three bullet points we get $$\lim_{x\to a} f'(x) = \dfrac{\sin^2 a\sec^3 a}{4} + \dfrac{\sec a}{6} = \dfrac{\sec^3 a}{4} - \dfrac{\sec a}{12}.$$
Hence $$\bbox[5px,border-style: solid; border-color:black; border-width: 2px]{\lim_{x \to a} f'(x) = \dfrac{\sec^3 a}{4} - \dfrac{\sec a}{12}.} \tag 2$$

Using $(1)$ and $(2)$ 
$$\begin{align}\dfrac{d}{ da}\{\lim_{x \to a}f(x)\} - \lim_{x \to a}f'(x)=& \sec^3 a - \dfrac12\sec a - \dfrac{\sec^3 a}{4} + \dfrac{\sec a}{12}\\ = \ & \dfrac{3\sec^3 a}{4} - \dfrac{5 \sec a}{12}.\end{align}$$
