2. Find all $p(x) \in \mathbf{R}[x]$ such that for any $x$ $\neq 0$, we have $p(x)^{2}+p\left(\frac{1}{x}\right)^{2}=p\left(x^{2}\right) p\left(\frac{1}{x^{2}}\right)$.
2. Analysis: We start the discussion from the degree of $p(x)$.

If $p(x)$ is a constant polynomial, let $p(x)=c$, then $c^{2} + c^{2} = c^{2}$, which implies $c=0$, i.e., $p(x)=0$; If $\operatorname{deg} p \geqslant 1$, let $p(x)=a_{n} x^{n}+a_{n-1} x^{n-1}+\cdots+a_{0}, a_{n} \neq 0, n \in \mathbf{N}^{+}$, by the condition we have
$$
\begin{array}{l}
\quad x^{2 n}\left(a_{n} x^{n}+a_{n-1} x^{n-1}+\cdots+a_{0}\right)^{2}+\left(a_{0} x^{n}+\right. \\
\left.\cdots+a_{n-1} x+a_{n}\right)^{2} \\
\quad=\left(a_{n} x^{2 n}+a_{n-1} x^{2(n-1)}+\cdots+a_{0}\right)\left(a_{0} x^{2 n}+\right. \\
\left.a_{1} x^{2(n-1)}+\cdots+a_{n}\right) .
\end{array}
$$

By comparing the constant terms on both sides, we know $a_{n}^{2}=a_{0} a_{n}$, hence $a_{0} = a_{n}$; By comparing the coefficients of the $x$ term, we get $2 a_{n-1} a_{n}=0$, hence $a_{n-1}=0$; By comparing the coefficients of the $x^{2 n-1}$ term, we get $2 a_{1} a_{0}=0$, and since $a_{0}=a_{n} \neq 0$, we have $a_{1}=0$, thus the coefficients of the $x^{2 n+2}$ and $x^{2}$ terms on the right side are 0. By comparing the coefficients of $x^{2 n+2}$ and $x^{2}$ on both sides, we know $a^{2}=0, a_{n-2}=0$; Proceeding in this manner, we find $a_{n-1}=\cdots=a_{1}=0$. Therefore, $p(x)=a_{n} x^{n}+a_{n}, a_{n} \neq 0$,

This requires $x^{2 n}\left(x^{n}+1\right)^{2}+\left(x^{n}+1\right)^{2}=\left(x^{2 n}+1\right)^{2}$, which is a contradiction.

Therefore, the only polynomial that satisfies the condition is $p(x)=0$.