<s>[INST] Differentiate by first principle,$f(x)=\frac{x^2}{\sin x}$ Differentiate by first principle,$f(x)=\frac{x^2}{\sin x}$

$$f'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}$$
$$f'(x)=\lim_{h\to0}\frac{\frac{(x+h)^2}{\sin(x+h)}-\frac{x^2}{\sin x}}{h}$$
$$f'(x)=\lim_{h\to0}\frac{\frac{(x+h)^2\sin x-x^2\sin(x+h)}{\sin(x+h)\sin x}}{h}$$
$$f'(x)=\lim_{h\to0}\frac{(x+h)^2\sin x-x^2\sin(x+h)}{h\sin x\sin(x+h)}$$
$$f'(x)=\lim_{h\to0}\frac{x^2}{\sin x}\frac{(1+\frac{h}{x})^2\sin x-\sin(x+h)}{h\sin(x+h)}$$
I am stuck here.
 [/INST] Note that $$\lim _{ h\to 0 } \frac { 2\sin ^{ 2 }{ \frac { h }{ 2 }  }  }{ h } =\lim _{ h\to 0 } \frac { \sin { \frac { h }{ 2 } \cdot \sin { \frac { h }{ 2 }  }  }  }{ \frac { h }{ 2 }  } =\lim _{ h\to 0 } \frac { \sin { \frac { h }{ 2 }  }  }{ \frac { h }{ 2 }  } \sin { \frac { h }{ 2 }  } =0$$
so
$$
\begin{align}
f'(x)&=\lim _{ h\to 0 } \frac { (x+h)^{ 2 }\sin  x-x^{ 2 }\sin  (x+h) }{ h\sin  x\sin  (x+h) }\\&=\lim _{ h\to 0 } \frac { { x }^{ 2 }\sin  x+2xh\sin { x+{ h }^{ 2 }\sin { x }  } -x^{ 2 }\sin  x\cos { h } -{ x }^{ 2 }\sin { h\cos { x }  }  }{ h\sin  x\sin  (x+h) }\\ &=\lim _{ h\to 0 } \frac { { x }^{ 2 }\sin  x\cdot \left( 1-\cos { h }  \right) +h\sin { x\cdot \left( 2x+h \right)  } -{ x }^{ 2 }\sin { h\cos { x }  }  }{ h\sin  x\sin  (x+h) }\\&=\lim _{ h\to 0 } \frac { { x }^{ 2 }\sin  x\cdot \frac { 2\sin ^{ 2 }{ \frac { h }{ 2 }  }  }{ h } +\sin { x\cdot \left( 2x+h \right)  } -{ x }^{ 2 }\frac { \sin { h }  }{ h } \cdot \cos { x }  }{ \sin  x\sin  (x+h) }\\& =\frac { 2x\sin { x-{ x }^{ 2 }\cos { x }  }  }{ \sin ^{ 2 }{ x }  } 
\end{align}$$
</s>