Evaluate $\int_{1/10}^{1/2}\left(\frac{\sin{x}-\sin{3x}+\sin{5x}}{\cos{x}+\cos{3x}+\cos{5x}}\right)^2dx$

Maybe it is useful to notice that

$$ \frac{\sin x-\sin(3x)+\sin(5x)}{\cos(x)+\cos(3x)+\cos(5x)}=\color{red}{\tan x}\tag{1}$$

and $\int \tan^2 x\,dx = -x+\tan(x).$ In terms of Chebyshev polynomials, $(1)$ is equivalent to: $$ x\cdot\left(1-U_2(x)+U_4(x)\right) = T_1(x)+T_3(x)+T_5(x)\tag{2}$$ that is straightforward to check.


$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{\mathrm{i}} \newcommand{\iff}{\Leftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\, #2 \,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$

\begin{align} &\color{#f00}{\sin\pars{x} - \sin\pars{3x} + \sin\pars{5x}} \\[3mm] = &\ \Im\sum_{k = 0}^{2}\pars{-1}^{k}\expo{\ic\pars{2k + 1}x} = \Im\bracks{\expo{\ic x}\, {\pars{-\expo{2\ic x}}^{3} - 1 \over -\expo{2\ic x} - 1}} = \sin\pars{3x}\,{\cos\pars{3x} \over \color{#f00}{\cos\pars{x}}}\tag{1} \\ &\ -------------------------------- \\ &\color{#f00}{\cos\pars{x} + \cos\pars{3x} + \cos\pars{5x}} \\[3mm] = &\ \Re\sum_{k = 0}^{2}\expo{\ic\pars{2k + 1}x} = \Re\bracks{\expo{\ic x}\, {\pars{\expo{2\ic x}}^{3} - 1 \over \expo{2\ic x} - 1}} = \cos\pars{3x}\,{\sin\pars{3x} \over \color{#f00}{\sin\pars{x}}}\tag{2} \\ &\ -------------------------------- \\ &\ \mbox{Then,}\quad {\pars{1} \over \pars{2}} = \color{#f00}{\tan\pars{x}} \end{align}


Someone's suggested Chebyshev polynomials. I hadn't thought of that, but I know the tangent half-angle formula: $$ \frac{\sin\alpha+\sin\beta}{\cos\alpha+\cos\beta} = \tan\frac{\alpha+\beta}2. $$ From that we get $$ \frac{\sin(-3x) + \sin(5x)}{\cos(-3x) + \cos(5x)} = \tan x. $$ Since $\cos(-3x)=\cos(3x)$, that's the same as the function that gets squared except it's missing the two functions of $1\cdot x$. But if $$ \frac a b = \frac c d $$ then both are equal to $$ \frac{a+b}{c+d} $$ and that can be applied in the case where we have $$ \frac a b = \frac{\sin(-3x) + \sin(5x)}{\cos(-3x) + \cos(5x)} = \tan x = \frac{\sin x}{\cos x} = \frac c d. $$ with the ultimate conclusion that the fraction that gets squared under the integral sign is $\tan x$.