5. (2004 Australian Mathematical Olympiad) Find all integer pairs $(a, b)$ such that $\left(a^{3}+b\right)\left(a+b^{3}\right)=(a+b)^{4}$.
5. Solution: Notice that $\left(a^{3}+b\right)\left(a+b^{3}\right)=(a+b)^{4}$
$$
\begin{array}{l}
\Leftrightarrow a^{4}+a^{3} b^{3}+a b+b^{4}=a^{4}+4 a^{3} b+6 a^{2} b^{2}+4 a b^{3}+b^{4} \\
\Leftrightarrow a^{3} b^{3}+2 a^{2} b^{2}+a b=4 a^{3} b+8 a^{2} b^{2}+4 a b^{3} \\
\Leftrightarrow a b(a b+1)^{2}=4 a b(a+b)^{2} \\
\Leftrightarrow a b\left[(a b+1)^{2}-4(a+b)^{2}\right]=0
\end{array}
$$

Therefore, $(a, 0),(0, b)$ are solutions to the given equation, where $a, b \in \mathbf{Z}$.
Other solutions must satisfy $(a b+1)^{2}-4(a+b)^{2}=0$.
That is, $a b+1= \pm 2(a+b)$ must hold.
If $a b+1=2(a+b)$, then $(a-2)(b-2)=3$.
Thus, we have $\left\{\begin{array}{l}a-2=3 \\ b-2=1\end{array}\right.$ or $\left\{\begin{array}{l}a-2=1 \\ b-2=3\end{array}\right.$ or $\left\{\begin{array}{l}a-2=-3 \\ b-2=-1\end{array}\right.$ or $\left\{\begin{array}{l}a-2=-1 \\ b-2=-3\end{array}\right.$.
Solving these, we get $(a, b)=(5,3)(3,5),(-1,1),(1,-1)$.
If $a b+1=-2(a+b)$, then $(a+2)(b+2)=3$.
Similarly, we get $(a, b)=(1,-1),(-1,1),(-5,-3),(-3,-5)$.
In summary, the set of all possible solutions to the given equation is $\{(a, 0) \mid a \in \mathbf{Z}\} \cup\{(0, b) \mid b \in \mathbf{Z}\} \cup\{(-5$, $-3),(-3,-5),(-1,1),(1,-1),(3,5),(5,3)\}$.