Given function: $x+y=\tan ^{-1} y$
Differentiating both sides with respect to $x$:
$\frac{d}{dx}(x+y) = \frac{d}{dx}(\tan^{-1} y)$
$1 + y^{\prime} = \frac{1}{1+y^2} y^{\prime}$
Rearranging the terms to solve for $y^{\prime}$:
$1 = y^{\prime} \left( \frac{1}{1+y^2} - 1 \right)$
$1 = y^{\prime} \left( \frac{1 - (1+y^2)}{1+y^2} \right)$
$1 = y^{\prime} \left( \frac{-y^2}{1+y^2} \right)$
$y^{\prime} = -\frac{1+y^2}{y^2}$
Now,substitute $y^{\prime}$ into the $L.H.S.$ of the differential equation $y^2 y^{\prime} + y^2 + 1 = 0$:
$L.H.S. = y^2 \left( -\frac{1+y^2}{y^2} \right) + y^2 + 1$
$L.H.S. = -(1+y^2) + y^2 + 1$
$L.H.S. = -1 - y^2 + y^2 + 1 = 0$
Since $L.H.S. = R.H.S.$,the given function is indeed a solution to the differential equation.