5. Given $a, b \in \mathbf{N}_{+}$, the equations $x^{2}-a x+b=0$ and $x^{2}-b x+a=0$ have roots that are positive integers. Then all possible values of $a, b$ are $\qquad$ .
5. $\left\{\begin{array}{l}a=5, \\ b=6 ;\end{array} \quad\left\{\begin{array}{l}a=6, \\ b=5 ;\end{array} \quad\left\{\begin{array}{l}a=4 ; \\ b=4 .\end{array}\right.\right.\right.$

Let the roots of the equations $x^{2}-a x+b=0$ and $x^{2}-b x+a=0$ be $x_{1}, x_{2}$ and $x_{3}, x_{4}\left(x_{1}, x_{2}, x_{3}, x_{4} \in \mathbf{N}_{+}\right)$. Then,
$$
a=x_{1}+x_{2}=x_{3} x_{4}, b=x_{1} x_{2}=x_{3}+x_{4} .
$$

Therefore, $x_{1} x_{2} x_{3} x_{4}=\left(x_{1}+x_{2}\right)\left(x_{3}+x_{4}\right)$, which means
$$
\left(\frac{1}{x_{1}}+\frac{1}{x_{2}}\right)\left(\frac{1}{x_{3}}+\frac{1}{x_{4}}\right)=1 \text {. }
$$

If $x_{1}, x_{2}, x_{3}, x_{4} \geqslant 3$, then $\frac{1}{x_{1}}, \frac{1}{x_{2}}, \frac{1}{x_{3}}, \frac{1}{x_{4}} \leqslant \frac{1}{3}$.
At this point, $\left(\frac{1}{x_{1}}+\frac{1}{x_{2}}\right)\left(\frac{1}{x_{3}}+\frac{1}{x_{4}}\right) \leqslant \frac{4}{9}$, which contradicts equation (1).
Therefore, at least one of $x_{1}, x_{2}, x_{3}, x_{4}$ is less than 3, i.e., at least one is 1 or 2.

Without loss of generality, assume $x_{1}=1$. From the equation $x^{2}-a x+b=0$, we get $b=a-1$. The discriminant of the equation $x^{2}-b x+a=0$ is
$$
\Delta=b^{2}-4 a=(a-1)^{2}-4 a=(a-3)^{2}-8
$$

should be a perfect square, i.e., $(a-3)^{2}-8=m^{2}(m \in \mathbf{N})$. Then, $(a-3+m)(a-3-m)=8$.
Thus, $\left\{\begin{array}{l}a-3+m=8, \\ a-3-m=1\end{array}\right.$ or $\left\{\begin{array}{l}a-3+m=4, \\ a-3-m=2 .\end{array}\right.$
Solving these, we get $a=\frac{15}{2}, m=\frac{7}{2}$ (discard) or $a=6, m=1$.
Therefore, $a=6, b=5$.
If $x_{1}=2$, similarly, we get $a=5, b=6$ or $a=4, b=4$.