Example 4. Given $\sum_{j=1}^{n} a_{j} \cos \alpha_{j}=\sum_{j=1}^{n} a_{5} \cdot \cos \left(\alpha_{j}+1\right)=0$, find the value of $\sum_{j=1}^{n} a_{j} \cos \left(\alpha_{j}+\frac{\pi}{10}\right)$.
Consider the function $f(x)=\sum_{j=1}^{n} a_{j} \cos \left(\alpha_{j}+x\right)$. It is easy to see that $f(0)=f(1)=0$. Since $\cos \left(a_{j}+x\right) = \cos \alpha_{j} \cos x - \sin \alpha_{j} \sin x$, we have
$$
\begin{array}{l}
f(x)=\cos x \sum_{\mathrm{j}=1}^{n} a_{j} \cos \alpha_{j} + \sin x \sum_{\mathrm{j}=1}^{n} a_{j} \cos \left(\alpha_{j}+\frac{\pi}{2}\right) \\
=\cos x f(0) + \sin x f\left(\frac{\pi}{2}\right) \\
=\sin x f\left(\frac{\pi}{2}\right) .
\end{array}
$$

Let $x=1, f(1)=0, \sin 1 \neq 0$, hence
$$
\begin{array}{l}
f\left(\frac{\pi}{2}\right)=0 . \\
\therefore f(x)=0, \text{ thus } f\left(\frac{\pi}{10}\right)=0 .
\end{array}
$$