5. 145 Let the polynomial $R(x)$ have a degree less than 4, and there exists a polynomial $P(x)$ such that
$$\begin{array}{l}
7 \sin ^{31} t + 8 \sin ^{13} t - 5 \sin ^{5} t \cos ^{4} t - 10 \sin ^{7} t + 5 \sin ^{5} t - 2 \\
\equiv P(\sin t)\left[\sin ^{4} t - (1 + \sin t)\left(\cos ^{2} t - 2\right)\right] + R(\sin t)
\end{array}$$

where $t \in \mathbb{R}$. Try to find all such $R(x)$.
[Solution] Noting that $\cos ^{2} t=1-\sin ^{2} t$, and making the substitution $\sin t=x$, we get that the polynomial of degree less than 4 required in the problem is the remainder of the polynomial
$$S(x)=7 x^{31}+8 x^{13}-5 x^{9}-2$$

divided by the polynomial
$$Q(x)=x^{4}+x^{3}+x^{2}+x+1$$

The identity
$$S(x)=P(x) Q(x)+R(x)$$

should hold for all $x \in[-1,1]$, and thus for all $x \in \mathbb{C}$. Since $(x-1) Q(x)=x^{5}-1$, the variable $x$ has 4 distinct values that make $Q(x)=0$. For each such value of $x$, we have $x^{5}=1$, and
$$\begin{aligned}
R(x) & =S(x) \\
& =7 x^{31}+8 x^{13}-5 x^{9}-2 \\
& =7 x+8 x^{3}-5 x^{4}-2+5 Q(x) \\
& =13 x^{3}+5 x^{2}+12 x+3 .
\end{aligned}$$

Thus, $R(x)$ and $13 x^{3}+5 x^{2}+12 x+3$ take the same values at 4 distinct points, but both have degrees no greater than 3, so they are equal.