Using the usual identity we have
$\dfrac{(\tan^2 a + 1)^2}{\tan^2b}+\dfrac{(\tan^2 b + 1)^2}{\tan^2a}.$
If we let $x = \tan a$ and $y = \tan b$ then we have
$z = \dfrac{(x^2 + 1)^2}{y^2}+\dfrac{(y^2 + 1)^2}{x}.$
Using the standard first derivatives we have (noting that $x,y \ne 0$)
$\dfrac{\partial z}{\partial x} = 4\,{\dfrac { \left( {x}^{2}+1 \right) x}{{y}^{2}}}-2\,{\dfrac { \left( {
y}^{2}+1 \right) ^{2}}{{x}^{3}}}$
$\dfrac{\partial z}{\partial y} = 4\,{\dfrac { \left( {y}^{2}+1 \right) y}{{x}^{2}}}-2\,{\dfrac { \left( {
x}^{2}+1 \right) ^{2}}{{y}^{3}}}$
Simplify and setting these to zero gives
$
\begin{align}
2\,{x}^{6}+2\,{x}^{4}-{y}^{6}-2\,{y}^{4}-{y}^{2} &= 0\;\;\;(*)\\
-{x}^{6}-2\,{x}^{4}-{x}^{2}+2\,{y}^{6}+2\,{y}^{4}&=0
\end{align}$
Multiplying the first by $x^2+1$ and the second by $2x^2$ and adding gives
${y}^{2} \left( {y}^{2}+1 \right) \left( 3\,{y}^{2}{x}^{2}-{y}^{2}-1-{
x}^{2} \right) =0$
from which we can solve for $y^2$ giving $y^2 = \dfrac{x^2+1}{3x^2-1}$ noting that $3x^2-1 \ne 0$. Substituting into (*) and factoring gives $x = \pm 1$ which in turn gives $y = \pm 1$ giving the minimum value of $z$ as $8$. The second derivative test verifies this.