3. Let real numbers $a b$ satisfy
$$
\begin{array}{l}
a^{2}\left(b^{2}+1\right)+b(b+2 a)=40, \\
a(b+1)+b=8 .
\end{array}
$$

Find the value of $\frac{1}{a^{2}}+\frac{1}{b^{2}}$.
Hint: Transform the two equations in the conditions to get
$$
a^{2} b^{2}+(a+b)^{2}=40, a b+(a+b)=8 \text{. }
$$

Let $x=a+b, y=a b$.
Then, $x^{2}+y^{2}=40, x+y=8$.
Solving these, we get $(x, y)=(2,6)$ (discard) or $(6,2)$. Therefore, $\frac{1}{a^{2}}+\frac{1}{b^{2}}=\frac{(a+b)^{2}-2 a b}{a^{2} b^{2}}=8$.