Proving a definite integral is finite

I have a integral which I have to prove is finite.

$$\int_{-\pi }^{\pi } \left(\frac{x \cos x-\sin x}{x^2}\right)^2 dx$$

call the function inside $$g(x)$$, where $$g(x) = (f'(x))^2$$ and where $$f(x) = \frac{\sin x}{x}$$ more explicitly the function $$f(x)$$ is piece-wise that is:

$$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f(x) = \begin{cases} \frac{\sin x}{x} \ \ \text{for } x \neq 0 \\ \ \ 1 \ \ \ \ \ \text{for} \ x = 0 \end{cases}$$

(I am not 100% sure this is how piecewise function works but correct me if I am wrong)

This implies

$$\rightarrow \ \ \ \ \ \ \ \ \ \ \ \ \ g(x) = \begin{cases} \left(\frac{x \cos x - \sin x}{x^2}\right)^2 \ \ \text{for} \ x \neq0 \\ \ \ \ \ \ \ \ 0 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \text{for} \ x = 0 \end{cases}$$

Again correct me if the leap of logic from $$f(x) \rightarrow g(x)$$ does not make sense given that $$g(x) = (f'(x))^2$$.

Given that the above was done correctly it can be shown (using L'Hopital's ) that the function is continuous everywhere including $$x = 0$$. My logic is that since this function is well behaved (never goes to infinity) is continuous everywhere on the interval from $$[-\pi,\pi]$$ and the integral is over a finite domain. Therefore the integral must be finite. I have never heard of a theorem explicitly stating these conditions but let me know if this is true.

(The graph of $$g(x)$$ below) • Yes, $g$ can be extended to a continuous function over $[-\pi,\pi]$. Then see math.stackexchange.com/questions/90939/… – Robert Z Nov 14 '18 at 17:51
• Does the piecewise quality extend to $g(x)$ as a consequence of $f(x)$ being a piecewise function as well? – QuantumPanda Nov 14 '18 at 17:54
• Sorry, I mean $g$... Anyway if $f$ is continuous then $f^2$ is continuous too. – Robert Z Nov 14 '18 at 17:56
• Once you know the function is continuous on a closed interval, you know it has an upper and lower bound. In this particular case, the lower bound is $0$ and the integral will not exceed the area of the bounding rectangle. – John Wayland Bales Nov 18 '18 at 1:03